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 "DisplayParams.h" | 11 #include "DisplayParams.h" |
12 #include "SkRect.h" | 12 #include "SkRect.h" |
13 #include "SkTouchGesture.h" | 13 #include "SkTouchGesture.h" |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 | 15 |
16 class SkCanvas; | 16 class SkCanvas; |
17 | 17 |
18 namespace sk_app { | 18 namespace sk_app { |
19 | 19 |
20 class WindowContext; | 20 class WindowContext; |
21 | 21 |
22 class Window { | 22 class Window { |
23 public: | 23 public: |
24 static Window* CreateNativeWindow(void* platformData); | 24 static Window* CreateNativeWindow(void* platformData); |
25 | 25 |
26 virtual ~Window() {}; | 26 virtual ~Window() {}; |
27 | 27 |
28 virtual void setTitle(const char*) = 0; | 28 virtual void setTitle(const char*) = 0; |
29 virtual void show() = 0; | 29 virtual void show() = 0; |
30 virtual void inval() = 0; | 30 |
| 31 // Shedules an invalidation event for window if one is not currently pending
. |
| 32 // Make sure that either onPaint or markInvalReceived is called when the cli
ent window consumes |
| 33 // the the inval event. They unset fIsContentInvalided which allow future on
Inval. |
| 34 void inval(); |
31 | 35 |
32 virtual bool scaleContentToFit() const { return false; } | 36 virtual bool scaleContentToFit() const { return false; } |
33 virtual bool supportsContentRect() const { return false; } | 37 virtual bool supportsContentRect() const { return false; } |
34 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } | 38 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } |
35 | 39 |
36 enum BackendType { | 40 enum BackendType { |
37 kNativeGL_BackendType, | 41 kNativeGL_BackendType, |
38 kVulkan_BackendType, | 42 kVulkan_BackendType, |
39 | 43 |
40 kLast_BackendType = kVulkan_BackendType | 44 kLast_BackendType = kVulkan_BackendType |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 OnKeyFunc fKeyFunc; | 161 OnKeyFunc fKeyFunc; |
158 void* fKeyUserData; | 162 void* fKeyUserData; |
159 OnMouseFunc fMouseFunc; | 163 OnMouseFunc fMouseFunc; |
160 void* fMouseUserData; | 164 void* fMouseUserData; |
161 OnTouchFunc fTouchFunc; | 165 OnTouchFunc fTouchFunc; |
162 void* fTouchUserData; | 166 void* fTouchUserData; |
163 OnPaintFunc fPaintFunc; | 167 OnPaintFunc fPaintFunc; |
164 void* fPaintUserData; | 168 void* fPaintUserData; |
165 | 169 |
166 WindowContext* fWindowContext = nullptr; | 170 WindowContext* fWindowContext = nullptr; |
| 171 |
| 172 virtual void onInval() = 0; |
| 173 |
| 174 // Uncheck fIsContentInvalided to allow future inval/onInval. |
| 175 void markInvalProcessed(); |
| 176 |
| 177 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events |
167 }; | 178 }; |
168 | 179 |
169 } // namespace sk_app | 180 } // namespace sk_app |
170 #endif | 181 #endif |
OLD | NEW |