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