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

Unified Diff: samplecode/SampleApp.cpp

Issue 1697863002: blitters for sRGB and float16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/SkBitmapDevice.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 65e3c17a444292a575c11ea9ee5361607d5659fa..61cd75149f2065e9f390a73a36dee9de71705d07 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 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
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 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
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 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
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);
+
+ fDevManager->setUpBackend(this, fMSAASampleCount);
+
this->updateTitle();
this->inval(nullptr);
}
@@ -2027,6 +2065,8 @@ void SampleWindow::updateTitle() {
}
#endif
+ title.appendf(" %s", find_config_name(this->info()));
+
this->setTitle(title.c_str());
}
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698