| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 * Called with the paint that will be used to draw the specified type. | 51 * Called with the paint that will be used to draw the specified type. |
| 52 * The implementation may modify the paint as they wish (using SkTCopyOnFir
stWrite::writable). | 52 * The implementation may modify the paint as they wish (using SkTCopyOnFir
stWrite::writable). |
| 53 * | 53 * |
| 54 * The result bool is used to determine whether the draw op is to be | 54 * The result bool is used to determine whether the draw op is to be |
| 55 * executed (true) or skipped (false). | 55 * executed (true) or skipped (false). |
| 56 * | 56 * |
| 57 * Note: The base implementation calls onFilter() for top-level/explicit pa
ints only. | 57 * Note: The base implementation calls onFilter() for top-level/explicit pa
ints only. |
| 58 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c
lients may need to | 58 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c
lients may need to |
| 59 * override the relevant methods (i.e. drawPicture, drawTextBlob). | 59 * override the relevant methods (i.e. drawPicture, drawTextBlob). |
| 60 */ | 60 */ |
| 61 virtual bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const
{ | 61 virtual bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const
= 0; |
| 62 if (*paint) { | |
| 63 this->onFilterPaint(paint->writable(), type); | |
| 64 } | |
| 65 return true; | |
| 66 } | |
| 67 | |
| 68 // DEPRECATED - do not use | |
| 69 virtual void onFilterPaint(SkPaint*, Type) const { } | |
| 70 | 62 |
| 71 void onDrawPaint(const SkPaint&) override; | 63 void onDrawPaint(const SkPaint&) override; |
| 72 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; | 64 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
| 73 void onDrawRect(const SkRect&, const SkPaint&) override; | 65 void onDrawRect(const SkRect&, const SkPaint&) override; |
| 74 void onDrawRRect(const SkRRect&, const SkPaint&) override; | 66 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 75 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; | 67 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 76 void onDrawOval(const SkRect&, const SkPaint&) override; | 68 void onDrawOval(const SkRect&, const SkPaint&) override; |
| 77 void onDrawPath(const SkPath&, const SkPaint&) override; | 69 void onDrawPath(const SkPath&, const SkPaint&) override; |
| 78 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; | 70 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
| 79 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 71 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 106 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 98 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 107 const SkPaint& paint) override; | 99 const SkPaint& paint) override; |
| 108 | 100 |
| 109 private: | 101 private: |
| 110 class AutoPaintFilter; | 102 class AutoPaintFilter; |
| 111 | 103 |
| 112 typedef SkNWayCanvas INHERITED; | 104 typedef SkNWayCanvas INHERITED; |
| 113 }; | 105 }; |
| 114 | 106 |
| 115 #endif | 107 #endif |
| OLD | NEW |