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