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