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

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: inval 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
« no previous file with comments | « no previous file | tools/viewer/sk_app/Window.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 // Check if the current window has any pending inval; call inval if not.
djsollen 2016/05/23 17:06:48 update the comment... // shedules an invalidation
32 void inval();
31 33
32 virtual bool scaleContentToFit() const { return false; } 34 virtual bool scaleContentToFit() const { return false; }
33 virtual bool supportsContentRect() const { return false; } 35 virtual bool supportsContentRect() const { return false; }
34 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } 36 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); }
35 37
36 enum BackendType { 38 enum BackendType {
37 kNativeGL_BackendType, 39 kNativeGL_BackendType,
38 kVulkan_BackendType, 40 kVulkan_BackendType,
39 41
40 kLast_BackendType = kVulkan_BackendType 42 kLast_BackendType = kVulkan_BackendType
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 OnKeyFunc fKeyFunc; 159 OnKeyFunc fKeyFunc;
158 void* fKeyUserData; 160 void* fKeyUserData;
159 OnMouseFunc fMouseFunc; 161 OnMouseFunc fMouseFunc;
160 void* fMouseUserData; 162 void* fMouseUserData;
161 OnTouchFunc fTouchFunc; 163 OnTouchFunc fTouchFunc;
162 void* fTouchUserData; 164 void* fTouchUserData;
163 OnPaintFunc fPaintFunc; 165 OnPaintFunc fPaintFunc;
164 void* fPaintUserData; 166 void* fPaintUserData;
165 167
166 WindowContext* fWindowContext = nullptr; 168 WindowContext* fWindowContext = nullptr;
169
170 // Make sure that either onPaint or markInvalReceived is called in the subcl asses'
djsollen 2016/05/23 17:06:48 I think this comment is outdated. the client wind
liyuqian 2016/05/23 17:29:51 In case that the client window doesn't call onPain
171 // implementations of inval. They unset fIsContentInvalided which allow inva lIfNeeded
172 // to invalidate the content in the future.
173 virtual void onInval() = 0;
174
175 // Uncheck fIsContentInvalided to allow future inval/onInval.
176 void markInvalProcessed();
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
OLDNEW
« no previous file with comments | « no previous file | tools/viewer/sk_app/Window.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698