OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2016 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef VulkanViewer_DEFINED | |
9 #define VulkanViewer_DEFINED | |
10 | |
11 #include "../Application.h" | |
12 #include "../Window.h" | |
13 #include "gm.h" | |
14 #include "SkAnimTimer.h" | |
15 #include "Slide.h" | |
16 | |
17 class SkCanvas; | |
18 | |
19 class VulkanViewer : public Application { | |
20 public: | |
21 VulkanViewer(int argc, char** argv, void* platformData); | |
22 ~VulkanViewer() override; | |
23 | |
24 bool onKey(Window::Key key, Window::InputState state, uint32_t modifiers); | |
25 bool onChar(SkUnichar, uint32_t modifiers); | |
26 void onPaint(SkCanvas* canvas); | |
27 void onIdle(double ms) override; | |
28 | |
29 private: | |
30 void initSlides(); | |
31 void setupCurrentSlide(int previousSlide); | |
32 | |
33 void drawStats(SkCanvas* canvas); | |
34 | |
35 void changeZoomLevel(float delta); | |
36 void updateMatrix(); | |
37 | |
38 Window* fWindow; | |
39 | |
40 static const int kMeasurementCount = 64; // should be power of 2 for fast m
od | |
41 double fMeasurements[kMeasurementCount]; | |
42 int fCurrentMeasurement; | |
43 | |
44 SkAnimTimer fAnimTimer; | |
45 SkTArray<sk_sp<Slide>> fSlides; | |
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 | |
57 }; | |
58 | |
59 | |
60 #endif | |
OLD | NEW |