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