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

Side by Side Diff: tools/vulkan/viewer/VulkanViewer.cpp

Issue 1876853003: Fix to zoom on Vulkan Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | no next file » | 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 "VulkanViewer.h" 8 #include "VulkanViewer.h"
9 9
10 #include "GMSlide.h" 10 #include "GMSlide.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 "^ requires the start of the bench to match\n" 48 "^ requires the start of the bench to match\n"
49 "$ requires the end of the bench to match\n" 49 "$ requires the end of the bench to match\n"
50 "^ and $ requires an exact match\n" 50 "^ and $ requires an exact match\n"
51 "If a bench does not match any list entry,\n" 51 "If a bench does not match any list entry,\n"
52 "it is skipped unless some list entry starts with ~"); 52 "it is skipped unless some list entry starts with ~");
53 DEFINE_string(skps, "skps", "Directory to read skps from."); 53 DEFINE_string(skps, "skps", "Directory to read skps from.");
54 54
55 VulkanViewer::VulkanViewer(int argc, char** argv, void* platformData) 55 VulkanViewer::VulkanViewer(int argc, char** argv, void* platformData)
56 : fCurrentMeasurement(0) 56 : fCurrentMeasurement(0)
57 , fDisplayStats(false) 57 , fDisplayStats(false)
58 , fZoomCenterX(0.0f)
59 , fZoomCenterY(0.0f)
60 , fZoomLevel(0.0f)
61 , fZoomScale(SK_Scalar1)
58 { 62 {
59 memset(fMeasurements, 0, sizeof(fMeasurements)); 63 memset(fMeasurements, 0, sizeof(fMeasurements));
60 64
61 SkDebugf("Command line arguments: "); 65 SkDebugf("Command line arguments: ");
62 for (int i = 1; i < argc; ++i) { 66 for (int i = 1; i < argc; ++i) {
63 SkDebugf("%s ", argv[i]); 67 SkDebugf("%s ", argv[i]);
64 } 68 }
65 SkDebugf("\n"); 69 SkDebugf("\n");
66 70
67 SkCommandLineFlags::Parse(argc, argv); 71 SkCommandLineFlags::Parse(argc, argv);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 218 }
215 SkString title("VulkanViewer: "); 219 SkString title("VulkanViewer: ");
216 title.append(fSlides[fCurrentSlide]->getName()); 220 title.append(fSlides[fCurrentSlide]->getName());
217 fWindow->setTitle(title.c_str()); 221 fWindow->setTitle(title.c_str());
218 setupCurrentSlide(previousSlide); 222 setupCurrentSlide(previousSlide);
219 return true; 223 return true;
220 } 224 }
221 225
222 case Window::kUp_Key: { 226 case Window::kUp_Key: {
223 this->changeZoomLevel(1.f / 32.f); 227 this->changeZoomLevel(1.f / 32.f);
228 fWindow->inval();
224 return true; 229 return true;
225 } 230 }
226 231
227 case Window::kDown_Key: { 232 case Window::kDown_Key: {
228 this->changeZoomLevel(-1.f / 32.f); 233 this->changeZoomLevel(-1.f / 32.f);
234 fWindow->inval();
229 return true; 235 return true;
230 } 236 }
231 237
232 default: 238 default:
233 break; 239 break;
234 } 240 }
235 } 241 }
236 242
237 return false; 243 return false;
238 } 244 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // Record measurements 313 // Record measurements
308 fMeasurements[fCurrentMeasurement++] = ms; 314 fMeasurements[fCurrentMeasurement++] = ms;
309 fCurrentMeasurement &= (kMeasurementCount - 1); // fast mod 315 fCurrentMeasurement &= (kMeasurementCount - 1); // fast mod
310 SkASSERT(fCurrentMeasurement < kMeasurementCount); 316 SkASSERT(fCurrentMeasurement < kMeasurementCount);
311 317
312 fAnimTimer.updateTime(); 318 fAnimTimer.updateTime();
313 if (fDisplayStats || fSlides[fCurrentSlide]->animate(fAnimTimer)) { 319 if (fDisplayStats || fSlides[fCurrentSlide]->animate(fAnimTimer)) {
314 fWindow->inval(); 320 fWindow->inval();
315 } 321 }
316 } 322 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698