Remove SK_SUPPORT_LEGACY_BROKEN_LERP support

Chromium change landed.

BUG=chromium:696216

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD

Change-Id: I3e67392b0fdad8c5a3ad256e4f190123dff6c846
Reviewed-on: https://skia-review.googlesource.com/9551
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index 694d324..12c2277 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -204,12 +204,8 @@
  *  for [0,255] value and [0,256] alpha256.
  */
 static inline U16CPU SkAlphaMulInv256(U16CPU value, U16CPU alpha256) {
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-    return SkAlpha255To256(255 - SkAlphaMul(value, alpha256));
-#else
     unsigned prod = 0xFFFF - value * alpha256;
     return (prod + (prod >> 8)) >> 8;
-#endif
 }
 
 //  The caller may want negative values, so keep all params signed (int)
@@ -584,22 +580,13 @@
  * Interpolates between colors src and dst using [0,256] scale.
  */
 static inline SkPMColor SkPMLerp(SkPMColor src, SkPMColor dst, unsigned scale) {
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-    return SkAlphaMulQ(src, scale) + SkAlphaMulQ(dst, 256 - scale);
-#else
     return SkFastFourByteInterp256(src, dst, scale);
-#endif
 }
 
 static inline SkPMColor SkBlendARGB32(SkPMColor src, SkPMColor dst, U8CPU aa) {
     SkASSERT((unsigned)aa <= 255);
 
     unsigned src_scale = SkAlpha255To256(aa);
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-    unsigned dst_scale = SkAlpha255To256(255 - SkAlphaMul(SkGetPackedA32(src), src_scale));
-
-    return SkAlphaMulQ(src, src_scale) + SkAlphaMulQ(dst, dst_scale);
-#else
     unsigned dst_scale = SkAlphaMulInv256(SkGetPackedA32(src), src_scale);
 
     const uint32_t mask = 0xFF00FF;
@@ -611,7 +598,6 @@
     uint32_t dst_ag = ((dst >> 8) & mask) * dst_scale;
 
     return (((src_rb + dst_rb) >> 8) & mask) | ((src_ag + dst_ag) & ~mask);
-#endif
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index 958ad27..4478b2b 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -237,11 +237,7 @@
         color = SkAlphaMulQ(color, SkAlpha255To256(alpha));
     }
 
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-    unsigned dst_scale = 255 - SkGetPackedA32(color);
-#else
     unsigned dst_scale = SkAlpha255To256(255 - SkGetPackedA32(color));
