f1b26c
# HG changeset patch
517bf9
# Parent  d1d66f7e4d0e7fd45e91e4fcee07555e72046d48
f1b26c
For FF68, AntiAliasing of XULTexts seem to be broken on big endian (s390x). Text and icons of the sandwich-menu to the
f1b26c
right of the address bar, as well as plugin-windows appears transparant, which usually means unreadable (white on white).
f1b26c
517bf9
diff --git a/gfx/skia/skia/include/private/SkNx.h b/gfx/skia/skia/include/private/SkNx.h
517bf9
--- a/gfx/skia/skia/include/private/SkNx.h
517bf9
+++ b/gfx/skia/skia/include/private/SkNx.h
517bf9
@@ -233,17 +233,28 @@ struct SkNx<1,T> {
517bf9
     AI SkNx operator<<(int bits) const { return fVal << bits; }
517bf9
     AI SkNx operator>>(int bits) const { return fVal >> bits; }
517bf9
 
517bf9
     AI SkNx operator+(const SkNx& y) const { return fVal + y.fVal; }
517bf9
     AI SkNx operator-(const SkNx& y) const { return fVal - y.fVal; }
f1b26c
     AI SkNx operator*(const SkNx& y) const { return fVal * y.fVal; }
f1b26c
     AI SkNx operator/(const SkNx& y) const { return fVal / y.fVal; }
f1b26c
 
f1b26c
+    // On Big endian the commented out variant doesn't work,
f1b26c
+    // and honestly, I have no idea why it exists in the first place.
f1b26c
+    // The reason its broken is, I think, that it defaults to the double-variant of ToBits()
f1b26c
+    // which gets a 64-bit integer, and FromBits returns 32-bit,
f1b26c
+    // cutting off the wrong half again.
f1b26c
+    // Overall, I see no reason to have ToBits and FromBits at all (even for floats/doubles).
f1b26c
+    // Still we are only "fixing" this for big endian and leave little endian alone (never touch a running system)
f1b26c
+#ifdef SK_CPU_BENDIAN
f1b26c
+    AI SkNx operator&(const SkNx& y) const { return fVal & y.fVal; }
f1b26c
+#else
f1b26c
     AI SkNx operator&(const SkNx& y) const { return FromBits(ToBits(fVal) & ToBits(y.fVal)); }
f1b26c
+#endif
f1b26c
     AI SkNx operator|(const SkNx& y) const { return FromBits(ToBits(fVal) | ToBits(y.fVal)); }
f1b26c
     AI SkNx operator^(const SkNx& y) const { return FromBits(ToBits(fVal) ^ ToBits(y.fVal)); }
f1b26c
 
517bf9
     AI SkNx operator==(const SkNx& y) const { return FromBits(fVal == y.fVal ? ~0 : 0); }
517bf9
     AI SkNx operator!=(const SkNx& y) const { return FromBits(fVal != y.fVal ? ~0 : 0); }
517bf9
     AI SkNx operator<=(const SkNx& y) const { return FromBits(fVal <= y.fVal ? ~0 : 0); }
517bf9
     AI SkNx operator>=(const SkNx& y) const { return FromBits(fVal >= y.fVal ? ~0 : 0); }
517bf9
     AI SkNx operator< (const SkNx& y) const { return FromBits(fVal <  y.fVal ? ~0 : 0); }
517bf9
diff --git a/gfx/skia/skia/src/opts/SkBlitMask_opts.h b/gfx/skia/skia/src/opts/SkBlitMask_opts.h
517bf9
--- a/gfx/skia/skia/src/opts/SkBlitMask_opts.h
517bf9
+++ b/gfx/skia/skia/src/opts/SkBlitMask_opts.h
517bf9
@@ -198,17 +198,23 @@ namespace SK_OPTS_NS {
517bf9
                                        const SkAlpha* mask, size_t maskRB,
517bf9
                                        int w, int h) {
517bf9
         auto fn = [](const Sk4px& d, const Sk4px& aa) {
517bf9
             //   = (s + d(1-sa))aa + d(1-aa)
517bf9
             //   = s*aa + d(1-sa*aa)
f1b26c
             //   ~~~>
f1b26c
             // a = 1*aa + d(1-1*aa) = aa + d(1-aa)
f1b26c
             // c = 0*aa + d(1-1*aa) =      d(1-aa)
f1b26c
+
f1b26c
+            // For big endian we have to swap the alpha-mask from 0,0,0,255 to 255,0,0,0
f1b26c
+#ifdef SK_CPU_BENDIAN
f1b26c
+            return Sk4px(Sk16b(aa) & Sk16b(255,0,0,0, 255,0,0,0, 255,0,0,0, 255,0,0,0))
f1b26c
+#else
f1b26c
             return Sk4px(Sk16b(aa) & Sk16b(0,0,0,255, 0,0,0,255, 0,0,0,255, 0,0,0,255))
f1b26c
+#endif
f1b26c
                  + d.approxMulDiv255(aa.inv());
f1b26c
         };
f1b26c
         while (h --> 0) {
517bf9
             Sk4px::MapDstAlpha(w, dst, mask, fn);
517bf9
             dst  +=  dstRB / sizeof(*dst);
517bf9
             mask += maskRB / sizeof(*mask);
517bf9
         }
517bf9
     }