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