Bug 1325259 - Fix A8_RowProc_Opaque to not use legacy broken lerp. r=vliu, a=jcristau
authorLee Salzman <lsalzman@mozilla.com>
Wed, 18 Jan 2017 10:15:09 -0500
changeset 353684 313fd5d293cdf66a4dfd6a76a2ac7e77506d8e2a
parent 353683 9bb207f947d83100c0f5bcd2b6baecc6ec24d431
child 353685 84e2bee07c24e8d76b0093df609bc30f67b3d55e
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvliu, jcristau
bugs1325259
milestone52.0a2
Bug 1325259 - Fix A8_RowProc_Opaque to not use legacy broken lerp. r=vliu, a=jcristau 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;
 }