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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | samplecode/SampleApp.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 2015 Google Inc. 2 * Copyright 2015 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 SkPaintFilterCanvas_DEFINED 8 #ifndef SkPaintFilterCanvas_DEFINED
9 #define SkPaintFilterCanvas_DEFINED 9 #define SkPaintFilterCanvas_DEFINED
10 10
(...skipping 30 matching lines...) Expand all
41 kTextBlob_Type, 41 kTextBlob_Type,
42 kVertices_Type, 42 kVertices_Type,
43 kPatch_Type, 43 kPatch_Type,
44 44
45 kTypeCount 45 kTypeCount
46 }; 46 };
47 47
48 protected: 48 protected:
49 /** 49 /**
50 * Called with the paint that will be used to draw the specified type. 50 * Called with the paint that will be used to draw the specified type.
51 * The implementation may modify the paint as they wish. 51 * If not null, the implementation may modify the paint as they wish.
52 * 52 *
53 * Note: The base implementation calls onFilterPaint() for top-level/explic it paints only. 53 * The result bool is used to determine whether the draw op is to be
54 * executed (true) or skipped (false).
55 *
56 * Note: The base implementation calls onFilter() for top-level/explicit pa ints only.
54 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c lients may need to 57 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c lients may need to
55 * override the relevant methods (i.e. drawPicture, drawTextBlob). 58 * override the relevant methods (i.e. drawPicture, drawTextBlob).
56 */ 59 */
57 virtual void onFilterPaint(SkPaint* paint, Type type) const = 0; 60 virtual bool onFilter(SkPaint* paint, Type type) const {
61 if (paint) {
f(malita) 2016/01/11 19:29:44 Legacy/transient semantics. To be converted to a
62 this->onFilterPaint(paint, type);
63 }
64 return true;
65 }
66
67 // DEPRECATED - do not use
68 virtual void onFilterPaint(SkPaint*, Type) const { }
58 69
59 void onDrawPaint(const SkPaint&) override; 70 void onDrawPaint(const SkPaint&) override;
60 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override; 71 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override;
61 void onDrawRect(const SkRect&, const SkPaint&) override; 72 void onDrawRect(const SkRect&, const SkPaint&) override;
62 void onDrawRRect(const SkRRect&, const SkPaint&) override; 73 void onDrawRRect(const SkRRect&, const SkPaint&) override;
63 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 74 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
64 void onDrawOval(const SkRect&, const SkPaint&) override; 75 void onDrawOval(const SkRect&, const SkPaint&) override;
65 void onDrawPath(const SkPath&, const SkPaint&) override; 76 void onDrawPath(const SkPath&, const SkPaint&) override;
66 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override; 77 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override;
67 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 78 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
(...skipping 24 matching lines...) Expand all
92 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 103 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
93 const SkPaint& paint) override; 104 const SkPaint& paint) override;
94 105
95 private: 106 private:
96 class AutoPaintFilter; 107 class AutoPaintFilter;
97 108
98 typedef SkNWayCanvas INHERITED; 109 typedef SkNWayCanvas INHERITED;
99 }; 110 };
100 111
101 #endif 112 #endif
OLDNEW
« 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