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

Unified Diff: include/utils/SkPaintFilterCanvas.h

Issue 1577933002: SkPaintFilterCanvas skip-draw support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: cleanup Created 4 years, 11 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 | « no previous file | samplecode/SampleApp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkPaintFilterCanvas.h
diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h
index 0ad7e251b6e54759a850a9c6c04fbbba4d7362db..f2bfaa70e1c54b41bb93a41ff9fba12b9fa444e1 100644
--- a/include/utils/SkPaintFilterCanvas.h
+++ b/include/utils/SkPaintFilterCanvas.h
@@ -48,13 +48,24 @@ public:
protected:
/**
* Called with the paint that will be used to draw the specified type.
- * The implementation may modify the paint as they wish.
+ * If not null, the implementation may modify the paint as they wish.
*
- * Note: The base implementation calls onFilterPaint() for top-level/explicit paints only.
+ * The result bool is used to determine whether the draw op is to be
+ * executed (true) or skipped (false).
+ *
+ * Note: The base implementation calls onFilter() for top-level/explicit paints only.
* To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), clients may need to
* override the relevant methods (i.e. drawPicture, drawTextBlob).
*/
- virtual void onFilterPaint(SkPaint* paint, Type type) const = 0;
+ virtual bool onFilter(SkPaint* paint, Type type) const {
+ if (paint) {
f(malita) 2016/01/11 19:29:44 Legacy/transient semantics. To be converted to a
+ this->onFilterPaint(paint, type);
+ }
+ return true;
+ }
+
+ // DEPRECATED - do not use
+ virtual void onFilterPaint(SkPaint*, Type) const { }
void onDrawPaint(const SkPaint&) override;
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
« no previous file with comments | « no previous file | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698