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 #ifndef VulkanViewer_DEFINED | 8 #ifndef VulkanViewer_DEFINED |
9 #define VulkanViewer_DEFINED | 9 #define VulkanViewer_DEFINED |
10 | 10 |
11 #include "../Application.h" | 11 #include "../Application.h" |
12 #include "../Window.h" | 12 #include "../Window.h" |
13 #include "gm.h" | 13 #include "gm.h" |
| 14 #include "SkAnimTimer.h" |
14 #include "Slide.h" | 15 #include "Slide.h" |
15 | 16 |
16 class SkCanvas; | 17 class SkCanvas; |
17 | 18 |
18 class VulkanViewer : public Application { | 19 class VulkanViewer : public Application { |
19 public: | 20 public: |
20 VulkanViewer(int argc, char** argv, void* platformData); | 21 VulkanViewer(int argc, char** argv, void* platformData); |
21 ~VulkanViewer() override; | 22 ~VulkanViewer() override; |
22 | 23 |
23 bool onKey(Window::Key key, Window::InputState state, uint32_t modifiers); | 24 bool onKey(Window::Key key, Window::InputState state, uint32_t modifiers); |
| 25 bool onChar(SkUnichar, uint32_t modifiers); |
24 void onPaint(SkCanvas* canvas); | 26 void onPaint(SkCanvas* canvas); |
25 | |
26 void onIdle(double ms) override; | 27 void onIdle(double ms) override; |
27 | 28 |
28 private: | 29 private: |
29 void initSlides(); | 30 void initSlides(); |
| 31 void setupCurrentSlide(int previousSlide); |
30 | 32 |
31 void drawStats(SkCanvas* canvas); | 33 void drawStats(SkCanvas* canvas); |
32 | 34 |
| 35 void changeZoomLevel(float delta); |
| 36 void updateMatrix(); |
| 37 |
33 Window* fWindow; | 38 Window* fWindow; |
34 | 39 |
35 static const int kMeasurementCount = 64; // should be power of 2 for fast m
od | 40 static const int kMeasurementCount = 64; // should be power of 2 for fast m
od |
36 double fMeasurements[kMeasurementCount]; | 41 double fMeasurements[kMeasurementCount]; |
37 int fCurrentMeasurement; | 42 int fCurrentMeasurement; |
38 | 43 |
| 44 SkAnimTimer fAnimTimer; |
39 SkTArray<sk_sp<Slide>> fSlides; | 45 SkTArray<sk_sp<Slide>> fSlides; |
40 int fCurrentSlide; | 46 int fCurrentSlide; |
| 47 |
| 48 bool fDisplayStats; |
| 49 |
| 50 // transform data |
| 51 SkMatrix fLocalMatrix; |
| 52 SkScalar fZoomCenterX; |
| 53 SkScalar fZoomCenterY; |
| 54 SkScalar fZoomLevel; |
| 55 SkScalar fZoomScale; |
| 56 |
41 }; | 57 }; |
42 | 58 |
43 | 59 |
44 #endif | 60 #endif |
OLD | NEW |