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