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

Unified 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: Comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/sk_app/CommandSet.cpp ('k') | tools/viewer/sk_app/Window.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/Window.h
diff --git a/tools/viewer/sk_app/Window.h b/tools/viewer/sk_app/Window.h
index 63d5e19e5594716c9bc95742b0fac51fe8b9af75..4db907e765655db81885ac8650827423b946af58 100644
--- a/tools/viewer/sk_app/Window.h
+++ b/tools/viewer/sk_app/Window.h
@@ -12,6 +12,7 @@
#include "SkRect.h"
#include "SkTouchGesture.h"
#include "SkTypes.h"
+#include "../private/SkMutex.h"
class SkCanvas;
@@ -27,8 +28,17 @@ public:
virtual void setTitle(const char*) = 0;
virtual void show() = 0;
+
+ // Make sure that either onPaint or uncheckInval is called in the subclasses' implementations
+ // of inval. They unset fIsContentInvalided which allow checkAndInval to invalidate the content
+ // in the future.
virtual void inval() = 0;
djsollen 2016/05/23 15:22:42 make this protected
liyuqian 2016/05/23 15:49:25 Done.
+ // Check if the current window has any pending inval; call inval if not.
+ void checkAndInval();
+ // Uncheck fIsContentInvalided to allow future checkAndInval to push inval events.
+ 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
+
virtual bool scaleContentToFit() const { return false; }
virtual bool supportsContentRect() const { return false; }
virtual SkRect getContentRect() { return SkRect::MakeEmpty(); }
@@ -164,6 +174,8 @@ protected:
void* fPaintUserData;
WindowContext* fWindowContext = nullptr;
+
+ bool fIsContentInvalidated = false; // use this to avoid duplicate invalidate events
};
} // namespace sk_app
« no previous file with comments | « tools/viewer/sk_app/CommandSet.cpp ('k') | tools/viewer/sk_app/Window.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698