diff options
author | 2018-05-10 11:30:24 -0400 | |
---|---|---|
committer | 2018-05-10 16:42:25 +0000 | |
commit | c66eaaf2fb62b7e351c2c40d327b06c370ddf2c4 (patch) | |
tree | f42cae5613d697b5c098ab22d503b808adb455c4 /tests | |
parent | cbcfcf2871114b134d1fe622f07a84f302f6fd3b (diff) |
rm SkColorSpace_New
We think we can evolve SkColorSpace_XYZ into the One True SkColorSpace.
Change-Id: If93493145d78b388f3a0739cc7ccd6e232380733
Reviewed-on: https://skia-review.googlesource.com/127326
Auto-Submit: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkColorSpace_NewTest.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/tests/SkColorSpace_NewTest.cpp b/tests/SkColorSpace_NewTest.cpp deleted file mode 100644 index 31a5da6c50..0000000000 --- a/tests/SkColorSpace_NewTest.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "../src/jumper/SkJumper.h" -#include "SkColorSpace_New.h" -#include "SkRasterPipeline.h" -#include "Test.h" -#include <initializer_list> - -DEF_TEST(SkColorSpace_New_TransferFnBasics, r) { - auto gamut = SkMatrix44::I(); - auto blending = SkColorSpace_New::Blending::AsEncoded; - - SkColorSpace_New linearA{SkColorSpace_New::TransferFn::MakeLinear(), gamut, blending}, - linearB{SkColorSpace_New::TransferFn::MakeGamma(1), gamut, blending}, - srgb{SkColorSpace_New::TransferFn::MakeSRGB(), gamut, blending}, - gamma{SkColorSpace_New::TransferFn::MakeGamma(2.2f), gamut, blending}; - - REPORTER_ASSERT(r, linearA.gammaIsLinear()); - REPORTER_ASSERT(r, linearB.gammaIsLinear()); - REPORTER_ASSERT(r, ! srgb.gammaIsLinear()); - REPORTER_ASSERT(r, ! gamma.gammaIsLinear()); - - REPORTER_ASSERT(r, !linearA.gammaCloseToSRGB()); - REPORTER_ASSERT(r, !linearB.gammaCloseToSRGB()); - REPORTER_ASSERT(r, srgb.gammaCloseToSRGB()); - REPORTER_ASSERT(r, ! gamma.gammaCloseToSRGB()); - - REPORTER_ASSERT(r, linearA.transferFn().equals(linearB.transferFn())); - REPORTER_ASSERT(r, !linearA.transferFn().equals( srgb.transferFn())); - REPORTER_ASSERT(r, !linearA.transferFn().equals( gamma.transferFn())); - REPORTER_ASSERT(r, !linearB.transferFn().equals( srgb.transferFn())); - REPORTER_ASSERT(r, !linearB.transferFn().equals( gamma.transferFn())); - REPORTER_ASSERT(r, ! srgb.transferFn().equals( gamma.transferFn())); -} - -DEF_TEST(SkColorSpace_New_TransferFnStages, r) { - // We'll create a little SkRasterPipelineBlitter-like scenario, - // blending the same src color over the same dst color, but with - // three different transfer functions, for simplicity the same for src and dst. - SkColor src = 0x7f7f0000; - - SkColor dsts[3]; - for (SkColor& dst : dsts) { - dst = 0xff007f00; - } - - auto gamut = SkMatrix44::I(); - auto blending = SkColorSpace_New::Blending::Linear; - SkColorSpace_New linear{SkColorSpace_New::TransferFn::MakeLinear(), gamut, blending}, - srgb{SkColorSpace_New::TransferFn::MakeSRGB(), gamut, blending}, - gamma{SkColorSpace_New::TransferFn::MakeGamma(3), gamut, blending}; - SkColor* dst = dsts; - for (const SkColorSpace_New* cs : {&linear, &srgb, &gamma}) { - SkJumper_MemoryCtx src_ctx = { &src, 0 }, - dst_ctx = { dst++, 0 }; - - SkRasterPipeline_<256> p; - - p.append(SkRasterPipeline::load_8888, &src_ctx); - cs->transferFn().linearizeSrc(&p); - p.append(SkRasterPipeline::premul); - - p.append(SkRasterPipeline::load_8888_dst, &dst_ctx); - cs->transferFn().linearizeDst(&p); - p.append(SkRasterPipeline::premul_dst); - - p.append(SkRasterPipeline::srcover); - p.append(SkRasterPipeline::unpremul); - cs->transferFn().encodeSrc(&p); - p.append(SkRasterPipeline::store_8888, &dst_ctx); - p.run(0,0,1,1); - } - - // Double check the uninteresting channels: alpha's opaque, no blue. - REPORTER_ASSERT(r, SkColorGetA(dsts[0]) == 0xff && SkColorGetB(dsts[0]) == 0x00); - REPORTER_ASSERT(r, SkColorGetA(dsts[1]) == 0xff && SkColorGetB(dsts[1]) == 0x00); - REPORTER_ASSERT(r, SkColorGetA(dsts[2]) == 0xff && SkColorGetB(dsts[2]) == 0x00); - - // Because we're doing linear blending, a more-exponential transfer function will - // brighten the encoded values more when linearizing. So we expect to see that - // linear is darker than sRGB, and sRGB in turn is darker than gamma 3. - REPORTER_ASSERT(r, SkColorGetR(dsts[0]) < SkColorGetR(dsts[1])); - REPORTER_ASSERT(r, SkColorGetR(dsts[1]) < SkColorGetR(dsts[2])); - - REPORTER_ASSERT(r, SkColorGetG(dsts[0]) < SkColorGetG(dsts[1])); - REPORTER_ASSERT(r, SkColorGetG(dsts[1]) < SkColorGetG(dsts[2])); - -} |