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

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: Protected 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
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..4e21f2280e2d2458251d2253427e6dd3ea4ca695 100644
--- a/tools/viewer/sk_app/Window.h
+++ b/tools/viewer/sk_app/Window.h
@@ -27,7 +27,9 @@ public:
virtual void setTitle(const char*) = 0;
virtual void show() = 0;
- virtual void inval() = 0;
+
+ // Check if the current window has any pending inval; call inval if not.
+ void invalIfNeeded();
djsollen 2016/05/23 16:48:51 if a client should never call anything other than
virtual bool scaleContentToFit() const { return false; }
virtual bool supportsContentRect() const { return false; }
@@ -164,6 +166,16 @@ protected:
void* fPaintUserData;
WindowContext* fWindowContext = nullptr;
+
+ // Make sure that either onPaint or markInvalReceived is called in the subclasses'
+ // implementations of inval. They unset fIsContentInvalided which allow invalIfNeeded
+ // to invalidate the content in the future.
+ virtual void inval() = 0;
+
+ // Uncheck fIsContentInvalided to allow future inval/onInval.
+ void markInvalProcessed();
+
+ bool fIsContentInvalidated = false; // use this to avoid duplicate invalidate events
};
} // namespace sk_app

Powered by Google App Engine
This is Rietveld 408576698