Index: src/core/SkXfermode4f.cpp |
diff --git a/src/core/SkXfermode4f.cpp b/src/core/SkXfermode4f.cpp |
index 267985d8a277d747cb1d7077bcbb521417076fc3..4d224ac0ad788d59af06b219f716555eae01b0dd 100644 |
--- a/src/core/SkXfermode4f.cpp |
+++ b/src/core/SkXfermode4f.cpp |
@@ -213,33 +213,25 @@ template <DstType D> void src_1(const SkXfermode*, uint32_t dst[], |
count -= 4; |
} |
} else { // kSRGB |
- while (count >= 4) { |
- Sk4f aa4 = SkNx_cast<float>(Sk4b::Load(aa)) * Sk4f(1/255.0f); |
- |
- /* If we ever natively support convert 255_linear -> 255_srgb, then perhaps |
- * it would be faster (and possibly allow more code sharing with kLinear) to |
- * stay in that space. |
- */ |
- Sk4f r0 = lerp(s4, load_dst<D>(dst[0]), Sk4f(aa4[0])); |
- Sk4f r1 = lerp(s4, load_dst<D>(dst[1]), Sk4f(aa4[1])); |
- Sk4f r2 = lerp(s4, load_dst<D>(dst[2]), Sk4f(aa4[2])); |
- Sk4f r3 = lerp(s4, load_dst<D>(dst[3]), Sk4f(aa4[3])); |
- Sk4f_ToBytes((uint8_t*)dst, |
- linear_unit_to_srgb_255f(r0), |
- linear_unit_to_srgb_255f(r1), |
- linear_unit_to_srgb_255f(r2), |
- linear_unit_to_srgb_255f(r3)); |
- |
- dst += 4; |
- aa += 4; |
- count -= 4; |
+ SkPMColor srcColor = store_dst<D>(s4); |
+ while (count-- > 0) { |
+ SkAlpha cover = *aa++; |
+ switch (cover) { |
+ case 0xFF: { |
+ *dst++ = srcColor; |
+ break; |
+ } |
+ case 0x00: { |
+ dst++; |
+ break; |
+ } |
+ default: { |
+ Sk4f d4 = load_dst<D>(*dst); |
+ *dst++ = store_dst<D>(lerp(s4, d4, cover)); |
mtklein
2016/05/27 15:58:49
lerp() takes 3 Sk4f arguments in range [0,1]. I t
mtklein_C
2016/05/27 16:57:59
Nevermind, it's the other lerp!
herb_g
2016/05/27 16:59:18
There are two lerp calls:
static Sk4f lerp(const S
|
+ } |
+ } |
} |
- } |
- for (int i = 0; i < count; ++i) { |
- unsigned a = aa[i]; |
- Sk4f d4 = load_dst<D>(dst[i]); |
- dst[i] = store_dst<D>(lerp(s4, d4, a)); |
- } |
+ } // kSRGB |
} else { |
sk_memset32(dst, store_dst<D>(s4), count); |
} |