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

Side by Side Diff: tools/viewer/Viewer.cpp

Issue 2072813002: Revert of Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « tools/skiaserve/Request.cpp ('k') | tools/viewer/sk_app/DisplayParams.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Viewer.h" 8 #include "Viewer.h"
9 9
10 #include "GMSlide.h" 10 #include "GMSlide.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 fWindow->registerTouchFunc(on_touch_handler, this); 114 fWindow->registerTouchFunc(on_touch_handler, this);
115 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); 115 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this);
116 116
117 // add key-bindings 117 // add key-bindings
118 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() { 118 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() {
119 this->fDisplayStats = !this->fDisplayStats; 119 this->fDisplayStats = !this->fDisplayStats;
120 fWindow->inval(); 120 fWindow->inval();
121 }); 121 });
122 fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() { 122 fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() {
123 DisplayParams params = fWindow->getDisplayParams(); 123 DisplayParams params = fWindow->getDisplayParams();
124 params.fColorSpace = (nullptr == params.fColorSpace) 124 params.fProfileType = (kLinear_SkColorProfileType == params.fProfileType )
125 ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr; 125 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType;
126 fWindow->setDisplayParams(params); 126 fWindow->setDisplayParams(params);
127 this->updateTitle(); 127 this->updateTitle();
128 fWindow->inval(); 128 fWindow->inval();
129 }); 129 });
130 fCommands.addCommand(Window::Key::kRight, "Right", "Navigation", "Next slide ", [this]() { 130 fCommands.addCommand(Window::Key::kRight, "Right", "Navigation", "Next slide ", [this]() {
131 int previousSlide = fCurrentSlide; 131 int previousSlide = fCurrentSlide;
132 fCurrentSlide++; 132 fCurrentSlide++;
133 if (fCurrentSlide >= fSlides.count()) { 133 if (fCurrentSlide >= fSlides.count()) {
134 fCurrentSlide = 0; 134 fCurrentSlide = 0;
135 } 135 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 251
252 Viewer::~Viewer() { 252 Viewer::~Viewer() {
253 fWindow->detach(); 253 fWindow->detach();
254 delete fWindow; 254 delete fWindow;
255 } 255 }
256 256
257 void Viewer::updateTitle() { 257 void Viewer::updateTitle() {
258 SkString title("Viewer: "); 258 SkString title("Viewer: ");
259 title.append(fSlides[fCurrentSlide]->getName()); 259 title.append(fSlides[fCurrentSlide]->getName());
260 260 if (kSRGB_SkColorProfileType == fWindow->getDisplayParams().fProfileType) {
261 // TODO: For now, any color-space on the window means sRGB
262 if (fWindow->getDisplayParams().fColorSpace) {
263 title.append(" sRGB"); 261 title.append(" sRGB");
264 } 262 }
265 title.append(kBackendTypeStrings[fBackendType]); 263 title.append(kBackendTypeStrings[fBackendType]);
266 fWindow->setTitle(title.c_str()); 264 fWindow->setTitle(title.c_str());
267 } 265 }
268 266
269 void Viewer::setupCurrentSlide(int previousSlide) { 267 void Viewer::setupCurrentSlide(int previousSlide) {
270 if (fCurrentSlide == previousSlide) { 268 if (fCurrentSlide == previousSlide) {
271 return; // no change; do nothing 269 return; // no change; do nothing
272 } 270 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 bool newSplitScreen = stateValue.equals(kON); 559 bool newSplitScreen = stateValue.equals(kON);
562 if (newSplitScreen != fSplitScreen) { 560 if (newSplitScreen != fSplitScreen) {
563 fSplitScreen = newSplitScreen; 561 fSplitScreen = newSplitScreen;
564 fWindow->inval(); 562 fWindow->inval();
565 updateUIState(); 563 updateUIState();
566 } 564 }
567 } else { 565 } else {
568 SkDebugf("Unknown stateName: %s", stateName.c_str()); 566 SkDebugf("Unknown stateName: %s", stateName.c_str());
569 } 567 }
570 } 568 }
OLDNEW
« no previous file with comments | « tools/skiaserve/Request.cpp ('k') | tools/viewer/sk_app/DisplayParams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698