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