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 Window_DEFINED | 8 #ifndef Window_DEFINED |
9 #define Window_DEFINED | 9 #define Window_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 class SkCanvas; | 13 class SkCanvas; |
14 class VulkanTestContext; | 14 class VulkanTestContext; |
15 | 15 |
16 class Window { | 16 class Window { |
17 public: | 17 public: |
18 static Window* CreateNativeWindow(void* platformData); | 18 static Window* CreateNativeWindow(void* platformData); |
19 | 19 |
20 virtual ~Window() {}; | 20 virtual ~Window() {}; |
21 | 21 |
22 virtual void setTitle(const char*) = 0; | 22 virtual void setTitle(const char*) = 0; |
23 virtual void show() = 0; | 23 virtual void show() = 0; |
| 24 virtual void inval() = 0; |
24 | 25 |
25 struct AttachmentInfo { | 26 struct AttachmentInfo { |
26 int fSampleCount; | 27 int fSampleCount; |
27 int fStencilBits; | 28 int fStencilBits; |
28 }; | 29 }; |
29 | 30 |
30 enum BackEndType { | 31 enum BackEndType { |
31 kNativeGL_BackendType, | 32 kNativeGL_BackendType, |
32 kVulkan_BackendType | 33 kVulkan_BackendType |
33 }; | 34 }; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 fPaintFunc = func; | 116 fPaintFunc = func; |
116 fPaintUserData = userData; | 117 fPaintUserData = userData; |
117 } | 118 } |
118 | 119 |
119 bool onChar(SkUnichar c, uint32_t modifiers); | 120 bool onChar(SkUnichar c, uint32_t modifiers); |
120 bool onKey(Key key, InputState state, uint32_t modifiers); | 121 bool onKey(Key key, InputState state, uint32_t modifiers); |
121 bool onMouse(int x, int y, InputState state, uint32_t modifiers); | 122 bool onMouse(int x, int y, InputState state, uint32_t modifiers); |
122 void onPaint(); | 123 void onPaint(); |
123 void onResize(uint32_t width, uint32_t height); | 124 void onResize(uint32_t width, uint32_t height); |
124 | 125 |
| 126 uint32_t width() { return fWidth; } |
| 127 uint32_t height() { return fHeight; } |
| 128 |
125 protected: | 129 protected: |
126 Window(); | 130 Window(); |
127 | 131 |
| 132 uint32_t fWidth; |
| 133 uint32_t fHeight; |
| 134 |
128 OnCharFunc fCharFunc; | 135 OnCharFunc fCharFunc; |
129 void* fCharUserData; | 136 void* fCharUserData; |
130 OnKeyFunc fKeyFunc; | 137 OnKeyFunc fKeyFunc; |
131 void* fKeyUserData; | 138 void* fKeyUserData; |
132 OnMouseFunc fMouseFunc; | 139 OnMouseFunc fMouseFunc; |
133 void* fMouseUserData; | 140 void* fMouseUserData; |
134 OnPaintFunc fPaintFunc; | 141 OnPaintFunc fPaintFunc; |
135 void* fPaintUserData; | 142 void* fPaintUserData; |
136 | 143 |
137 VulkanTestContext* fTestContext; | 144 VulkanTestContext* fTestContext; |
138 }; | 145 }; |
139 | 146 |
140 | 147 |
141 #endif | 148 #endif |
OLD | NEW |