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: include/core/SkColorPriv.h

Issue 1273203002: The compiler can generate smulbb perfectly well nowadays. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: parens Created 5 years, 4 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 | include/core/SkMath.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkColorPriv.h
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index f9c5d928a0b06b842741ca112fe395f269a6ca40..3dec49b73e06846f21d13e43cb2082af9e345244 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -193,7 +193,7 @@ static inline unsigned Sk255To256(U8CPU value) {
/** Multiplify value by 0..256, and shift the result down 8
(i.e. return (value * alpha256) >> 8)
*/
-#define SkAlphaMul(value, alpha256) (SkMulS16(value, alpha256) >> 8)
+#define SkAlphaMul(value, alpha256) (((value) * (alpha256)) >> 8)
// The caller may want negative values, so keep all params signed (int)
// so we don't accidentally slip into unsigned math and lose the sign
@@ -213,7 +213,7 @@ static inline int SkAlphaBlend255(S16CPU src, S16CPU dst, U8CPU alpha) {
SkASSERT((int16_t)dst == dst);
SkASSERT((uint8_t)alpha == alpha);
- int prod = SkMulS16(src - dst, alpha) + 128;
+ int prod = (src - dst) * alpha + 128;
prod = (prod + (prod >> 8)) >> 8;
return dst + prod;
}
« no previous file with comments | « no previous file | include/core/SkMath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698