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