Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |