1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/firefox/Skia-rendering.patch
3 # Copyright (C) 2021 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 https://bugzilla.mozilla.org/show_bug.cgi?id=1626236
16 Plus SVG gradient-issues.
18 Fixes by Martin Sirringhaus.
20 --- a/gfx/2d/DrawTargetSkia.cpp
21 +++ b/gfx/2d/DrawTargetSkia.cpp
23 mColors.resize(mCount);
24 mPositions.resize(mCount);
25 if (aStops[0].offset != 0) {
26 +// reddit.com yellow graddient
28 + mColors[0] = mozilla::detail::Swapper<SkColor>::swap(ColorToSkColor(aStops[0].color, 1.0));
30 mColors[0] = ColorToSkColor(aStops[0].color, 1.0);
34 for (uint32_t i = 0; i < aNumStops; i++) {
36 + mColors[i + shift] = mozilla::detail::Swapper<SkColor>::swap(ColorToSkColor(aStops[i].color, 1.0));
38 mColors[i + shift] = ColorToSkColor(aStops[i].color, 1.0);
40 mPositions[i + shift] = SkFloatToScalar(aStops[i].offset);
42 if (aStops[aNumStops - 1].offset != 1) {
44 + mColors[mCount - 1] = mozilla::detail::Swapper<SkColor>::swap(ColorToSkColor(aStops[aNumStops - 1].color, 1.0));
46 mColors[mCount - 1] = ColorToSkColor(aStops[aNumStops - 1].color, 1.0);
48 mPositions[mCount - 1] = SK_Scalar1;
52 for (int row = 0; row < height; ++row) {
53 for (int column = 0; column < width; column += 4) {
54 if (aData[column + kARGBAlphaOffset] != 0xFF) {
55 - gfxCriticalError() << "RGBX pixel at (" << column << "," << row
56 + gfxWarning() << "RGBX pixel at (" << column << "," << row
57 << ") in " << width << "x" << height
58 << " surface is not opaque: " << int(aData[column])
59 << "," << int(aData[column + 1]) << ","
61 if (aData[offset + kARGBAlphaOffset] != 0xFF) {
62 int row = offset / aStride;
63 int column = (offset % aStride) / pixelSize;
64 - gfxCriticalError() << "RGBX corner pixel at (" << column << "," << row
65 + gfxWarning() << "RGBX corner pixel at (" << column << "," << row
66 << ") in " << aSize.width << "x" << aSize.height
67 << " surface, bounded by "
68 << "(" << bounds.X() << "," << bounds.Y() << ","
69 diff -r 49ddb3c45fbc -r 13bdca7081de gfx/2d/FilterProcessing.h
70 --- a/gfx/2d/FilterProcessing.h Wed Jun 17 11:32:00 2020 +0200
71 +++ b/gfx/2d/FilterProcessing.h Fri Jun 19 15:20:16 2020 +0200
76 +#if defined WORDS_BIGENDIAN || defined IS_BIG_ENDIAN || defined __BIG_ENDIAN__
77 +const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_B = 3;
78 +const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_G = 2;
79 +const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_R = 1;
80 +const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_A = 0;
82 const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_B = 0;
83 const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_G = 1;
84 const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_R = 2;
85 const ptrdiff_t B8G8R8A8_COMPONENT_BYTEOFFSET_A = 3;
88 class FilterProcessing {
90 diff -r 49ddb3c45fbc -r 13bdca7081de gfx/skia/skia/src/shaders/gradients/Sk4fLinearGradient.cpp
91 --- a/gfx/skia/skia/src/shaders/gradients/Sk4fLinearGradient.cpp Wed Jun 17 11:32:00 2020 +0200
92 +++ b/gfx/skia/skia/src/shaders/gradients/Sk4fLinearGradient.cpp Fri Jun 19 15:20:16 2020 +0200
95 #include "include/core/SkPaint.h"
96 #include "src/shaders/gradients/Sk4fLinearGradient.h"
98 +#include "src/core/SkEndian.h"
105 DstTraits<premul>::store4x(c0, c1, c2, c3, dst, bias0, bias1);
106 +#ifdef SK_CPU_BENDIAN
107 + SkEndianSwap32s(dst, 4);
116 - DstTraits<premul>::store(c0, dst++, bias0);
117 - DstTraits<premul>::store(c1, dst++, bias1);
118 + DstTraits<premul>::store(c0, dst, bias0);
119 +#ifdef SK_CPU_BENDIAN
120 + *dst = SkEndianSwap32(*dst);
123 + DstTraits<premul>::store(c1, dst, bias1);
124 +#ifdef SK_CPU_BENDIAN
125 + *dst = SkEndianSwap32(*dst);
131 DstTraits<premul>::store(c0, dst, bias0);
132 +#ifdef SK_CPU_BENDIAN
133 + *dst = SkEndianSwap32(*dst);
138 diff -r 49ddb3c45fbc -r 13bdca7081de image/decoders/nsJPEGDecoder.cpp
139 --- a/image/decoders/nsJPEGDecoder.cpp Wed Jun 17 11:32:00 2020 +0200
140 +++ b/image/decoders/nsJPEGDecoder.cpp Fri Jun 19 15:20:16 2020 +0200
143 // By default, we will output directly to BGRA. If we need to apply
144 // special color transforms, this may change.
145 +#if MOZ_BIG_ENDIAN()
146 + mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
148 switch (SurfaceFormat::OS_RGBX) {
149 case SurfaceFormat::B8G8R8X8:
150 mInfo.out_color_space = JCS_EXT_BGRX;
153 return Transition::TerminateFailure();
159 diff -r 49ddb3c45fbc -r 13bdca7081de image/decoders/nsWebPDecoder.cpp
160 --- a/image/decoders/nsWebPDecoder.cpp Wed Jun 17 11:32:00 2020 +0200
161 +++ b/image/decoders/nsWebPDecoder.cpp Fri Jun 19 15:20:16 2020 +0200
163 // WebP doesn't guarantee that the alpha generated matches the hint in the
164 // header, so we always need to claim the input is BGRA. If the output is
165 // BGRX, swizzling will mask off the alpha channel.
166 +#if MOZ_BIG_ENDIAN()
167 + mBuffer.colorspace = MODE_ARGB;
168 + SurfaceFormat inFormat = mFormat;
170 SurfaceFormat inFormat = SurfaceFormat::OS_RGBA;
173 SurfacePipeFlags pipeFlags = SurfacePipeFlags();
174 if (mFormat == SurfaceFormat::OS_RGBA &&