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