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

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

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 fWindow->registerTouchFunc(on_touch_handler, this); 115 fWindow->registerTouchFunc(on_touch_handler, this);
116 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); 116 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this);
117 117
118 // add key-bindings 118 // add key-bindings
119 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() { 119 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() {
120 this->fDisplayStats = !this->fDisplayStats; 120 this->fDisplayStats = !this->fDisplayStats;
121 fWindow->inval(); 121 fWindow->inval();
122 }); 122 });
123 fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() { 123 fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() {
124 DisplayParams params = fWindow->getDisplayParams(); 124 DisplayParams params = fWindow->getDisplayParams();
125 params.fProfileType = (kLinear_SkColorProfileType == params.fProfileType ) 125 params.fColorSpace = (nullptr == params.fColorSpace)
126 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType; 126 ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr;
127 fWindow->setDisplayParams(params); 127 fWindow->setDisplayParams(params);
128 this->updateTitle(); 128 this->updateTitle();
129 fWindow->inval(); 129 fWindow->inval();
130 }); 130 });
131 fCommands.addCommand(Window::Key::kRight, "Right", "Navigation", "Next slide ", [this]() { 131 fCommands.addCommand(Window::Key::kRight, "Right", "Navigation", "Next slide ", [this]() {
132 int previousSlide = fCurrentSlide; 132 int previousSlide = fCurrentSlide;
133 fCurrentSlide++; 133 fCurrentSlide++;
134 if (fCurrentSlide >= fSlides.count()) { 134 if (fCurrentSlide >= fSlides.count()) {
135 fCurrentSlide = 0; 135 fCurrentSlide = 0;
136 } 136 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 260
261 Viewer::~Viewer() { 261 Viewer::~Viewer() {
262 fWindow->detach(); 262 fWindow->detach();
263 delete fWindow; 263 delete fWindow;
264 } 264 }
265 265
266 void Viewer::updateTitle() { 266 void Viewer::updateTitle() {
267 SkString title("Viewer: "); 267 SkString title("Viewer: ");
268 title.append(fSlides[fCurrentSlide]->getName()); 268 title.append(fSlides[fCurrentSlide]->getName());
269 if (kSRGB_SkColorProfileType == fWindow->getDisplayParams().fProfileType) { 269
270 // TODO: For now, any color-space on the window means sRGB
271 if (fWindow->getDisplayParams().fColorSpace) {
270 title.append(" sRGB"); 272 title.append(" sRGB");
271 } 273 }
272 title.append(kBackendTypeStrings[fBackendType]); 274 title.append(kBackendTypeStrings[fBackendType]);
273 fWindow->setTitle(title.c_str()); 275 fWindow->setTitle(title.c_str());
274 } 276 }
275 277
276 void Viewer::setupCurrentSlide(int previousSlide) { 278 void Viewer::setupCurrentSlide(int previousSlide) {
277 if (fCurrentSlide == previousSlide) { 279 if (fCurrentSlide == previousSlide) {
278 return; // no change; do nothing 280 return; // no change; do nothing
279 } 281 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 bool newSplitScreen = stateValue.equals(kON); 570 bool newSplitScreen = stateValue.equals(kON);
569 if (newSplitScreen != fSplitScreen) { 571 if (newSplitScreen != fSplitScreen) {
570 fSplitScreen = newSplitScreen; 572 fSplitScreen = newSplitScreen;
571 fWindow->inval(); 573 fWindow->inval();
572 updateUIState(); 574 updateUIState();
573 } 575 }
574 } else { 576 } else {
575 SkDebugf("Unknown stateName: %s", stateName.c_str()); 577 SkDebugf("Unknown stateName: %s", stateName.c_str());
576 } 578 }
577 } 579 }
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