Index: src/core/Sk4pxXfermode.h |
diff --git a/src/core/Sk4pxXfermode.h b/src/core/Sk4pxXfermode.h |
index e912d1ecb8a962cdc0e62ee5dd26bfc40d469282..0c8dcb530266dab144dabb50563684bfcc7fc597 100644 |
--- a/src/core/Sk4pxXfermode.h |
+++ b/src/core/Sk4pxXfermode.h |
@@ -222,19 +222,6 @@ |
} |
} |
- void xfer16(uint16_t dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override { |
- if (NULL == aa) { |
- Sk4px::MapDstSrc(n, dst, src, [&](const Sk4px& dst4, const Sk4px& src4) { |
- return ProcType::Xfer(src4, dst4); |
- }); |
- } else { |
- Sk4px::MapDstSrcAlpha(n, dst, src, aa, |
- [&](const Sk4px& dst4, const Sk4px& src4, const Sk4px& alpha) { |
- return xfer_aa<ProcType>(src4, dst4, alpha); |
- }); |
- } |
- } |
- |
private: |
SkT4pxXfermode(const ProcCoeff& rec) : INHERITED(rec, ProcType::kMode) {} |
@@ -250,35 +237,19 @@ |
void xfer32(SkPMColor dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override { |
for (int i = 0; i < n; i++) { |
- dst[i] = aa ? this->xfer32(dst[i], src[i], aa[i]) |
- : this->xfer32(dst[i], src[i]); |
+ SkPMFloat s(src[i]), |
+ d(dst[i]), |
+ b(ProcType::Xfer(s,d)); |
+ if (aa) { |
+ // We do aa in full float precision before going back down to bytes, because we can! |
+ SkPMFloat a = Sk4f(aa[i]) * Sk4f(1.0f/255); |
+ b = b*a + d*(Sk4f(1)-a); |
+ } |
+ dst[i] = b.round(); |
} |
} |
- void xfer16(uint16_t dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override { |
- for (int i = 0; i < n; i++) { |
- SkPMColor dst32 = SkPixel16ToPixel32(dst[i]); |
- dst32 = aa ? this->xfer32(dst32, src[i], aa[i]) |
- : this->xfer32(dst32, src[i]); |
- dst[i] = SkPixel32ToPixel16(dst32); |
- } |
- } |
- |
private: |
- inline SkPMColor xfer32(SkPMColor dst, SkPMColor src) const { |
- return ProcType::Xfer(SkPMFloat(src), SkPMFloat(dst)).round(); |
- } |
- |
- inline SkPMColor xfer32(SkPMColor dst, SkPMColor src, SkAlpha aa) const { |
- SkPMFloat s(src), |
- d(dst), |
- b(ProcType::Xfer(s,d)); |
- // We do aa in full float precision before going back down to bytes, because we can! |
- SkPMFloat a = Sk4f(aa) * Sk4f(1.0f/255); |
- b = b*a + d*(Sk4f(1)-a); |
- return b.round(); |
- } |
- |
SkTPMFloatXfermode(const ProcCoeff& rec) : INHERITED(rec, ProcType::kMode) {} |
typedef SkProcCoeffXfermode INHERITED; |