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 "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
14 #include "SkMask.h" | 14 #include "SkMask.h" |
15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
16 | 16 |
17 class GrContext; | 17 class GrContext; |
| 18 class GrPaint; |
18 class SkBitmap; | 19 class SkBitmap; |
19 class SkBlitter; | 20 class SkBlitter; |
20 class SkBounder; | 21 class SkBounder; |
21 class SkMatrix; | 22 class SkMatrix; |
22 class SkPath; | 23 class SkPath; |
23 class SkRasterClip; | 24 class SkRasterClip; |
24 class SkRRect; | 25 class SkRRect; |
| 26 class SkStrokeRec; |
25 | 27 |
26 /** \class SkMaskFilter | 28 /** \class SkMaskFilter |
27 | 29 |
28 SkMaskFilter is the base class for object that perform transformations on | 30 SkMaskFilter is the base class for object that perform transformations on |
29 an alpha-channel mask before drawing it. A subclass of SkMaskFilter may be | 31 an alpha-channel mask before drawing it. A subclass of SkMaskFilter may be |
30 installed into a SkPaint. Once there, each time a primitive is drawn, it | 32 installed into a SkPaint. Once there, each time a primitive is drawn, it |
31 is first scan converted into a SkMask::kA8_Format mask, and handed to the | 33 is first scan converted into a SkMask::kA8_Format mask, and handed to the |
32 filter, calling its filterMask() method. If this returns true, then the | 34 filter, calling its filterMask() method. If this returns true, then the |
33 new mask is used to render into the device. | 35 new mask is used to render into the device. |
34 | 36 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 * passed into 'filterMaskGPU' should have the same extent as 'maskRect' bu
t be translated | 89 * passed into 'filterMaskGPU' should have the same extent as 'maskRect' bu
t be translated |
88 * to the upper-left corner of the mask (i.e., (maskRect.fLeft, maskRect.fT
op) appears at | 90 * to the upper-left corner of the mask (i.e., (maskRect.fLeft, maskRect.fT
op) appears at |
89 * (0, 0) in the mask). | 91 * (0, 0) in the mask). |
90 */ | 92 */ |
91 virtual bool canFilterMaskGPU(const SkRect& devBounds, | 93 virtual bool canFilterMaskGPU(const SkRect& devBounds, |
92 const SkIRect& clipBounds, | 94 const SkIRect& clipBounds, |
93 const SkMatrix& ctm, | 95 const SkMatrix& ctm, |
94 SkRect* maskRect) const; | 96 SkRect* maskRect) const; |
95 | 97 |
96 /** | 98 /** |
| 99 * Try to directly render the mask filter into the target. Returns |
| 100 * true if drawing was successful. |
| 101 */ |
| 102 virtual bool directFilterMaskGPU(GrContext* context, |
| 103 GrPaint* grp, |
| 104 const SkStrokeRec& strokeRec, |
| 105 const SkPath& path) const; |
| 106 |
| 107 /** |
97 * This function is used to implement filters that require an explicit src m
ask. It should only | 108 * This function is used to implement filters that require an explicit src m
ask. It should only |
98 * be called if canFilterMaskGPU returned true and the maskRect param should
be the output from | 109 * be called if canFilterMaskGPU returned true and the maskRect param should
be the output from |
99 * that call. canOverwriteSrc indicates whether the implementation may treat
src as a scratch | 110 * that call. canOverwriteSrc indicates whether the implementation may treat
src as a scratch |
100 * texture and overwrite its contents. When true it is also legal to return
src as the result. | 111 * texture and overwrite its contents. When true it is also legal to return
src as the result. |
101 * Implementations are free to get the GrContext from the src texture in ord
er to create | 112 * Implementations are free to get the GrContext from the src texture in ord
er to create |
102 * additional textures and perform multiple passes. | 113 * additional textures and perform multiple passes. |
103 */ | 114 */ |
104 virtual bool filterMaskGPU(GrTexture* src, | 115 virtual bool filterMaskGPU(GrTexture* src, |
105 const SkMatrix& ctm, | 116 const SkMatrix& ctm, |
106 const SkRect& maskRect, | 117 const SkRect& maskRect, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 to render that mask. Returns false if filterMask() returned false. | 194 to render that mask. Returns false if filterMask() returned false. |
184 */ | 195 */ |
185 bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix, | 196 bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix, |
186 const SkRasterClip&, SkBounder*, SkBlitter* blitter, | 197 const SkRasterClip&, SkBounder*, SkBlitter* blitter, |
187 SkPaint::Style style) const; | 198 SkPaint::Style style) const; |
188 | 199 |
189 typedef SkFlattenable INHERITED; | 200 typedef SkFlattenable INHERITED; |
190 }; | 201 }; |
191 | 202 |
192 #endif | 203 #endif |
OLD | NEW |