Index: tests/SkBlend_optsTest.cpp |
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp |
index 7665a2d5dedd6811ed2baa5ea67921b9ef083c95..1b29e4228d46aacb26a6d6604a70a96cd5113927 100644 |
--- a/tests/SkBlend_optsTest.cpp |
+++ b/tests/SkBlend_optsTest.cpp |
@@ -19,13 +19,25 @@ |
typedef void (*Blender)(uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); |
+static inline void srcover_srgb_srgb_1(uint32_t* dst, uint32_t src) { |
+ // TODO: switch back to pure brute force if we can get Sk4f_toS32(Sk4f_fromS32(...)) to |
+ // roundtrip perfectly. |
+ if (src >= 0xFF000000) { |
+ *dst = src; |
+ return; |
+ } |
+ auto d = Sk4f_fromS32(*dst), |
+ s = Sk4f_fromS32( src); |
+ *dst = Sk4f_toS32(s + d * (1.0f - s[3])); |
+} |
+ |
static void brute_force_srcover_srgb_srgb( |
uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
while (ndst > 0) { |
int n = SkTMin(ndst, nsrc); |
for (int i = 0; i < n; i++) { |
- srcover_blend_srgb8888_srgb_1(dst++, srgb_to_linear(to_4f(src[i]))); |
+ srcover_srgb_srgb_1(dst++, src[i]); |
} |
ndst -= n; |
} |