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