diff options
author | 2016-06-16 13:03:24 -0700 | |
---|---|---|
committer | 2016-06-16 13:03:24 -0700 | |
commit | b109b8c5ec40a7dd85a0a2951a1f98fa63b805aa (patch) | |
tree | fe94e12159f2b7b07ed9ed23316fade5b0ff8d37 /samplecode | |
parent | 8811e40850ac3310c17fe8cdaffe72817a5e317d (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
Committed: https://skia.googlesource.com/skia/+/6a61a875467646f8dbc37cfecf49e12d1f475170
Review-Url: https://codereview.chromium.org/2069173002
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleApp.cpp | 19 | ||||
-rw-r--r-- | samplecode/SampleApp.h | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 40ead7482f..b80ea44d30 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -48,17 +48,18 @@ class GrContext; const struct { SkColorType fColorType; - SkColorProfileType fProfileType; + bool fSRGB; const char* fName; } gConfig[] = { - { kN32_SkColorType, kLinear_SkColorProfileType, "L32" }, - { kN32_SkColorType, kSRGB_SkColorProfileType, "S32" }, - { kRGBA_F16_SkColorType, kLinear_SkColorProfileType, "F16" }, + { kN32_SkColorType, false, "L32" }, + { kN32_SkColorType, true, "S32" }, + { kRGBA_F16_SkColorType, false, "F16" }, }; static const char* find_config_name(const SkImageInfo& info) { for (const auto& config : gConfig) { - if (config.fColorType == info.colorType() && config.fProfileType == info.profileType()) { + if (config.fColorType == info.colorType() && + config.fSRGB == (info.colorSpace() != nullptr)) { return config.fName; } } @@ -1532,7 +1533,9 @@ bool SampleWindow::onEvent(const SkEvent& evt) { return true; } if (SkOSMenu::FindListIndex(evt, "ColorType", &selected)) { - this->setDeviceColorType(gConfig[selected].fColorType, gConfig[selected].fProfileType); + auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); + this->setDeviceColorType(gConfig[selected].fColorType, + gConfig[selected].fSRGB ? srgbColorSpace : nullptr); return true; } if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) { @@ -1747,8 +1750,8 @@ void SampleWindow::setDeviceType(DeviceType type) { this->inval(nullptr); } -void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) { - this->setColorType(ct, pt); +void SampleWindow::setDeviceColorType(SkColorType ct, sk_sp<SkColorSpace> cs) { + this->setColorType(ct, std::move(cs)); fDevManager->tearDownBackend(this); fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor); diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h index 371133b9a2..f4be093a66 100644 --- a/samplecode/SampleApp.h +++ b/samplecode/SampleApp.h @@ -116,7 +116,7 @@ public: void draw(SkCanvas*) override; void setDeviceType(DeviceType type); - void setDeviceColorType(SkColorType, SkColorProfileType); + void setDeviceColorType(SkColorType, sk_sp<SkColorSpace>); void toggleRendering(); void toggleSlideshow(); void toggleFPS(); |