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