812674
diff -up firefox-115.2.0/gfx/2d/DrawTargetSkia.cpp.mozilla-bmo1504834-part1 firefox-115.2.0/gfx/2d/DrawTargetSkia.cpp
812674
--- firefox-115.2.0/gfx/2d/DrawTargetSkia.cpp.mozilla-bmo1504834-part1	2023-09-20 22:15:11.850172571 +0200
812674
+++ firefox-115.2.0/gfx/2d/DrawTargetSkia.cpp	2023-09-20 22:16:10.446147737 +0200
812674
@@ -156,8 +156,8 @@ static IntRect CalculateSurfaceBounds(co
5bf1f5
 }
5bf1f5
 
812674
 static const int kARGBAlphaOffset =
5bf1f5
-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
812674
-
812674
+    0;  // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 ==
812674
+        // SurfaceFormat::B8G8R8A8 ? 3 : 0;
5bf1f5
 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
5bf1f5
                              const int32_t aStride, SurfaceFormat aFormat) {
481763
   if (aFormat != SurfaceFormat::B8G8R8X8 || aSize.IsEmpty()) {
812674
diff -up firefox-115.2.0/gfx/2d/Types.h.mozilla-bmo1504834-part1 firefox-115.2.0/gfx/2d/Types.h
812674
--- firefox-115.2.0/gfx/2d/Types.h.mozilla-bmo1504834-part1	2023-08-21 15:43:23.000000000 +0200
812674
+++ firefox-115.2.0/gfx/2d/Types.h	2023-09-20 22:15:11.850172571 +0200
812674
@@ -89,18 +89,11 @@ enum class SurfaceFormat : int8_t {
481763
   // This represents the unknown format.
812674
   UNKNOWN,  // TODO: Replace uses with Maybe<SurfaceFormat>.
481763
 
812674
-// The following values are endian-independent synonyms. The _UINT32 suffix
812674
-// indicates that the name reflects the layout when viewed as a uint32_t
812674
-// value.
e98f2c
-#if MOZ_LITTLE_ENDIAN()
812674
+  // The following values are endian-independent synonyms. The _UINT32 suffix
812674
+  // indicates that the name reflects the layout when viewed as a uint32_t
812674
+  // value.
5bf1f5
   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
e98f2c
   X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
e98f2c
-#elif MOZ_BIG_ENDIAN()
5bf1f5
-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
e98f2c
-  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
5bf1f5
-#else
5bf1f5
-#  error "bad endianness"
5bf1f5
-#endif
5bf1f5
 
e98f2c
   // The following values are OS and endian-independent synonyms.
e98f2c
   //
812674
diff -up firefox-115.2.0/gfx/skia/skia/modules/skcms/skcms.cc.mozilla-bmo1504834-part1 firefox-115.2.0/gfx/skia/skia/modules/skcms/skcms.cc
812674
--- firefox-115.2.0/gfx/skia/skia/modules/skcms/skcms.cc.mozilla-bmo1504834-part1	2023-08-21 15:43:23.000000000 +0200
812674
+++ firefox-115.2.0/gfx/skia/skia/modules/skcms/skcms.cc	2023-09-20 22:15:11.851172570 +0200
812674
@@ -30,6 +30,8 @@
e98f2c
         #include <avx512fintrin.h>
e98f2c
         #include <avx512dqintrin.h>
e98f2c
     #endif
5bf1f5
+#else
5bf1f5
+    #define SKCMS_PORTABLE
5bf1f5
 #endif
5bf1f5
 
812674
 static bool runtime_cpu_detection = true;
812674
@@ -324,20 +326,28 @@ enum {
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)
812674
-    return _byteswap_ushort(be);
5bf1f5
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
5bf1f5
+    return be;
812674
 #else
812674
-    return __builtin_bswap16(be);
5bf1f5
+    #if defined(_MSC_VER)
812674
+     return _byteswap_ushort(be);
5bf1f5
+    #else
812674
+     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)
812674
-    return _byteswap_ulong(be);
5bf1f5
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
5bf1f5
+    return be;
812674
 #else
812674
-    return __builtin_bswap32(be);
5bf1f5
+    #if defined(_MSC_VER)
812674
+     return _byteswap_ulong(be);
5bf1f5
+    #else
812674
+     return __builtin_bswap32(be);
5bf1f5
+    #endif
5bf1f5
 #endif
5bf1f5
 }
5bf1f5