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