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