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

Unified Diff: src/core/Sk4pxXfermode.h

Issue 1150693003: Simpler version of Plus w/ AA. ~25% faster too. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 7 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 | « no previous file | 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 ff26436134f539972115032f3da4620596f9aaf4..e8610edaba55ed1da08daac55c34add64a613cd5 100644
--- a/src/core/Sk4pxXfermode.h
+++ b/src/core/Sk4pxXfermode.h
@@ -89,10 +89,8 @@ static Sk4px xfer_aa(const Sk4px& s, const Sk4px& d, const Sk16b& aa) {
template <> Sk4px xfer_aa<Name>(const Sk4px& s, const Sk4px& d, const Sk16b& aa)
// Plus' clamp needs to happen after AA. skia:3852
- XFERMODE_AA(Plus) { // [ clamp(D + AA*S) ]
- // We implement this as D + Min(S*AA, (1-D)) to fit the arguments to Min in 16 bits.
- return d +
- Sk4px::Wide(Sk16h::Min(s.mulWiden(aa), d.inv().mul255Widen())).div255RoundNarrow();
+ XFERMODE_AA(Plus) { // [ clamp( (1-AA)D + (AA)(S+D) ) == clamp(D + AA*S) ]
+ return d.saturatedAdd(s.fastMulDiv255Round(aa));
}
#undef XFERMODE_AA
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698