1https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c5 2https://bugzilla.mozilla.org/attachment.cgi?id=9028600 3Rough progress patch 4 5 6diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp 7index 6bbef8d..82b04ba 100644 8--- gfx/2d/DrawTargetSkia.cpp 9+++ gfx/2d/DrawTargetSkia.cpp 10@@ -154,8 +154,7 @@ static IntRect CalculateSurfaceBounds(const IntSize& aSize, const Rect* aBounds, 11 return surfaceBounds.Intersect(bounds); 12 } 13 14-static const int kARGBAlphaOffset = 15- SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0; 16+static const int kARGBAlphaOffset = 0; 17 18 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize, 19 const int32_t aStride, SurfaceFormat aFormat) { 20diff --git gfx/2d/Types.h gfx/2d/Types.h 21index 6b3bdc7..7c6c342 100644 22--- gfx/2d/Types.h 23+++ gfx/2d/Types.h 24@@ -90,15 +90,8 @@ enum class SurfaceFormat : int8_t { 25 // The following values are endian-independent synonyms. The _UINT32 suffix 26 // indicates that the name reflects the layout when viewed as a uint32_t 27 // value. 28-#if MOZ_LITTLE_ENDIAN() 29 A8R8G8B8_UINT32 = B8G8R8A8, // 0xAARRGGBB 30 X8R8G8B8_UINT32 = B8G8R8X8, // 0x00RRGGBB 31-#elif MOZ_BIG_ENDIAN() 32- A8R8G8B8_UINT32 = A8R8G8B8, // 0xAARRGGBB 33- X8R8G8B8_UINT32 = X8R8G8B8, // 0x00RRGGBB 34-#else 35-# error "bad endianness" 36-#endif 37 38 // The following values are OS and endian-independent synonyms. 39 // 40--- gfx/skia/skia/modules/skcms/skcms.cc.orig 41+++ gfx/skia/skia/modules/skcms/skcms.cc 42@@ -30,6 +30,8 @@ 43 #include <avx512fintrin.h> 44 #include <avx512dqintrin.h> 45 #endif 46+#else 47+ #define SKCMS_PORTABLE 48 #endif 49 50 static bool runtime_cpu_detection = true; 51@@ -324,20 +326,28 @@ 52 static uint16_t read_big_u16(const uint8_t* ptr) { 53 uint16_t be; 54 memcpy(&be, ptr, sizeof(be)); 55-#if defined(_MSC_VER) 56- return _byteswap_ushort(be); 57+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 58+ return be; 59 #else 60+ #if defined(_MSC_VER) 61+ return _byteswap_ushort(be); 62+ #else 63 return __builtin_bswap16(be); 64+ #endif 65 #endif 66 } 67 68 static uint32_t read_big_u32(const uint8_t* ptr) { 69 uint32_t be; 70 memcpy(&be, ptr, sizeof(be)); 71-#if defined(_MSC_VER) 72- return _byteswap_ulong(be); 73+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__ 74+ return be; 75 #else 76+ #if defined(_MSC_VER) 77+ return _byteswap_ulong(be); 78+ #else 79 return __builtin_bswap32(be); 80+ #endif 81 #endif 82 } 83 84