diff options
author | mtklein <mtklein@chromium.org> | 2016-07-20 18:10:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-20 18:10:07 -0700 |
commit | 0c902473d64ef935a64d078f70bdc9334ab51427 (patch) | |
tree | 09a423ffe65a60d3571372d455df64068ac754a7 /tests | |
parent | 456bf30d321292da7f15d1af35fd94fbb6a4bb59 (diff) |
Correct sRGB <-> linear everywhere.
This trims the SkPM4fPriv methods down to just foolproof methods.
(Anything trying to build these itself is probably wrong.)
Things like Sk4f srgb_to_linear(Sk4f) can't really exist anymore,
at least not efficiently, so this refactor is somewhat more invasive
than you might think. Generally this means things using to_4f() are
also making a misstep... that's gone too.
It also does not make sense to try to play games with linear floats
with 255 bias any more. That hack can't work with real sRGB coding.
Rather than update them, I've removed a couple of L32 xfermode fast
paths. I'd even rather drop it entirely...
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163683002
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Review-Url: https://codereview.chromium.org/2163683002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkBlend_optsTest.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp index 7665a2d5de..e681374852 100644 --- a/tests/SkBlend_optsTest.cpp +++ b/tests/SkBlend_optsTest.cpp @@ -19,13 +19,19 @@ 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) { + 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; } @@ -63,6 +69,7 @@ static void test_blender(std::string resourceName, skiatest::Reporter* reporter) SkAutoTArray<uint32_t> testDst(width); for (int y = 0; y < pixmap.height(); y++) { + // TODO: zero is not the most interesting dst to test srcover... sk_bzero(correctDst.get(), width * sizeof(uint32_t)); sk_bzero(testDst.get(), width * sizeof(uint32_t)); brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width); |