Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: tools/viewer/sk_app/Window.h

Issue 2001153002: Move inval dedup to Window for wider usages. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 onPaint is called in the subclasses' implementations of in val.
33 // We will unset fIsContentInvalided in onPaint, which allows checkAndInval
34 // to invalidate the content after the onPaint.
30 virtual void inval() = 0; 35 virtual void inval() = 0;
31 36
37 // Check if the current window has any pending inval; call inval if not.
38 void checkAndInval();
39
32 virtual bool scaleContentToFit() const { return false; } 40 virtual bool scaleContentToFit() const { return false; }
33 virtual bool supportsContentRect() const { return false; } 41 virtual bool supportsContentRect() const { return false; }
34 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } 42 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); }
35 43
36 enum BackendType { 44 enum BackendType {
37 kNativeGL_BackendType, 45 kNativeGL_BackendType,
38 kVulkan_BackendType, 46 kVulkan_BackendType,
39 47
40 kLast_BackendType = kVulkan_BackendType 48 kLast_BackendType = kVulkan_BackendType
41 }; 49 };
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 OnKeyFunc fKeyFunc; 165 OnKeyFunc fKeyFunc;
158 void* fKeyUserData; 166 void* fKeyUserData;
159 OnMouseFunc fMouseFunc; 167 OnMouseFunc fMouseFunc;
160 void* fMouseUserData; 168 void* fMouseUserData;
161 OnTouchFunc fTouchFunc; 169 OnTouchFunc fTouchFunc;
162 void* fTouchUserData; 170 void* fTouchUserData;
163 OnPaintFunc fPaintFunc; 171 OnPaintFunc fPaintFunc;
164 void* fPaintUserData; 172 void* fPaintUserData;
165 173
166 WindowContext* fWindowContext = nullptr; 174 WindowContext* fWindowContext = nullptr;
175
176 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida te events
177 SkMutex fMutex;
167 }; 178 };
168 179
169 } // namespace sk_app 180 } // namespace sk_app
170 #endif 181 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698