| 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 "SkJSONCPP.h" | 15 #include "SkJSONCPP.h" |
| 16 | 16 |
| 17 class SkCanvas; | 17 class SkCanvas; |
| 18 class SkSurface; |
| 18 | 19 |
| 19 namespace sk_app { | 20 namespace sk_app { |
| 20 | 21 |
| 21 class WindowContext; | 22 class WindowContext; |
| 22 | 23 |
| 23 class Window { | 24 class Window { |
| 24 public: | 25 public: |
| 25 static Window* CreateNativeWindow(void* platformData); | 26 static Window* CreateNativeWindow(void* platformData); |
| 26 | 27 |
| 27 virtual ~Window() {}; | 28 virtual ~Window() {}; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; | 155 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; |
| 155 void onPaint(); | 156 void onPaint(); |
| 156 void onResize(uint32_t width, uint32_t height); | 157 void onResize(uint32_t width, uint32_t height); |
| 157 | 158 |
| 158 uint32_t width() { return fWidth; } | 159 uint32_t width() { return fWidth; } |
| 159 uint32_t height() { return fHeight; } | 160 uint32_t height() { return fHeight; } |
| 160 | 161 |
| 161 virtual const DisplayParams& getDisplayParams(); | 162 virtual const DisplayParams& getDisplayParams(); |
| 162 void setDisplayParams(const DisplayParams& params); | 163 void setDisplayParams(const DisplayParams& params); |
| 163 | 164 |
| 165 // This is just for the sRGB split screen |
| 166 sk_sp<SkSurface> getOffscreenSurface(bool forceSRGB); |
| 167 |
| 164 protected: | 168 protected: |
| 165 Window(); | 169 Window(); |
| 166 | 170 |
| 167 uint32_t fWidth; | 171 uint32_t fWidth; |
| 168 uint32_t fHeight; | 172 uint32_t fHeight; |
| 169 | 173 |
| 170 OnCharFunc fCharFunc; | 174 OnCharFunc fCharFunc; |
| 171 void* fCharUserData; | 175 void* fCharUserData; |
| 172 OnKeyFunc fKeyFunc; | 176 OnKeyFunc fKeyFunc; |
| 173 void* fKeyUserData; | 177 void* fKeyUserData; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 186 virtual void onInval() = 0; | 190 virtual void onInval() = 0; |
| 187 | 191 |
| 188 // Uncheck fIsContentInvalided to allow future inval/onInval. | 192 // Uncheck fIsContentInvalided to allow future inval/onInval. |
| 189 void markInvalProcessed(); | 193 void markInvalProcessed(); |
| 190 | 194 |
| 191 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events | 195 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events |
| 192 }; | 196 }; |
| 193 | 197 |
| 194 } // namespace sk_app | 198 } // namespace sk_app |
| 195 #endif | 199 #endif |
| OLD | NEW |