| 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 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 * filtered coverage must only depend on the unfiltered mask value for that
pixel and not on | 71 * filtered coverage must only depend on the unfiltered mask value for that
pixel and not on |
| 72 * surrounding values. | 72 * surrounding values. |
| 73 * | 73 * |
| 74 * If effect is non-NULL, a new GrProcessor instance is stored in it. The ca
ller assumes | 74 * If effect is non-NULL, a new GrProcessor instance is stored in it. The ca
ller assumes |
| 75 * ownership of the effect and must unref it. | 75 * ownership of the effect and must unref it. |
| 76 */ | 76 */ |
| 77 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix& ctm) const; | 77 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix& ctm) const; |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * If asFragmentProcessor() fails the filter may be implemented on the GPU
by a subclass | 80 * If asFragmentProcessor() fails the filter may be implemented on the GPU
by a subclass |
| 81 * overriding filterMaskGPU (declared below). That code path requires const
ructing a src mask | 81 * overriding filterMaskGPU (declared below). That code path requires const
ructing a |
| 82 * as input. Since that is a potentially expensive operation, the subclass
must also override | 82 * src mask as input. Since that is a potentially expensive operation, the
subclass must also |
| 83 * this function to indicate whether filterTextureMaskGPU would succeeed if
the mask were to be | 83 * override this function to indicate whether filterTextureMaskGPU would su
cceeed if the mask |
| 84 * created. | 84 * were to be created. |
| 85 * | 85 * |
| 86 * 'maskRect' returns the device space portion of the mask that the filter
needs. The mask | 86 * 'maskRect' returns the device space portion of the mask that the filter
needs. The mask |
| 87 * 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 |
| 88 * to the upper-left corner of the mask (i.e., (maskRect.fLeft, maskRect.fT
op) appears at | 88 * translated to the upper-left corner of the mask (i.e., (maskRect.fLeft,
maskRect.fTop) |
| 89 * (0, 0) in the mask). | 89 * appears at (0, 0) in the mask). |
| 90 * |
| 91 * Logically, how this works is: |
| 92 * canFilterMaskGPU is called |
| 93 * if (it returns true) |
| 94 * the returned mask rect is used for quick rejecting |
| 95 * either directFilterMaskGPU or directFilterRRectMaskGPU is then cal
led |
| 96 * if (neither of them handle the blur) |
| 97 * the mask rect is used to generate the mask |
| 98 * filterMaskGPU is called to filter the mask |
| 99 * |
| 100 * TODO: this should work as: |
| 101 * if (canFilterMaskGPU(devShape, ...)) // rect, rrect, drrect, path |
| 102 * filterMaskGPU(devShape, ...) |
| 103 * this would hide the RRect special case and the mask generation |
| 90 */ | 104 */ |
| 91 virtual bool canFilterMaskGPU(const SkRect& devBounds, | 105 virtual bool canFilterMaskGPU(const SkRRect& devRRect, |
| 92 const SkIRect& clipBounds, | 106 const SkIRect& clipBounds, |
| 93 const SkMatrix& ctm, | 107 const SkMatrix& ctm, |
| 94 SkRect* maskRect) const; | 108 SkRect* maskRect) const; |
| 95 | 109 |
| 96 /** | 110 /** |
| 97 * Try to directly render the mask filter into the target. Returns | 111 * Try to directly render the mask filter into the target. Returns |
| 98 * true if drawing was successful. | 112 * true if drawing was successful. |
| 99 */ | 113 */ |
| 100 virtual bool directFilterMaskGPU(GrTextureProvider* texProvider, | 114 virtual bool directFilterMaskGPU(GrTextureProvider* texProvider, |
| 101 GrDrawContext* drawContext, | 115 GrDrawContext* drawContext, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 mask and then call filterMask(). If this returns true, the specified blitte
r will be called | 238 mask and then call filterMask(). If this returns true, the specified blitte
r will be called |
| 225 to render that mask. Returns false if filterMask() returned false. | 239 to render that mask. Returns false if filterMask() returned false. |
| 226 */ | 240 */ |
| 227 bool filterRRect(const SkRRect& devRRect, const SkMatrix& ctm, const SkRaste
rClip&, | 241 bool filterRRect(const SkRRect& devRRect, const SkMatrix& ctm, const SkRaste
rClip&, |
| 228 SkBlitter*, SkPaint::Style style) const; | 242 SkBlitter*, SkPaint::Style style) const; |
| 229 | 243 |
| 230 typedef SkFlattenable INHERITED; | 244 typedef SkFlattenable INHERITED; |
| 231 }; | 245 }; |
| 232 | 246 |
| 233 #endif | 247 #endif |
| OLD | NEW |