diff options
author | brianosman <brianosman@google.com> | 2016-06-16 11:10:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-16 11:10:04 -0700 |
commit | 6a61a875467646f8dbc37cfecf49e12d1f475170 (patch) | |
tree | db9b06850ce0d7f35fb9d21b14a0b1c431edb349 /dm | |
parent | dea0340cadb759932e53416a657f5ea75fee8b5f (diff) |
Lots of progress on switching to SkColorSpace rather than SkColorProfileType
Fixed a bunch of code in Ganesh, as well as usage of SkColorProfileType in most of our tools (DM, SampleApp, Viewer, nanobench, skiaserve, HelloWorld).
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2069173002
Review-Url: https://codereview.chromium.org/2069173002
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DM.cpp | 10 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 12 | ||||
-rw-r--r-- | dm/DMSrcSink.h | 10 |
3 files changed, 17 insertions, 15 deletions
@@ -802,8 +802,8 @@ static Sink* create_sink(const SkCommandLineConfig* config) { contextOptions = static_cast<GrContextFactory::ContextOptions>( contextOptions | GrContextFactory::kEnableNVPR_ContextOptions); } - if (SkColorAndProfileAreGammaCorrect(gpuConfig->getColorType(), - gpuConfig->getProfileType())) { + if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(), + gpuConfig->getColorSpace())) { contextOptions = static_cast<GrContextFactory::ContextOptions>( contextOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions); } @@ -815,7 +815,7 @@ static Sink* create_sink(const SkCommandLineConfig* config) { } return new GPUSink(contextType, contextOptions, gpuConfig->getSamples(), gpuConfig->getUseDIText(), gpuConfig->getColorType(), - gpuConfig->getProfileType(), FLAGS_gpu_threading); + sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_threading); } } #endif @@ -827,9 +827,11 @@ static Sink* create_sink(const SkCommandLineConfig* config) { #endif if (FLAGS_cpu) { + auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); + SINK("565", RasterSink, kRGB_565_SkColorType); SINK("8888", RasterSink, kN32_SkColorType); - SINK("srgb", RasterSink, kN32_SkColorType, kSRGB_SkColorProfileType); + SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace); SINK("f16", RasterSink, kRGBA_F16_SkColorType); SINK("pdf", PDFSink); SINK("skp", SKPSink); diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index b252290cd5..97f1e48664 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1060,14 +1060,14 @@ GPUSink::GPUSink(GrContextFactory::ContextType ct, int samples, bool diText, SkColorType colorType, - SkColorProfileType profileType, + sk_sp<SkColorSpace> colorSpace, bool threaded) : fContextType(ct) , fContextOptions(options) , fSampleCount(samples) , fUseDIText(diText) , fColorType(colorType) - , fProfileType(profileType) + , fColorSpace(std::move(colorSpace)) , fThreaded(threaded) {} void PreAbandonGpuContextErrorHandler(SkError, void*) {} @@ -1093,7 +1093,7 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co const SkISize size = src.size(); const SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), fColorType, - kPremul_SkAlphaType, fProfileType); + kPremul_SkAlphaType, fColorSpace); #if SK_SUPPORT_GPU GrContext* context = factory.getContextInfo(fContextType, fContextOptions).grContext(); const int maxDimension = context->caps()->maxTextureSize(); @@ -1213,9 +1213,9 @@ Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -RasterSink::RasterSink(SkColorType colorType, SkColorProfileType profileType) +RasterSink::RasterSink(SkColorType colorType, sk_sp<SkColorSpace> colorSpace) : fColorType(colorType) - , fProfileType(profileType) {} + , fColorSpace(std::move(colorSpace)) {} Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const { const SkISize size = src.size(); @@ -1225,7 +1225,7 @@ Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) con SkMallocPixelRef::ZeroedPRFactory factory; dst->allocPixels(SkImageInfo::Make(size.width(), size.height(), - fColorType, alphaType, fProfileType), + fColorType, alphaType, fColorSpace), &factory, nullptr/*colortable*/); SkCanvas canvas(*dst); diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index 8cb2b25bf4..a2bfbca7f3 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -281,7 +281,7 @@ class GPUSink : public Sink { public: GPUSink(sk_gpu_test::GrContextFactory::ContextType, sk_gpu_test::GrContextFactory::ContextOptions, - int samples, bool diText, SkColorType colorType, SkColorProfileType profileType, + int samples, bool diText, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, bool threaded); Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; @@ -294,7 +294,7 @@ private: int fSampleCount; bool fUseDIText; SkColorType fColorType; - SkColorProfileType fProfileType; + sk_sp<SkColorSpace> fColorSpace; bool fThreaded; }; @@ -318,14 +318,14 @@ public: class RasterSink : public Sink { public: - explicit RasterSink(SkColorType, SkColorProfileType=kLinear_SkColorProfileType); + explicit RasterSink(SkColorType, sk_sp<SkColorSpace> = nullptr); Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; const char* fileExtension() const override { return "png"; } SinkFlags flags() const override { return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; } private: - SkColorType fColorType; - SkColorProfileType fProfileType; + SkColorType fColorType; + sk_sp<SkColorSpace> fColorSpace; }; class SKPSink : public Sink { |