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