Bug 1325259 - fix A8_RowProc_Opaque to not use legacy broken lerp. r=vliu
authorLee Salzman <lsalzman@mozilla.com>
Wed, 18 Jan 2017 10:15:09 -0500
changeset 377238 34ffa05e2af018ce65d69c49f9018cf2aa99438b
parent 377237 20d71b8cba1558f8b55a3c07e8b4d5ea91b9288b
child 377239 02057c9d45e530d17acd76769bdf53558747936b
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvliu
bugs1325259
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1325259 - fix A8_RowProc_Opaque to not use legacy broken lerp. r=vliu MozReview-Commit-ID: FU7WxzQ3n7T
gfx/skia/skia/src/core/SkBlitMask_D32.cpp
--- a/gfx/skia/skia/src/core/SkBlitMask_D32.cpp
+++ b/gfx/skia/skia/src/core/SkBlitMask_D32.cpp
@@ -139,46 +139,24 @@ static void A8_RowProc_Blend(
     const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
     for (int i = 0; i < count; ++i) {
         if (mask[i]) {
             dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]);
         }
     }
 }
 
-// expand the steps that SkAlphaMulQ performs, but this way we can
-//  exand.. add.. combine
-// instead of
-// expand..combine add expand..combine
-//
-#define EXPAND0(v, m, s)    ((v) & (m)) * (s)
-#define EXPAND1(v, m, s)    (((v) >> 8) & (m)) * (s)
-#define COMBINE(e0, e1, m)  ((((e0) >> 8) & (m)) | ((e1) & ~(m)))
-
 static void A8_RowProc_Opaque(
         SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
     const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
     for (int i = 0; i < count; ++i) {
         int m = mask[i];
         if (m) {
             m += (m >> 7);
-#if 1
-            // this is slightly slower than the expand/combine version, but it
-            // is much closer to the old results, so we use it for now to reduce
-            // rebaselining.
-            dst[i] = SkAlphaMulQ(src[i], m) + SkAlphaMulQ(dst[i], 256 - m);
-#else
-            uint32_t v = src[i];
-            uint32_t s0 = EXPAND0(v, rbmask, m);
-            uint32_t s1 = EXPAND1(v, rbmask, m);
-            v = dst[i];
-            uint32_t d0 = EXPAND0(v, rbmask, m);
-            uint32_t d1 = EXPAND1(v, rbmask, m);
-            dst[i] = COMBINE(s0 + d0, s1 + d1, rbmask);
-#endif
+            dst[i] = SkPMLerp(src[i], dst[i], m);
         }
     }
 }
 
 static int upscale31To255(int value) {
     value = (value << 3) | (value >> 2);
     return value;
 }