Index: src/core/SkXfermode4f.cpp |
diff --git a/src/core/SkXfermode4f.cpp b/src/core/SkXfermode4f.cpp |
index 1bf66a2b6998afed75158e842f3ac6b7445783a3..0ec3ec15f79e2e26e857ff3ce4cd357a66b79927 100644 |
--- a/src/core/SkXfermode4f.cpp |
+++ b/src/core/SkXfermode4f.cpp |
@@ -39,10 +39,6 @@ template <DstType D> uint32_t store_dst(const Sk4f& x4) { |
return (D == kSRGB_Dst) ? Sk4f_toS32(x4) : Sk4f_toL32(x4); |
} |
-static uint32_t linear_unit_to_srgb_32(const Sk4f& l4) { |
- return Sk4f_toL32(l4); |
-} |
- |
static Sk4f linear_unit_to_srgb_255f(const Sk4f& l4) { |
return linear_to_srgb(l4) * Sk4f(255) + Sk4f(0.5f); |
} |
@@ -268,8 +264,8 @@ template <DstType D> void srcover_n(const SkXfermode::PM4fState& state, uint32_t |
static void srcover_linear_dst_1(const SkXfermode::PM4fState& state, uint32_t dst[], |
const SkPM4f& src, int count, const SkAlpha aa[]) { |
- Sk4f s4 = Sk4f::Load(src.fVec); |
- Sk4f dst_scale = Sk4f(1 - get_alpha(s4)); |
+ const Sk4f s4 = Sk4f::Load(src.fVec); |
+ const Sk4f dst_scale = Sk4f(1 - get_alpha(s4)); |
if (aa) { |
for (int i = 0; i < count; ++i) { |
@@ -280,31 +276,31 @@ static void srcover_linear_dst_1(const SkXfermode::PM4fState& state, uint32_t ds |
Sk4f d4 = Sk4f_fromL32(dst[i]); |
Sk4f r4; |
if (a != 0xFF) { |
- s4 = scale_by_coverage(s4, a); |
- r4 = s4 + d4 * Sk4f(1 - get_alpha(s4)); |
+ Sk4f s4_aa = scale_by_coverage(s4, a); |
+ r4 = s4_aa + d4 * Sk4f(1 - get_alpha(s4_aa)); |
} else { |
r4 = s4 + d4 * dst_scale; |
} |
dst[i] = Sk4f_toL32(r4); |
} |
} else { |
- s4 = s4 * Sk4f(255) + Sk4f(0.5f); // +0.5 to pre-bias for rounding |
+ const Sk4f s4_255 = s4 * Sk4f(255) + Sk4f(0.5f); // +0.5 to pre-bias for rounding |
while (count >= 4) { |
Sk4f d0 = to_4f(dst[0]); |
Sk4f d1 = to_4f(dst[1]); |
Sk4f d2 = to_4f(dst[2]); |
Sk4f d3 = to_4f(dst[3]); |
Sk4f_ToBytes((uint8_t*)dst, |
- s4 + d0 * dst_scale, |
- s4 + d1 * dst_scale, |
- s4 + d2 * dst_scale, |
- s4 + d3 * dst_scale); |
+ s4_255 + d0 * dst_scale, |
+ s4_255 + d1 * dst_scale, |
+ s4_255 + d2 * dst_scale, |
+ s4_255 + d3 * dst_scale); |
dst += 4; |
count -= 4; |
} |
for (int i = 0; i < count; ++i) { |
Sk4f d4 = to_4f(dst[i]); |
- dst[i] = to_4b(s4 + d4 * dst_scale); |
+ dst[i] = to_4b(s4_255 + d4 * dst_scale); |
} |
} |
} |
@@ -323,12 +319,12 @@ static void srcover_srgb_dst_1(const SkXfermode::PM4fState& state, uint32_t dst[ |
Sk4f d4 = srgb_4b_to_linear_unit(dst[i]); |
Sk4f r4; |
if (a != 0xFF) { |
- s4 = scale_by_coverage(s4, a); |
- r4 = s4 + d4 * Sk4f(1 - get_alpha(s4)); |
+ const Sk4f s4_aa = scale_by_coverage(s4, a); |
+ r4 = s4_aa + d4 * Sk4f(1 - get_alpha(s4_aa)); |
} else { |
r4 = s4 + d4 * dst_scale; |
} |
- dst[i] = linear_unit_to_srgb_32(r4); |
+ dst[i] = to_4b(linear_unit_to_srgb_255f(r4)); |
} |
} else { |
while (count >= 4) { |