|
|
12e947 |
# HG changeset patch
|
|
|
12e947 |
# Parent b5471d23321d16a0bacc25b7afd27d2e16adba1a
|
|
|
12e947 |
Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1504834
|
|
|
12e947 |
|
|
|
12e947 |
diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp
|
|
|
12e947 |
--- a/gfx/2d/DrawTargetSkia.cpp
|
|
|
12e947 |
+++ b/gfx/2d/DrawTargetSkia.cpp
|
|
|
12e947 |
@@ -130,18 +130,17 @@ static IntRect CalculateSurfaceBounds(co
|
|
|
12e947 |
Rect sampledBounds = inverse.TransformBounds(*aBounds);
|
|
|
12e947 |
if (!sampledBounds.ToIntRect(&bounds)) {
|
|
|
12e947 |
return surfaceBounds;
|
|
|
12e947 |
}
|
|
|
12e947 |
|
|
|
9eec91 |
return surfaceBounds.Intersect(bounds);
|
|
|
9eec91 |
}
|
|
|
9eec91 |
|
|
|
9eec91 |
-static const int kARGBAlphaOffset =
|
|
|
9eec91 |
- SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
|
|
|
9eec91 |
+static const int kARGBAlphaOffset = 0; // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
|
|
|
9eec91 |
|
|
|
9eec91 |
static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
|
|
|
9eec91 |
const int32_t aStride, SurfaceFormat aFormat) {
|
|
|
12e947 |
if (aFormat != SurfaceFormat::B8G8R8X8 || aSize.IsEmpty()) {
|
|
|
12e947 |
return true;
|
|
|
12e947 |
}
|
|
|
12e947 |
// We should've initialized the data to be opaque already
|
|
|
12e947 |
// On debug builds, verify that this is actually true.
|
|
|
12e947 |
diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h
|
|
|
12e947 |
--- a/gfx/2d/Types.h
|
|
|
12e947 |
+++ b/gfx/2d/Types.h
|
|
|
12e947 |
@@ -84,25 +84,18 @@ enum class SurfaceFormat : int8_t {
|
|
|
12e947 |
Depth,
|
|
|
12e947 |
|
|
|
12e947 |
// This represents the unknown format.
|
|
|
12e947 |
UNKNOWN,
|
|
|
12e947 |
|
|
|
9eec91 |
// The following values are endian-independent synonyms. The _UINT32 suffix
|
|
|
9eec91 |
// indicates that the name reflects the layout when viewed as a uint32_t
|
|
|
9eec91 |
// value.
|
|
|
9eec91 |
-#if MOZ_LITTLE_ENDIAN()
|
|
|
9eec91 |
A8R8G8B8_UINT32 = B8G8R8A8, // 0xAARRGGBB
|
|
|
9eec91 |
X8R8G8B8_UINT32 = B8G8R8X8, // 0x00RRGGBB
|
|
|
9eec91 |
-#elif MOZ_BIG_ENDIAN()
|
|
|
9eec91 |
- A8R8G8B8_UINT32 = A8R8G8B8, // 0xAARRGGBB
|
|
|
9eec91 |
- X8R8G8B8_UINT32 = X8R8G8B8, // 0x00RRGGBB
|
|
|
9eec91 |
-#else
|
|
|
9eec91 |
-# error "bad endianness"
|
|
|
9eec91 |
-#endif
|
|
|
9eec91 |
|
|
|
9eec91 |
// The following values are OS and endian-independent synonyms.
|
|
|
9eec91 |
//
|
|
|
12e947 |
// TODO(aosmond): When everything blocking bug 1581828 has been resolved, we
|
|
|
12e947 |
// can make this use R8B8G8A8 and R8B8G8X8 for non-Windows platforms.
|
|
|
12e947 |
OS_RGBA = A8R8G8B8_UINT32,
|
|
|
12e947 |
OS_RGBX = X8R8G8B8_UINT32
|
|
|
12e947 |
};
|
|
|
12e947 |
diff --git a/gfx/skia/skia/third_party/skcms/skcms.cc b/gfx/skia/skia/third_party/skcms/skcms.cc
|
|
|
12e947 |
--- a/gfx/skia/skia/third_party/skcms/skcms.cc
|
|
|
12e947 |
+++ b/gfx/skia/skia/third_party/skcms/skcms.cc
|
|
|
12e947 |
@@ -25,16 +25,18 @@
|
|
|
12e947 |
// it'd be a lot slower. But we want all those headers included so we
|
|
|
12e947 |
// can use their features after runtime checks later.
|
|
|
12e947 |
#include <smmintrin.h>
|
|
|
12e947 |
#include <avxintrin.h>
|
|
|
12e947 |
#include <avx2intrin.h>
|
|
|
9eec91 |
#include <avx512fintrin.h>
|
|
|
9eec91 |
#include <avx512dqintrin.h>
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
+#else
|
|
|
9eec91 |
+ #define SKCMS_PORTABLE
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
|
|
|
9eec91 |
// sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
|
|
|
12e947 |
// We have better testing on 64-bit machines, so force 32-bit machines to behave like 64-bit.
|
|
|
12e947 |
//
|
|
|
12e947 |
// Please do not use sizeof() directly, and size_t only when required.
|
|
|
12e947 |
// (We have no way of enforcing these requests...)
|
|
|
12e947 |
#define SAFE_SIZEOF(x) ((uint64_t)sizeof(x))
|
|
|
12e947 |
@@ -275,30 +277,38 @@ enum {
|
|
|
12e947 |
skcms_Signature_sf32 = 0x73663332,
|
|
|
12e947 |
// XYZ is also a PCS signature, so it's defined in skcms.h
|
|
|
12e947 |
// skcms_Signature_XYZ = 0x58595A20,
|
|
|
12e947 |
};
|
|
|
12e947 |
|
|
|
9eec91 |
static uint16_t read_big_u16(const uint8_t* ptr) {
|
|
|
9eec91 |
uint16_t be;
|
|
|
9eec91 |
memcpy(&be, ptr, sizeof(be));
|
|
|
9eec91 |
-#if defined(_MSC_VER)
|
|
|
9eec91 |
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
|
9eec91 |
+ return be;
|
|
|
12e947 |
+#else
|
|
|
9eec91 |
+ #if defined(_MSC_VER)
|
|
|
12e947 |
return _byteswap_ushort(be);
|
|
|
12e947 |
-#else
|
|
|
9eec91 |
+ #else
|
|
|
9eec91 |
return __builtin_bswap16(be);
|
|
|
9eec91 |
+ #endif
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
}
|
|
|
9eec91 |
|
|
|
9eec91 |
static uint32_t read_big_u32(const uint8_t* ptr) {
|
|
|
9eec91 |
uint32_t be;
|
|
|
9eec91 |
memcpy(&be, ptr, sizeof(be));
|
|
|
9eec91 |
-#if defined(_MSC_VER)
|
|
|
9eec91 |
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
|
|
|
9eec91 |
+ return be;
|
|
|
12e947 |
+#else
|
|
|
9eec91 |
+ #if defined(_MSC_VER)
|
|
|
12e947 |
return _byteswap_ulong(be);
|
|
|
12e947 |
-#else
|
|
|
9eec91 |
+ #else
|
|
|
9eec91 |
return __builtin_bswap32(be);
|
|
|
9eec91 |
+ #endif
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
}
|
|
|
9eec91 |
|
|
|
12e947 |
static int32_t read_big_i32(const uint8_t* ptr) {
|
|
|
12e947 |
return (int32_t)read_big_u32(ptr);
|
|
|
12e947 |
}
|
|
|
12e947 |
|
|
|
12e947 |
static float read_big_fixed(const uint8_t* ptr) {
|