cbe2c5
# HG changeset patch
cbe2c5
# Parent  3de59fe1b8708c01e134ce698c4232b8a854f617
d445b2
Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
d445b2
Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
d445b2
          knows how to deal with little endian.
d445b2
          So we swizzle the output of webgl after reading it from readpixels()
d445b2
Note:     This does not fix all webGL sites, but is a step in the right direction
cbe2c5
cbe2c5
diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
cbe2c5
--- a/gfx/gl/GLContext.h
cbe2c5
+++ b/gfx/gl/GLContext.h
cbe2c5
@@ -1548,16 +1548,23 @@ class GLContext : public GenericAtomicRe
cbe2c5
     AFTER_GL_CALL;
cbe2c5
   }
cbe2c5
 
cbe2c5
   void raw_fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
cbe2c5
                        GLenum format, GLenum type, GLvoid* pixels) {
d445b2
     BEFORE_GL_CALL;
d445b2
     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
d445b2
     OnSyncCall();
cbe2c5
+#if MOZ_BIG_ENDIAN()
d445b2
+    uint8_t* itr = (uint8_t*)pixels;
d445b2
+    for (GLsizei i = 0; i < width * height; i++) {
d445b2
+      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
d445b2
+      itr += 4;
d445b2
+    }
d445b2
+#endif
d445b2
     AFTER_GL_CALL;
d445b2
     mHeavyGLCallsSinceLastFlush = true;
d445b2
   }
cbe2c5
 
cbe2c5
   void fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
cbe2c5
                    GLenum format, GLenum type, GLvoid* pixels);
cbe2c5
 
cbe2c5
  public: