Chromium Code Reviews| 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 #include "../private/SkMutex.h" | |
| 15 | 16 |
| 16 class SkCanvas; | 17 class SkCanvas; |
| 17 | 18 |
| 18 namespace sk_app { | 19 namespace sk_app { |
| 19 | 20 |
| 20 class WindowContext; | 21 class WindowContext; |
| 21 | 22 |
| 22 class Window { | 23 class Window { |
| 23 public: | 24 public: |
| 24 static Window* CreateNativeWindow(void* platformData); | 25 static Window* CreateNativeWindow(void* platformData); |
| 25 | 26 |
| 26 virtual ~Window() {}; | 27 virtual ~Window() {}; |
| 27 | 28 |
| 28 virtual void setTitle(const char*) = 0; | 29 virtual void setTitle(const char*) = 0; |
| 29 virtual void show() = 0; | 30 virtual void show() = 0; |
| 31 | |
| 32 // Make sure that either onPaint or uncheckInval is called in the subclasses ' implementations | |
| 33 // of inval. They unset fIsContentInvalided which allow checkAndInval to inv alidate the content | |
| 34 // in the future. | |
| 30 virtual void inval() = 0; | 35 virtual void inval() = 0; |
|
djsollen
2016/05/23 15:22:42
make this protected
liyuqian
2016/05/23 15:49:25
Done.
| |
| 31 | 36 |
| 37 // Check if the current window has any pending inval; call inval if not. | |
| 38 void checkAndInval(); | |
| 39 // Uncheck fIsContentInvalided to allow future checkAndInval to push inval e vents. | |
| 40 void uncheckInval(); | |
|
djsollen
2016/05/23 15:22:42
make this protected. I also find this naming confu
liyuqian
2016/05/23 15:49:25
I don't want to change inval's name because it's i
| |
| 41 | |
| 32 virtual bool scaleContentToFit() const { return false; } | 42 virtual bool scaleContentToFit() const { return false; } |
| 33 virtual bool supportsContentRect() const { return false; } | 43 virtual bool supportsContentRect() const { return false; } |
| 34 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } | 44 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } |
| 35 | 45 |
| 36 enum BackendType { | 46 enum BackendType { |
| 37 kNativeGL_BackendType, | 47 kNativeGL_BackendType, |
| 38 kVulkan_BackendType, | 48 kVulkan_BackendType, |
| 39 | 49 |
| 40 kLast_BackendType = kVulkan_BackendType | 50 kLast_BackendType = kVulkan_BackendType |
| 41 }; | 51 }; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 OnKeyFunc fKeyFunc; | 167 OnKeyFunc fKeyFunc; |
| 158 void* fKeyUserData; | 168 void* fKeyUserData; |
| 159 OnMouseFunc fMouseFunc; | 169 OnMouseFunc fMouseFunc; |
| 160 void* fMouseUserData; | 170 void* fMouseUserData; |
| 161 OnTouchFunc fTouchFunc; | 171 OnTouchFunc fTouchFunc; |
| 162 void* fTouchUserData; | 172 void* fTouchUserData; |
| 163 OnPaintFunc fPaintFunc; | 173 OnPaintFunc fPaintFunc; |
| 164 void* fPaintUserData; | 174 void* fPaintUserData; |
| 165 | 175 |
| 166 WindowContext* fWindowContext = nullptr; | 176 WindowContext* fWindowContext = nullptr; |
| 177 | |
| 178 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida te events | |
| 167 }; | 179 }; |
| 168 | 180 |
| 169 } // namespace sk_app | 181 } // namespace sk_app |
| 170 #endif | 182 #endif |
| OLD | NEW |