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

Unified Diff: src/core/Sk4pxXfermode.h

Issue 1248893004: 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') | src/opts/Sk4px_NEON.h » ('j') | 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 ad822edb8b609f32d7db0e29e0e7ef796258af1e..fc0b643be1454de4893fc8f9c1caa8311eef4abd 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 fProc4(src4, dst4);
- });
- } else {
- Sk4px::MapDstSrcAlpha(n, dst, src, aa,
- [&](const Sk4px& dst4, const Sk4px& src4, const Sk4px& alpha) {
- return fAAProc4(src4, dst4, alpha);
- });
- }
- }
-
private:
Proc4 fProc4;
AAProc4 fAAProc4;
@@ -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(fProcF(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 fProcF(SkPMFloat(src), SkPMFloat(dst)).round();
- }
-
- inline SkPMColor xfer32(SkPMColor dst, SkPMColor src, SkAlpha aa) const {
- SkPMFloat s(src),
- d(dst),
- b(fProcF(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();
- }
-
ProcF fProcF;
typedef SkProcCoeffXfermode INHERITED;
};
« no previous file with comments | « src/core/Sk4px.h ('k') | src/opts/Sk4px_NEON.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698