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