OLD | NEW |
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 Loading... |
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.fProfileType = (kLinear_SkColorProfileType == params.fProfileType
) | 124 params.fColorSpace = (nullptr == params.fColorSpace) |
125 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType; | 125 ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr; |
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 Loading... |
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 if (kSRGB_SkColorProfileType == fWindow->getDisplayParams().fProfileType) { | 260 |
| 261 // TODO: For now, any color-space on the window means sRGB |
| 262 if (fWindow->getDisplayParams().fColorSpace) { |
261 title.append(" sRGB"); | 263 title.append(" sRGB"); |
262 } | 264 } |
263 title.append(kBackendTypeStrings[fBackendType]); | 265 title.append(kBackendTypeStrings[fBackendType]); |
264 fWindow->setTitle(title.c_str()); | 266 fWindow->setTitle(title.c_str()); |
265 } | 267 } |
266 | 268 |
267 void Viewer::setupCurrentSlide(int previousSlide) { | 269 void Viewer::setupCurrentSlide(int previousSlide) { |
268 if (fCurrentSlide == previousSlide) { | 270 if (fCurrentSlide == previousSlide) { |
269 return; // no change; do nothing | 271 return; // no change; do nothing |
270 } | 272 } |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 bool newSplitScreen = stateValue.equals(kON); | 561 bool newSplitScreen = stateValue.equals(kON); |
560 if (newSplitScreen != fSplitScreen) { | 562 if (newSplitScreen != fSplitScreen) { |
561 fSplitScreen = newSplitScreen; | 563 fSplitScreen = newSplitScreen; |
562 fWindow->inval(); | 564 fWindow->inval(); |
563 updateUIState(); | 565 updateUIState(); |
564 } | 566 } |
565 } else { | 567 } else { |
566 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 568 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
567 } | 569 } |
568 } | 570 } |
OLD | NEW |