diff options
author | Mike Klein <mtklein@chromium.org> | 2017-05-15 18:03:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-15 23:57:48 +0000 |
commit | ca2194b38e69e29b6c18a52ad17dd36c94d710c2 (patch) | |
tree | 0c75728225849ef2e006d327ca19f35bae69933a /tests | |
parent | f82b3cd6b5364305a28e4538392153f8cc039a9e (diff) |
add a test that sRGB stages round trip
Change-Id: Ide8303f6fc162f3703f7db298fe210d47225a580
Reviewed-on: https://skia-review.googlesource.com/16988
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SRGBTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/SRGBTest.cpp b/tests/SRGBTest.cpp index 77c1fb75de..4d0084ab22 100644 --- a/tests/SRGBTest.cpp +++ b/tests/SRGBTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkRasterPipeline.h" #include "SkSRGB.h" #include "SkTypes.h" #include "Test.h" @@ -37,3 +38,26 @@ DEF_TEST(sk_linear_to_srgb, r) { f = pun.flt; } } + +DEF_TEST(sk_pipeline_srgb_roundtrip, r) { + uint32_t reds[256]; + for (int i = 0; i < 256; i++) { + reds[i] = i; + } + + auto ptr = (void*)reds; + + SkRasterPipeline p; + p.append(SkRasterPipeline::load_8888, &ptr); + p.append_from_srgb(kUnpremul_SkAlphaType); + p.append(SkRasterPipeline::to_srgb); + p.append(SkRasterPipeline::store_8888, &ptr); + + p.run(0,256); + + for (int i = 0; i < 256; i++) { + if (reds[i] != (uint32_t)i) { + ERRORF(r, "%d doesn't round trip, %d", i, reds[i]); + } + } +} |