diff options
author | Mike Klein <mtklein@chromium.org> | 2018-05-29 12:22:10 -0400 |
---|---|---|
committer | Mike Klein <mtklein@google.com> | 2018-05-29 19:14:03 +0000 |
commit | cdbec8f197e3a75185e95ff66afb3edb49097bde (patch) | |
tree | dcc7738094962538cd2f59b549f144a552f1251b | |
parent | a33447dab9b9ebdc0bd636b6ec7721557d21feac (diff) |
remove bit, srgbnl config in DM
We're not going to need the bit.
I've rewritten "esrgb" and "srgbnl" to express themselves the way I'd
like them to work. Their images are supressed in Gold already.
Change-Id: I6da58cc75dcb998cbfcf9a8f65de31c030adb494
Reviewed-on: https://skia-review.googlesource.com/130506
Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r-- | dm/DM.cpp | 9 | ||||
-rw-r--r-- | gn/tests.gni | 1 | ||||
-rw-r--r-- | include/core/SkColorSpace.h | 3 | ||||
-rw-r--r-- | src/core/SkColorSpace.cpp | 4 | ||||
-rw-r--r-- | src/core/SkColorSpace_XYZ.cpp | 10 | ||||
-rw-r--r-- | src/core/SkColorSpace_XYZ.h | 4 | ||||
-rw-r--r-- | tests/NonlinearBlendingTest.cpp | 76 |
7 files changed, 5 insertions, 102 deletions
@@ -903,21 +903,19 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi if (FLAGS_cpu) { auto srgbColorSpace = SkColorSpace::MakeSRGB(); auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear(); - auto esrgb = SkColorSpace::MakeSRGB()->makeNonlinearBlending(); SINK("g8", RasterSink, kGray_8_SkColorType); SINK("565", RasterSink, kRGB_565_SkColorType); SINK("4444", RasterSink, kARGB_4444_SkColorType); SINK("8888", RasterSink, kN32_SkColorType); - SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace); SINK("rgba", RasterSink, kRGBA_8888_SkColorType); SINK("bgra", RasterSink, kBGRA_8888_SkColorType); SINK("rgbx", RasterSink, kRGB_888x_SkColorType); SINK("1010102", RasterSink, kRGBA_1010102_SkColorType); SINK("101010x", RasterSink, kRGB_101010x_SkColorType); SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace); - SINK("esrgb", RasterSink, kRGBA_F16_SkColorType, esrgb); - SINK("srgbnl", RasterSink, kRGBA_8888_SkColorType, esrgb); + SINK("esrgb", RasterSink, kRGBA_F16_SkColorType, srgbColorSpace); + SINK("srgbnl", RasterSink, kRGBA_8888_SkColorType, srgbColorSpace); SINK("t8888", ThreadedSink, kN32_SkColorType); SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI); SINK("skp", SKPSink); @@ -928,6 +926,9 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi SINK("pdfa", PDFSink, true, SK_ScalarDefaultRasterDPI); SINK("pdf300", PDFSink, false, 300); SINK("jsdebug", DebugSink); + + // TODO: kRGBA_sRGB_SkColorType / srgbLinearColorSpace? + SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace); } #undef SINK return nullptr; diff --git a/gn/tests.gni b/gn/tests.gni index a40ce68bdb..a359ca3e3c 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -139,7 +139,6 @@ tests_sources = [ "$_tests/MessageBusTest.cpp", "$_tests/MetaDataTest.cpp", "$_tests/MipMapTest.cpp", - "$_tests/NonlinearBlendingTest.cpp", "$_tests/OnceTest.cpp", "$_tests/OSPathTest.cpp", "$_tests/OverAlignedTest.cpp", diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h index 251eeea040..66b101a22d 100644 --- a/include/core/SkColorSpace.h +++ b/include/core/SkColorSpace.h @@ -256,9 +256,6 @@ public: */ static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); - virtual bool nonlinearBlending() const { return false; } - virtual sk_sp<SkColorSpace> makeNonlinearBlending() const { return nullptr; } - private: virtual const SkMatrix44* onToXYZD50() const = 0; virtual uint32_t onToXYZD50Hash() const = 0; diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp index b75edcef94..be399bda6f 100644 --- a/src/core/SkColorSpace.cpp +++ b/src/core/SkColorSpace.cpp @@ -500,10 +500,6 @@ bool SkColorSpace::Equals(const SkColorSpace* src, const SkColorSpace* dst) { return false; } - if (src->nonlinearBlending() != dst->nonlinearBlending()) { - return false; - } - const SkData* srcData = src->onProfileData(); const SkData* dstData = dst->onProfileData(); if (srcData || dstData) { diff --git a/src/core/SkColorSpace_XYZ.cpp b/src/core/SkColorSpace_XYZ.cpp index 42b5b5d388..ca50b7006f 100644 --- a/src/core/SkColorSpace_XYZ.cpp +++ b/src/core/SkColorSpace_XYZ.cpp @@ -102,13 +102,3 @@ sk_sp<SkColorSpace> SkColorSpace_XYZ::makeColorSpin() const { (void)spin.getType(); // Pre-cache spin matrix type to avoid races in future getType() calls. return sk_sp<SkColorSpace>(new SkColorSpace_XYZ(fGammaNamed, fGammas, spin, fProfileData)); } - -sk_sp<SkColorSpace> SkColorSpace_XYZ::makeNonlinearBlending() const { - if (this->nonlinearBlending()) { - return sk_ref_sp(const_cast<SkColorSpace_XYZ*>(this)); - } - - auto cs = sk_make_sp<SkColorSpace_XYZ>(fGammaNamed, fGammas, fToXYZD50, fProfileData); - cs->fNonlinearBlending = true; - return std::move(cs); -} diff --git a/src/core/SkColorSpace_XYZ.h b/src/core/SkColorSpace_XYZ.h index a6f642248f..72a1d6274d 100644 --- a/src/core/SkColorSpace_XYZ.h +++ b/src/core/SkColorSpace_XYZ.h @@ -23,14 +23,12 @@ public: bool onGammaCloseToSRGB() const override; bool onGammaIsLinear() const override; bool onIsNumericalTransferFn(SkColorSpaceTransferFn* coeffs) const override; - bool nonlinearBlending() const override { return fNonlinearBlending; } const SkData* onProfileData() const override { return fProfileData.get(); } sk_sp<SkColorSpace> makeLinearGamma() const override; sk_sp<SkColorSpace> makeSRGBGamma() const override; sk_sp<SkColorSpace> makeColorSpin() const override; - sk_sp<SkColorSpace> makeNonlinearBlending() const override; SkGammaNamed onGammaNamed() const override { return fGammaNamed; } @@ -54,8 +52,6 @@ private: mutable SkMatrix44 fFromXYZD50; mutable SkOnce fFromXYZOnce; - bool fNonlinearBlending = false; - friend class SkColorSpace; friend class ColorSpaceXformTest; }; diff --git a/tests/NonlinearBlendingTest.cpp b/tests/NonlinearBlendingTest.cpp deleted file mode 100644 index 10c12aa280..0000000000 --- a/tests/NonlinearBlendingTest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "Test.h" -#include "SkHalf.h" -#include "SkSurface.h" -#include "SkCanvas.h" - -DEF_TEST(NonlinearBlending, r) { - - // First check our familiar basics with linear F16. - { - auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeSRGBLinear()); - - auto surface = SkSurface::MakeRaster(info); - surface->getCanvas()->clear(0xff808080); - uint64_t pix; - REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0)); - - // 0x80 in sRGB is ≈ 0.22 linear. - REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) < 0.25f); - } - - // Test that we support sRGB-encoded F16. This is somewhat new. - { - auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeSRGB()); - - auto surface = SkSurface::MakeRaster(info); - surface->getCanvas()->clear(0xff808080); - uint64_t pix; - REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0)); - - // 0x80 sRGB is ≈ 0.501. - REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f); - } - - // Since we're only clear()ing, this should work the same as the last block. - { - auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeSRGB()->makeNonlinearBlending()); - - auto surface = SkSurface::MakeRaster(info); - surface->getCanvas()->clear(0xff808080); - uint64_t pix; - REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0)); - - // 0x80 sRGB is ≈ 0.501. - REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f); - } - - // This won't work until we actually support color spaces with non-linear blending. - if (0) { - auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeSRGB()->makeNonlinearBlending()); - - auto surface = SkSurface::MakeRaster(info); - - surface->getCanvas()->clear(SK_ColorWHITE); - SkPaint p; - p.setColor(0x80000000); - surface->getCanvas()->drawPaint(p); - - uint64_t pix; - REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0)); - - // 0x80 sRGB is ≈ 0.501. A likely failure here is ~0.75, linear blending. - REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.45f && - SkHalfToFloat(pix & 0xffff) <= 0.55f); - } -} |