blitters for sRGB and float16
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1697863002
Review URL: https://codereview.chromium.org/1697863002
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 65e3c17..61cd751 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -42,6 +42,25 @@
class GrContext;
#endif
+const struct {
+ SkColorType fColorType;
+ SkColorProfileType fProfileType;
+ const char* fName;
+} gConfig[] = {
+ { 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.fProfileType == info.profileType()) {
+ return config.fName;
+ }
+ }
+ return "???";
+}
+
// Should be 3x + 1
#define kMaxFatBitsScale 28
@@ -876,6 +895,10 @@
fAppMenu->setTitle("Global Settings");
int itemID;
+ itemID = fAppMenu->appendList("ColorType", "ColorType", sinkID, 0,
+ gConfig[0].fName, gConfig[1].fName, gConfig[2].fName, nullptr);
+ fAppMenu->assignKeyEquivalentToItem(itemID, 'C');
+
itemID = fAppMenu->appendList("Device Type", "Device Type", sinkID, 0,
"Raster",
"OpenGL",
@@ -1557,6 +1580,10 @@
this->setDeviceType((DeviceType)selected);
return true;
}
+ if (SkOSMenu::FindListIndex(evt, "ColorType", &selected)) {
+ this->setDeviceColorType(gConfig[selected].fColorType, gConfig[selected].fProfileType);
+ return true;
+ }
if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) {
this->toggleSlideshow();
return true;
@@ -1761,13 +1788,24 @@
void SampleWindow::setDeviceType(DeviceType type) {
if (type == fDeviceType)
return;
+
+ fDevManager->tearDownBackend(this);
+
+ fDeviceType = type;
+
+ fDevManager->setUpBackend(this, fMSAASampleCount);
+
+ this->updateTitle();
+ this->inval(nullptr);
+}
+
+void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) {
+ this->setColorType(ct, pt);
fDevManager->tearDownBackend(this);
-
- fDeviceType = type;
-
+
fDevManager->setUpBackend(this, fMSAASampleCount);
-
+
this->updateTitle();
this->inval(nullptr);
}
@@ -2027,6 +2065,8 @@
}
#endif
+ title.appendf(" %s", find_config_name(this->info()));
+
this->setTitle(title.c_str());
}