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