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

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

Issue 2226413002: Clean up Xlib viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix non-vulkan build Created 4 years, 4 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 | « no previous file | tools/viewer/sk_app/VulkanWindowContext.cpp » ('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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 for (int i = 1; i < argc; ++i) { 129 for (int i = 1; i < argc; ++i) {
130 SkDebugf("%s ", argv[i]); 130 SkDebugf("%s ", argv[i]);
131 } 131 }
132 SkDebugf("\n"); 132 SkDebugf("\n");
133 133
134 SkCommandLineFlags::Parse(argc, argv); 134 SkCommandLineFlags::Parse(argc, argv);
135 135
136 fBackendType = get_backend_type(FLAGS_backend[0]); 136 fBackendType = get_backend_type(FLAGS_backend[0]);
137 fWindow = Window::CreateNativeWindow(platformData); 137 fWindow = Window::CreateNativeWindow(platformData);
138 fWindow->attach(fBackendType, DisplayParams()); 138 fWindow->attach(fBackendType, DisplayParams());
139 #if defined(SK_VULKAN) && defined(SK_BUILD_FOR_UNIX)
140 // Vulkan doesn't seem to handle a single refresh properly on Linux
141 fRefresh = (sk_app::Window::kVulkan_BackendType == fBackendType);
142 #endif
139 143
140 // register callbacks 144 // register callbacks
141 fCommands.attach(fWindow); 145 fCommands.attach(fWindow);
142 fWindow->registerPaintFunc(on_paint_handler, this); 146 fWindow->registerPaintFunc(on_paint_handler, this);
143 fWindow->registerTouchFunc(on_touch_handler, this); 147 fWindow->registerTouchFunc(on_touch_handler, this);
144 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); 148 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this);
145 149
146 // add key-bindings 150 // add key-bindings
147 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() { 151 fCommands.addCommand('s', "Overlays", "Toggle stats display", [this]() {
148 this->fDisplayStats = !this->fDisplayStats; 152 this->fDisplayStats = !this->fDisplayStats;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 fWindow = Window::CreateNativeWindow(nullptr); 208 fWindow = Window::CreateNativeWindow(nullptr);
205 209
206 // re-register callbacks 210 // re-register callbacks
207 fCommands.attach(fWindow); 211 fCommands.attach(fWindow);
208 fWindow->registerPaintFunc(on_paint_handler, this); 212 fWindow->registerPaintFunc(on_paint_handler, this);
209 fWindow->registerTouchFunc(on_touch_handler, this); 213 fWindow->registerTouchFunc(on_touch_handler, this);
210 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, thi s); 214 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, thi s);
211 } 215 }
212 #endif 216 #endif
213 fWindow->attach(fBackendType, DisplayParams()); 217 fWindow->attach(fBackendType, DisplayParams());
218 #if defined(SK_VULKAN) && defined(SK_BUILD_FOR_UNIX)
219 // Vulkan doesn't seem to handle a single refresh properly on Linux
220 fRefresh = (sk_app::Window::kVulkan_BackendType == fBackendType);
221 #endif
214 222
215 this->updateTitle(); 223 this->updateTitle();
216 fWindow->inval(); 224 fWindow->inval();
217 fWindow->show(); 225 fWindow->show();
218 }); 226 });
219 #endif 227 #endif
220 228
221 // set up slides 229 // set up slides
222 this->initSlides(); 230 this->initSlides();
223 231
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 updateUIState(); 654 updateUIState();
647 } 655 }
648 } else if (stateName.equals(kRefreshStateName)) { 656 } else if (stateName.equals(kRefreshStateName)) {
649 // This state is actually NOT in the UI state. 657 // This state is actually NOT in the UI state.
650 // We use this to allow Android to quickly set bool fRefresh. 658 // We use this to allow Android to quickly set bool fRefresh.
651 fRefresh = stateValue.equals(kON); 659 fRefresh = stateValue.equals(kON);
652 } else { 660 } else {
653 SkDebugf("Unknown stateName: %s", stateName.c_str()); 661 SkDebugf("Unknown stateName: %s", stateName.c_str());
654 } 662 }
655 } 663 }
OLDNEW
« no previous file with comments | « no previous file | tools/viewer/sk_app/VulkanWindowContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698