-#endif
     size_t rowBytes = fDevice.rowBytes();
     while (--height >= 0) {
         device[0] = color + SkAlphaMulQ(device[0], dst_scale);
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 6d9375d..c616e22 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -31,11 +31,7 @@
         dg = SkAlphaBlend(SkPacked32ToG16(sc), SkGetPackedG16(dc), src_scale);
         db = SkAlphaBlend(SkPacked32ToB16(sc), SkGetPackedB16(dc), src_scale);
     } else {
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-        unsigned dst_scale = 255 - SkAlphaMul(sa, src_scale);
-#else
         unsigned dst_scale = SkAlphaMulInv256(sa, src_scale);
-#endif
         dr = (SkPacked32ToR16(sc) * src_scale + SkGetPackedR16(dc) * dst_scale) >> 8;
         dg = (SkPacked32ToG16(sc) * src_scale + SkGetPackedG16(dc) * dst_scale) >> 8;
         db = (SkPacked32ToB16(sc) * src_scale + SkGetPackedB16(dc) * dst_scale) >> 8;
diff --git a/src/opts/SkBlitRow_opts_arm_neon.cpp b/src/opts/SkBlitRow_opts_arm_neon.cpp
index 7998a89..623d08b 100644
--- a/src/opts/SkBlitRow_opts_arm_neon.cpp
+++ b/src/opts/SkBlitRow_opts_arm_neon.cpp
@@ -909,12 +909,8 @@
         vdst_wide = vmull_u8(vdst, vdup_n_u8(dst_scale));
 
         // Combine
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-        vres = vshrn_n_u16(vdst_wide, 8) + vshrn_n_u16(vsrc_wide, 8);
-#else
         vdst_wide += vsrc_wide;
         vres = vshrn_n_u16(vdst_wide, 8);
-#endif
 
         // Store
         vst1_u32(dst, vreinterpret_u32_u8(vres));
@@ -936,12 +932,8 @@
         vsrc_wide = vmovl_u8(vsrc);
         vsrc_wide = vmulq_u16(vsrc_wide, vdupq_n_u16(src_scale));
         vdst_wide = vmull_u8(vdst, vdup_n_u8(dst_scale));
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-        vres = vshrn_n_u16(vdst_wide, 8) + vshrn_n_u16(vsrc_wide, 8);
-#else
         vdst_wide += vsrc_wide;
         vres = vshrn_n_u16(vdst_wide, 8);
-#endif
 
         // Store
         vst1_lane_u32(dst, vreinterpret_u32_u8(vres), 0);
@@ -984,12 +976,8 @@
         vdst_wide = vmulq_n_u16(vdst_wide, dst_scale);
 
         // Combine
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-        vres = vshrn_n_u16(vdst_wide, 8) + vshrn_n_u16(vsrc_wide, 8);
-#else
         vdst_wide += vsrc_wide;
         vres = vshrn_n_u16(vdst_wide, 8);
-#endif
 
         vst1_lane_u32(dst, vreinterpret_u32_u8(vres), 0);
         dst++;
@@ -1020,11 +1008,6 @@
             // Calc dst_scale
             vsrc_alphas = vtbl1_u8(vsrc, alpha_mask);
             vdst_scale = vmovl_u8(vsrc_alphas);
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-            vdst_scale *= vsrc_scale;
-            vdst_scale = vshrq_n_u16(vdst_scale, 8);
-            vdst_scale = vsubq_u16(vdupq_n_u16(256), vdst_scale);
-#else
             // Calculate SkAlphaMulInv256(vdst_scale, vsrc_scale).
             // A 16-bit lane would overflow if we used 0xFFFF here,
             // so use an approximation with 0xFF00 that is off by 1,
@@ -1033,7 +1016,6 @@
             vdst_scale = vmlsq_u16(vdupq_n_u16(0xFF00), vdst_scale, vsrc_scale);
             vdst_scale = vsraq_n_u16(vdst_scale, vdst_scale, 8);
             vdst_scale = vsraq_n_u16(vdupq_n_u16(1), vdst_scale, 8);
-#endif
 
             // Process src
             vsrc_wide = vmovl_u8(vsrc);
@@ -1044,12 +1026,8 @@
             vdst_wide *= vdst_scale;
 
             // Combine
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-            vres = vshrn_n_u16(vdst_wide, 8) + vshrn_n_u16(vsrc_wide, 8);
-#else
             vdst_wide += vsrc_wide;
             vres = vshrn_n_u16(vdst_wide, 8);
-#endif
 
             vst1_u32(dst, vreinterpret_u32_u8(vres));
 
diff --git a/src/opts/SkColor_opts_SSE2.h b/src/opts/SkColor_opts_SSE2.h
index a3db880..5453f20 100644
--- a/src/opts/SkColor_opts_SSE2.h
+++ b/src/opts/SkColor_opts_SSE2.h
@@ -109,11 +109,7 @@
 
 // Portable version SkPMLerp is in SkColorPriv.h
 static inline __m128i SkPMLerp_SSE2(const __m128i& src, const __m128i& dst, const unsigned scale) {
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-    return _mm_add_epi8(SkAlphaMulQ_SSE2(src, scale), SkAlphaMulQ_SSE2(dst, 256 - scale));
-#else
     return SkFastFourByteInterp256_SSE2(src, dst, scale);
-#endif
 }
 
 static inline __m128i SkGetPackedA32_SSE2(const __m128i& src) {
@@ -253,17 +249,6 @@
 static inline __m128i SkBlendARGB32_SSE2(const __m128i& src, const __m128i& dst,
                                          const unsigned aa) {
     unsigned alpha = SkAlpha255To256(aa);
-#ifdef SK_SUPPORT_LEGACY_BROKEN_LERP
-     __m128i src_scale = _mm_set1_epi32(alpha);
-     // SkAlpha255To256(255 - SkAlphaMul(SkGetPackedA32(src), src_scale))
-     __m128i dst_scale = SkGetPackedA32_SSE2(src);
-     dst_scale = _mm_mullo_epi16(dst_scale, src_scale);
-     dst_scale = _mm_srli_epi16(dst_scale, 8);
-     dst_scale = _mm_sub_epi32(_mm_set1_epi32(256), dst_scale);
-
-     __m128i result = SkAlphaMulQ_SSE2(src, alpha);
-     return _mm_add_epi8(result, SkAlphaMulQ_SSE2(dst, dst_scale));
-#else
     __m128i src_scale = _mm_set1_epi16(alpha);
     // SkAlphaMulInv256(SkGetPackedA32(src), src_scale)
     __m128i dst_scale = SkGetPackedA32_SSE2(src);
@@ -298,7 +283,6 @@
     dst_rb = _mm_srli_epi16(dst_rb, 8);
     dst_ag = _mm_andnot_si128(mask, dst_ag);
     return _mm_or_si128(dst_rb, dst_ag);
-#endif
 }
 
 #undef ASSERT_EQ