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

Unified Diff: src/core/Sk4pxXfermode.h

Issue 1217013003: Edges matter, part 2. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 6 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 b58718304610d7ff2decfa08de4db2e291660887..e40d2ebb300807ee75094f7cf03b96ae3cb85cdb 100644
--- a/src/core/Sk4pxXfermode.h
+++ b/src/core/Sk4pxXfermode.h
@@ -68,15 +68,15 @@ XFERMODE(HardLight) {
auto sa = s.alphas(),
da = d.alphas();
- auto isDark = s < (sa-s);
+ auto isLite = (sa-s) < s;
auto dark = s*d << 1,
lite = sa*da - ((da-d)*(sa-s) << 1),
both = s*da.inv() + d*sa.inv();
- // TODO: do isDark in 16-bit so we only have to div255() once.
- auto colors = isDark.thenElse((dark + both).div255(),
- (lite + both).div255());
+ // TODO: do isLite in 16-bit so we only have to div255() once.
+ auto colors = isLite.thenElse((lite + both).div255(),
+ (dark + both).div255());
return alphas.zeroColors() + colors.zeroAlphas();
}
XFERMODE(Overlay) { return HardLight::Xfer(d,s); }
@@ -96,7 +96,7 @@ XFERMODE(Lighten) {
auto srcover = s + (d - dsa),
dstover = d + (s - sda);
auto alphas = srcover,
- colors = (sda < dsa).thenElse(dstover, srcover);
+ colors = (dsa < sda).thenElse(srcover, dstover);
return alphas.zeroColors() + colors.zeroAlphas();
}
#undef XFERMODE
« 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