File mozilla-bmo849632.patch of Package MozillaThunderbird.40006

# HG changeset patch

From: Martin Sirringhaus <martin.sirringhaus@suse.com>

# Parent  3de59fe1b8708c01e134ce698c4232b8a854f617
Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
          knows how to deal with little endian.
          So we swizzle the output of webgl after reading it from readpixels()
Note:     This does not fix all webGL sites, but is a step in the right direction
---
 gfx/gl/GLContext.h |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
index 45c75e8b6ecf..5096d59b7e70 100644
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1595,6 +1595,13 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
     BEFORE_GL_CALL;
     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
     OnSyncCall();
+#if MOZ_BIG_ENDIAN()
+    uint8_t* itr = (uint8_t*)pixels;
+    for (GLsizei i = 0; i < width * height; i++) {
+      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
+      itr += 4;
+    }
+#endif
     AFTER_GL_CALL;
     mHeavyGLCallsSinceLastFlush = true;
   }
openSUSE Build Service is sponsored by