OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 The Android Open Source Project | 3 * Copyright 2011 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkDrawLooper_DEFINED | 10 #ifndef SkDrawLooper_DEFINED |
11 #define SkDrawLooper_DEFINED | 11 #define SkDrawLooper_DEFINED |
12 | 12 |
13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
14 | 14 |
15 class SkCanvas; | 15 class SkCanvas; |
16 class SkPaint; | 16 class SkPaint; |
17 struct SkRect; | 17 struct SkRect; |
18 class SkString; | 18 class SkString; |
19 | 19 |
20 /** \class SkDrawLooper | 20 /** \class SkDrawLooper |
21 Subclasses of SkDrawLooper can be attached to a SkPaint. Where they are, | 21 Subclasses of SkDrawLooper can be attached to a SkPaint. Where they are, |
22 and something is drawn to a canvas with that paint, the looper subclass will | 22 and something is drawn to a canvas with that paint, the looper subclass will |
23 be called, allowing it to modify the canvas and/or paint for that draw call. | 23 be called, allowing it to modify the canvas and/or paint for that draw call. |
24 More than that, via the next() method, the looper can modify the draw to be | 24 More than that, via the next() method, the looper can modify the draw to be |
25 invoked multiple times (hence the name loop-er), allow it to perform effects | 25 invoked multiple times (hence the name loop-er), allow it to perform effects |
26 like shadows or frame/fills, that require more than one pass. | 26 like shadows or frame/fills, that require more than one pass. |
27 */ | 27 */ |
28 class SK_API SkDrawLooper : public SkFlattenable { | 28 class SK_API SkDrawLooper : public SkFlattenable { |
| 29 typedef SkFlattenable INHERITED; |
| 30 |
29 public: | 31 public: |
30 SK_DECLARE_INST_COUNT(SkDrawLooper) | 32 SK_DECLARE_INST_COUNT(SkDrawLooper) |
31 | 33 |
32 /** | 34 /** |
33 * Called right before something is being drawn. This will be followed by | 35 * Called right before something is being drawn. This will be followed by |
34 * calls to next() until next() returns false. | 36 * calls to next() until next() returns false. |
35 */ | 37 */ |
36 virtual void init(SkCanvas*) = 0; | 38 virtual void init(SkCanvas*) = 0; |
37 | 39 |
38 /** | 40 /** |
(...skipping 18 matching lines...) Expand all Loading... |
57 * is expected to have the following behavior. Given the parent paint and | 59 * is expected to have the following behavior. Given the parent paint and |
58 * the parent's bounding rect the subclass must fill in and return the | 60 * the parent's bounding rect the subclass must fill in and return the |
59 * storage rect, where the storage rect is with the union of the src rect | 61 * storage rect, where the storage rect is with the union of the src rect |
60 * and the looper's bounding rect. | 62 * and the looper's bounding rect. |
61 */ | 63 */ |
62 virtual bool canComputeFastBounds(const SkPaint& paint); | 64 virtual bool canComputeFastBounds(const SkPaint& paint); |
63 virtual void computeFastBounds(const SkPaint& paint, | 65 virtual void computeFastBounds(const SkPaint& paint, |
64 const SkRect& src, SkRect* dst); | 66 const SkRect& src, SkRect* dst); |
65 | 67 |
66 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 68 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
| 69 SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper) |
67 | 70 |
68 protected: | 71 protected: |
69 SkDrawLooper() {} | 72 SkDrawLooper() {} |
70 SkDrawLooper(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 73 SkDrawLooper(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
71 | |
72 private: | |
73 typedef SkFlattenable INHERITED; | |
74 }; | 74 }; |
75 | 75 |
76 #endif | 76 #endif |
OLD | NEW |