d445b2
# HG changeset patch
d445b2
# Parent  051b75a600dfbf7503c3485cebfd34d4eb29be96
d445b2
Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1504834
d445b2
d445b2
diff -r 051b75a600df gfx/2d/DrawTargetSkia.cpp
d445b2
--- a/gfx/2d/DrawTargetSkia.cpp	Fri Jul 05 12:42:44 2019 +0200
d445b2
+++ b/gfx/2d/DrawTargetSkia.cpp	Mon Jul 08 10:59:30 2019 +0200
d445b2
@@ -138,8 +138,7 @@
d445b2
   return surfaceBounds.Intersect(bounds);
d445b2
 }
d445b2
 
d445b2
-static const int kARGBAlphaOffset =
d445b2
-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
d445b2
+static const int kARGBAlphaOffset = 0;  // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
d445b2
 
d445b2
 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
d445b2
                              const int32_t aStride, SurfaceFormat aFormat) {
d445b2
diff -r 051b75a600df gfx/2d/Types.h
d445b2
--- a/gfx/2d/Types.h	Fri Jul 05 12:42:44 2019 +0200
d445b2
+++ b/gfx/2d/Types.h	Mon Jul 08 10:59:30 2019 +0200
d445b2
@@ -85,15 +85,8 @@
d445b2
 // The following values are endian-independent synonyms. The _UINT32 suffix
d445b2
 // indicates that the name reflects the layout when viewed as a uint32_t
d445b2
 // value.
d445b2
-#if MOZ_LITTLE_ENDIAN
d445b2
   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
d445b2
   X8R8G8B8_UINT32 = B8G8R8X8   // 0x00RRGGBB
d445b2
-#elif MOZ_BIG_ENDIAN
d445b2
-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
d445b2
-  X8R8G8B8_UINT32 = X8R8G8B8   // 0x00RRGGBB
d445b2
-#else
d445b2
-#  error "bad endianness"
d445b2
-#endif
d445b2
 };
d445b2
 
d445b2
 static inline int BytesPerPixel(SurfaceFormat aFormat) {
d445b2
diff -r 051b75a600df gfx/skia/skia/third_party/skcms/skcms.cc
d445b2
--- a/gfx/skia/skia/third_party/skcms/skcms.cc	Fri Jul 05 12:42:44 2019 +0200
d445b2
+++ b/gfx/skia/skia/third_party/skcms/skcms.cc	Mon Jul 08 10:59:30 2019 +0200
d445b2
@@ -17,6 +17,8 @@
d445b2
     #include <arm_neon.h>
d445b2
 #elif defined(__SSE__)
d445b2
     #include <immintrin.h>
d445b2
+#else
d445b2
+    #define SKCMS_PORTABLE
d445b2
 #endif
d445b2
 
d445b2
 // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
d445b2
@@ -124,20 +126,28 @@
d445b2
 static uint16_t read_big_u16(const uint8_t* ptr) {
d445b2
     uint16_t be;
d445b2
     memcpy(&be, ptr, sizeof(be));
d445b2
-#if defined(_MSC_VER)
d445b2
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
d445b2
+    return be;
d445b2
+#else
d445b2
+    #if defined(_MSC_VER)
d445b2
     return _byteswap_ushort(be);
d445b2
-#else
d445b2
+    #else
d445b2
     return __builtin_bswap16(be);
d445b2
+    #endif
d445b2
 #endif
d445b2
 }
d445b2
 
d445b2
 static uint32_t read_big_u32(const uint8_t* ptr) {
d445b2
     uint32_t be;
d445b2
     memcpy(&be, ptr, sizeof(be));
d445b2
-#if defined(_MSC_VER)
d445b2
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
d445b2
+    return be;
d445b2
+#else
d445b2
+    #if defined(_MSC_VER)
d445b2
     return _byteswap_ulong(be);
d445b2
-#else
d445b2
+    #else
d445b2
     return __builtin_bswap32(be);
d445b2
+    #endif
d445b2
 #endif
d445b2
 }
d445b2