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