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

Unified Diff: tools/viewer/Viewer.cpp

Issue 1950983007: Add sRGB mode toggle to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bundle window surface parameters in struct, use SkColorType/SkColorProfileType Created 4 years, 7 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 | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/DisplayParams.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/Viewer.cpp
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index ededc1f1c111c8b4f664316d0db05b0fece141ee..62c3048d914e720ed392f466c168231eb980c878 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -73,7 +73,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
SkCommandLineFlags::Parse(argc, argv);
fWindow = Window::CreateNativeWindow(platformData);
- fWindow->attach(Window::kVulkan_BackendType, 0);
+ fWindow->attach(Window::kVulkan_BackendType, DisplayParams());
// register callbacks
fWindow->registerKeyFunc(on_key_handler, this);
@@ -149,14 +149,21 @@ Viewer::~Viewer() {
delete fWindow;
}
-void Viewer::setupCurrentSlide(int previousSlide) {
+void Viewer::updateTitle() {
SkString title("Viewer: ");
title.append(fSlides[fCurrentSlide]->getName());
+ if (kSRGB_SkColorProfileType == fWindow->getDisplayParams().fProfileType) {
+ title.append(" sRGB");
+ }
+ fWindow->setTitle(title.c_str());
+}
+
+void Viewer::setupCurrentSlide(int previousSlide) {
+ this->updateTitle();
fSlides[fCurrentSlide]->load();
if (previousSlide >= 0) {
fSlides[previousSlide]->unload();
}
- fWindow->setTitle(title.c_str());
fWindow->inval();
}
@@ -220,9 +227,6 @@ bool Viewer::onKey(Window::Key key, Window::InputState state, uint32_t modifiers
if (fCurrentSlide < 0) {
fCurrentSlide = fSlides.count() - 1;
}
- SkString title("Viewer: ");
- title.append(fSlides[fCurrentSlide]->getName());
- fWindow->setTitle(title.c_str());
setupCurrentSlide(previousSlide);
return true;
}
@@ -248,9 +252,18 @@ bool Viewer::onKey(Window::Key key, Window::InputState state, uint32_t modifiers
}
bool Viewer::onChar(SkUnichar c, uint32_t modifiers) {
- if ('s' == c) {
- fDisplayStats = !fDisplayStats;
- return true;
+ switch (c) {
+ case 's':
+ fDisplayStats = !fDisplayStats;
+ return true;
+ case 'c':
+ DisplayParams params = fWindow->getDisplayParams();
+ params.fProfileType = (kLinear_SkColorProfileType == params.fProfileType)
+ ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType;
+ fWindow->setDisplayParams(params);
+ this->updateTitle();
+ fWindow->inval();
+ return true;
}
return false;
« no previous file with comments | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/DisplayParams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698