Revert of Lots of progress switching to SkColorSpace rather than SkColorProfileType (patchset #10 id:180001 of https://codereview.chromium.org/2069173002/ )
Reason for revert:
Mac crashes in GrUploadPixmapToTexture
Original issue's description:
> 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
TBR=reed@google.com,herb@google.com,msarett@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2072813002
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index b80ea44..40ead74 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -48,18 +48,17 @@
const struct {
SkColorType fColorType;
- bool fSRGB;
+ SkColorProfileType fProfileType;
const char* fName;
} gConfig[] = {
- { kN32_SkColorType, false, "L32" },
- { kN32_SkColorType, true, "S32" },
- { kRGBA_F16_SkColorType, false, "F16" },
+ { kN32_SkColorType, kLinear_SkColorProfileType, "L32" },
+ { kN32_SkColorType, kSRGB_SkColorProfileType, "S32" },
+ { kRGBA_F16_SkColorType, kLinear_SkColorProfileType, "F16" },
};
static const char* find_config_name(const SkImageInfo& info) {
for (const auto& config : gConfig) {
- if (config.fColorType == info.colorType() &&
- config.fSRGB == (info.colorSpace() != nullptr)) {
+ if (config.fColorType == info.colorType() && config.fProfileType == info.profileType()) {
return config.fName;
}
}
@@ -1533,9 +1532,7 @@
return true;
}
if (SkOSMenu::FindListIndex(evt, "ColorType", &selected)) {
- auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
- this->setDeviceColorType(gConfig[selected].fColorType,
- gConfig[selected].fSRGB ? srgbColorSpace : nullptr);
+ this->setDeviceColorType(gConfig[selected].fColorType, gConfig[selected].fProfileType);
return true;
}
if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) {
@@ -1750,8 +1747,8 @@
this->inval(nullptr);
}
-void SampleWindow::setDeviceColorType(SkColorType ct, sk_sp<SkColorSpace> cs) {
- this->setColorType(ct, std::move(cs));
+void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) {
+ this->setColorType(ct, pt);
fDevManager->tearDownBackend(this);
fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor);
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index f4be093..371133b 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -116,7 +116,7 @@
void draw(SkCanvas*) override;
void setDeviceType(DeviceType type);
- void setDeviceColorType(SkColorType, sk_sp<SkColorSpace>);
+ void setDeviceColorType(SkColorType, SkColorProfileType);
void toggleRendering();
void toggleSlideshow();
void toggleFPS();