Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: src/core/Sk4pxXfermode.h

Issue 1242973004: Revert of 565 support for SIMD xfermodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/Sk4px.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/core/Sk4px.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698