Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: samplecode/SampleApp.cpp

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 40ead7482f81457b8166b638309822ad7c922eee..b80ea44d30df6bd900c213fb26530c001650f597 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);
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698