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

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: 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
Index: tools/viewer/Viewer.cpp
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index ededc1f1c111c8b4f664316d0db05b0fece141ee..228b658924e34fe9c68ba59e831f8afc7d774fb2 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, 0, false);
// 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 (fWindow->getSRGB()) {
+ title.append(" sRGB");
+ }
+ fWindow->setTitle(title.c_str());
+}
+
+void Viewer::setupCurrentSlide(int previousSlide) {
+ updateTitle();
bsalomon 2016/05/06 18:30:15 this->
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,15 @@ 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':
+ fWindow->setSRGB(!fWindow->getSRGB());
+ updateTitle();
+ fWindow->inval();
+ return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698