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

Unified Diff: src/core/SkBlitter_A8.cpp

Issue 2097883002: revise row blits to keep intermediate precision so that color is preserved when blended against its… (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fix overflow in destination scale calculation Created 4 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
Index: src/core/SkBlitter_A8.cpp
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index 57587c675a7197b1b069f51fd535443bc129abcb..66976143c8f3df7fe9e8fdd5496c9e99ec02c9a5 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -276,7 +276,7 @@ static inline uint8_t aa_blend8(SkPMColor src, U8CPU da, int aa) {
int src_scale = SkAlpha255To256(aa);
int sa = SkGetPackedA32(src);
- int dst_scale = 256 - SkAlphaMul(sa, src_scale);
+ int dst_scale = SkAlphaMulInv256(sa, src_scale);
return SkToU8((sa * src_scale + da * dst_scale) >> 8);
}

Powered by Google App Engine
This is Rietveld 408576698