155c30
diff -up firefox-78.0/gfx/2d/DrawTargetSkia.cpp.mozilla-bmo1504834-part1 firefox-78.0/gfx/2d/DrawTargetSkia.cpp
155c30
--- firefox-78.0/gfx/2d/DrawTargetSkia.cpp.mozilla-bmo1504834-part1	2020-06-17 04:18:58.000000000 +0200
155c30
+++ firefox-78.0/gfx/2d/DrawTargetSkia.cpp	2020-06-25 16:52:29.824532769 +0200
155c30
@@ -135,8 +135,7 @@ static IntRect CalculateSurfaceBounds(co
155c30
   return surfaceBounds.Intersect(bounds);
155c30
 }
155c30
 
155c30
-static const int kARGBAlphaOffset =
155c30
-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
155c30
+static const int kARGBAlphaOffset = 0;  // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
155c30
 
155c30
 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
155c30
                              const int32_t aStride, SurfaceFormat aFormat) {
155c30
diff -up firefox-78.0/gfx/2d/Types.h.mozilla-bmo1504834-part1 firefox-78.0/gfx/2d/Types.h
155c30
--- firefox-78.0/gfx/2d/Types.h.mozilla-bmo1504834-part1	2020-06-25 16:52:29.826532776 +0200
155c30
+++ firefox-78.0/gfx/2d/Types.h	2020-06-25 16:55:02.942063616 +0200
155c30
@@ -90,15 +90,8 @@ enum class SurfaceFormat : int8_t {
155c30
 // The following values are endian-independent synonyms. The _UINT32 suffix
155c30
 // indicates that the name reflects the layout when viewed as a uint32_t
155c30
 // value.
155c30
-#if MOZ_LITTLE_ENDIAN()
155c30
   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
155c30
   X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
155c30
-#elif MOZ_BIG_ENDIAN()
155c30
-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
155c30
-  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
155c30
-#else
155c30
-#  error "bad endianness"
155c30
-#endif
155c30
 
155c30
   // The following values are OS and endian-independent synonyms.
155c30
   //
155c30
diff -up firefox-78.0/gfx/skia/skia/third_party/skcms/skcms.cc.mozilla-bmo1504834-part1 firefox-78.0/gfx/skia/skia/third_party/skcms/skcms.cc
155c30
--- firefox-78.0/gfx/skia/skia/third_party/skcms/skcms.cc.mozilla-bmo1504834-part1	2020-06-17 04:18:58.000000000 +0200
155c30
+++ firefox-78.0/gfx/skia/skia/third_party/skcms/skcms.cc	2020-06-25 16:54:02.993855444 +0200
155c30
@@ -30,6 +30,8 @@
155c30
         #include <avx512fintrin.h>
155c30
         #include <avx512dqintrin.h>
155c30
     #endif
155c30
+#else
155c30
+    #define SKCMS_PORTABLE
155c30
 #endif
155c30
 
155c30
 // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
155c30
@@ -280,20 +282,28 @@ enum {
155c30
 static uint16_t read_big_u16(const uint8_t* ptr) {
155c30
     uint16_t be;
155c30
     memcpy(&be, ptr, sizeof(be));
155c30
-#if defined(_MSC_VER)
155c30
-    return _byteswap_ushort(be);
155c30
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
155c30
+    return be;
155c30
 #else
155c30
+    #if defined(_MSC_VER)
155c30
+    return _byteswap_ushort(be);
155c30
+    #else
155c30
     return __builtin_bswap16(be);
155c30
+    #endif
155c30
 #endif
155c30
 }
155c30
 
155c30
 static uint32_t read_big_u32(const uint8_t* ptr) {
155c30
     uint32_t be;
155c30
     memcpy(&be, ptr, sizeof(be));
155c30
-#if defined(_MSC_VER)
155c30
-    return _byteswap_ulong(be);
155c30
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
155c30
+    return be;
155c30
 #else
155c30
+    #if defined(_MSC_VER)
155c30
+    return _byteswap_ulong(be);
155c30
+    #else
155c30
     return __builtin_bswap32(be);
155c30
+    #endif
155c30
 #endif
155c30
 }
155c30