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 #include "SkPoint.h" | |
15 #include "SkColor.h" | |
14 | 16 |
15 class SkCanvas; | 17 class SkCanvas; |
16 class SkPaint; | 18 class SkPaint; |
17 struct SkRect; | 19 struct SkRect; |
18 class SkString; | 20 class SkString; |
19 | 21 |
20 /** \class SkDrawLooper | 22 /** \class SkDrawLooper |
21 Subclasses of SkDrawLooper can be attached to a SkPaint. Where they are, | 23 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 | 24 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. | 25 be called, allowing it to modify the canvas and/or paint for that draw call. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 * returns false then computeFastBounds behavior is undefined otherwise it | 83 * returns false then computeFastBounds behavior is undefined otherwise it |
82 * is expected to have the following behavior. Given the parent paint and | 84 * is expected to have the following behavior. Given the parent paint and |
83 * the parent's bounding rect the subclass must fill in and return the | 85 * the parent's bounding rect the subclass must fill in and return the |
84 * storage rect, where the storage rect is with the union of the src rect | 86 * storage rect, where the storage rect is with the union of the src rect |
85 * and the looper's bounding rect. | 87 * and the looper's bounding rect. |
86 */ | 88 */ |
87 virtual bool canComputeFastBounds(const SkPaint& paint) const; | 89 virtual bool canComputeFastBounds(const SkPaint& paint) const; |
88 virtual void computeFastBounds(const SkPaint& paint, | 90 virtual void computeFastBounds(const SkPaint& paint, |
89 const SkRect& src, SkRect* dst) const; | 91 const SkRect& src, SkRect* dst) const; |
90 | 92 |
93 struct BlurShadowRec { | |
94 SkScalar fRadius; | |
djsollen
2014/04/28 13:55:40
As we discussed offline, I think this should retur
| |
95 SkVector fOffset; | |
96 SkColor fColor; | |
97 }; | |
98 /** | |
99 * If this looper can be interpreted as having two layers, such that | |
100 * 1. The first layer (bottom most) just has a color, blur, and transla te | |
101 * 2. The second layer has no modifications to either paint or canvas | |
102 * 3. No other layers. | |
103 * then return true, and if not null, fill out the BlurShadowRec). | |
104 * | |
105 * If any of the above are not met, return false and ignore the BlurShadowR ec parameter. | |
106 */ | |
107 virtual bool asABlurShadow(BlurShadowRec*) const; | |
scroggo
2014/04/28 13:28:06
Does this need to be on the base class? It seems v
djsollen
2014/04/28 13:55:40
It does need to be on the base class since it allo
| |
108 | |
91 SK_TO_STRING_PUREVIRT() | 109 SK_TO_STRING_PUREVIRT() |
92 SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper) | 110 SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper) |
93 | 111 |
94 protected: | 112 protected: |
95 SkDrawLooper() {} | 113 SkDrawLooper() {} |
96 SkDrawLooper(SkReadBuffer& buffer) : INHERITED(buffer) {} | 114 SkDrawLooper(SkReadBuffer& buffer) : INHERITED(buffer) {} |
97 | 115 |
98 private: | 116 private: |
99 typedef SkFlattenable INHERITED; | 117 typedef SkFlattenable INHERITED; |
100 }; | 118 }; |
101 | 119 |
102 #endif | 120 #endif |
OLD | NEW |