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