OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 SkMaskFilter_DEFINED | 10 #ifndef SkMaskFilter_DEFINED |
11 #define SkMaskFilter_DEFINED | 11 #define SkMaskFilter_DEFINED |
12 | 12 |
| 13 #include "SkBlurTypes.h" |
13 #include "SkFlattenable.h" | 14 #include "SkFlattenable.h" |
14 #include "SkMask.h" | 15 #include "SkMask.h" |
15 #include "SkPaint.h" | 16 #include "SkPaint.h" |
16 | 17 |
17 class GrContext; | 18 class GrContext; |
18 class GrPaint; | 19 class GrPaint; |
19 class SkBitmap; | 20 class SkBitmap; |
20 class SkBlitter; | 21 class SkBlitter; |
21 class SkBounder; | 22 class SkBounder; |
22 class SkMatrix; | 23 class SkMatrix; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 * paint as its src param and the filter adjust those bounds using its | 132 * paint as its src param and the filter adjust those bounds using its |
132 * current mask and returns the result using the dest param. Callers are | 133 * current mask and returns the result using the dest param. Callers are |
133 * allowed to provide the same struct for both src and dest so each | 134 * allowed to provide the same struct for both src and dest so each |
134 * implementation must accomodate that behavior. | 135 * implementation must accomodate that behavior. |
135 * | 136 * |
136 * The default impl calls filterMask with the src mask having no image, | 137 * The default impl calls filterMask with the src mask having no image, |
137 * but subclasses may override this if they can compute the rect faster. | 138 * but subclasses may override this if they can compute the rect faster. |
138 */ | 139 */ |
139 virtual void computeFastBounds(const SkRect& src, SkRect* dest) const; | 140 virtual void computeFastBounds(const SkRect& src, SkRect* dest) const; |
140 | 141 |
| 142 struct BlurRec { |
| 143 SkScalar fSigma; |
| 144 SkBlurStyle fStyle; |
| 145 SkBlurQuality fQuality; |
| 146 }; |
| 147 /** |
| 148 * If this filter can be represented by a BlurRec, return true and (if not
null) fill in the |
| 149 * provided BlurRec parameter. If this effect cannot be represented as a Bl
urRec, return false |
| 150 * and ignore the BlurRec parameter. |
| 151 */ |
| 152 virtual bool asABlur(BlurRec*) const; |
| 153 |
141 SK_TO_STRING_PUREVIRT() | 154 SK_TO_STRING_PUREVIRT() |
142 SK_DEFINE_FLATTENABLE_TYPE(SkMaskFilter) | 155 SK_DEFINE_FLATTENABLE_TYPE(SkMaskFilter) |
143 | 156 |
144 protected: | 157 protected: |
145 SkMaskFilter() {} | 158 SkMaskFilter() {} |
146 // empty for now, but lets get our subclass to remember to init us for the f
uture | 159 // empty for now, but lets get our subclass to remember to init us for the f
uture |
147 SkMaskFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} | 160 SkMaskFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} |
148 | 161 |
149 enum FilterReturn { | 162 enum FilterReturn { |
150 kFalse_FilterReturn, | 163 kFalse_FilterReturn, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 to render that mask. Returns false if filterMask() returned false. | 214 to render that mask. Returns false if filterMask() returned false. |
202 */ | 215 */ |
203 bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix, | 216 bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix, |
204 const SkRasterClip&, SkBounder*, SkBlitter* blitter, | 217 const SkRasterClip&, SkBounder*, SkBlitter* blitter, |
205 SkPaint::Style style) const; | 218 SkPaint::Style style) const; |
206 | 219 |
207 typedef SkFlattenable INHERITED; | 220 typedef SkFlattenable INHERITED; |
208 }; | 221 }; |
209 | 222 |
210 #endif | 223 #endif |
OLD | NEW |