Chromium Code Reviews| Index: include/core/SkMaskFilter.h |
| diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h |
| index f4448ddddb453e9502f075f928303a0c9fb428f0..1b2c3e49fb5d4b56df43895a628a3845c7344f58 100644 |
| --- a/include/core/SkMaskFilter.h |
| +++ b/include/core/SkMaskFilter.h |
| @@ -63,25 +63,30 @@ public: |
| #if SK_SUPPORT_GPU |
| /** |
| - * Returns true if the filter can be expressed a single-pass |
| - * GrEffect, used to process this filter on the GPU, or false if |
| - * not. |
| + * Returns true if the filter can be expressed a single-pass GrEffect without requiring an |
|
robertphillips
2014/01/08 20:15:18
receives?
bsalomon
2014/01/08 21:38:36
Done.
|
| + * explicit input mask. Per-pixel, the effect recieves the incoming mask's coverage as |
|
robertphillips
2014/01/08 20:15:18
coverage?
remove "as its output"?
bsalomon
2014/01/08 21:38:36
Done.
|
| + * the input color and outputs the filtered covereage value as its output. This means that each |
| + * pixel's filtered coverage must only depend on the unfiltered mask value for that pixel |
| + * and not on surrounding values. |
| * |
| - * If effect is non-NULL, a new GrEffect instance is stored |
| - * in it. The caller assumes ownership of the stage, and it is up to the |
| - * caller to unref it. |
| + * If effect is non-NULL, a new GrEffect instance is stored in it. The caller assumes ownership |
| + * of the effect and must unref it. |
| */ |
| - virtual bool asNewEffect(GrEffectRef** effect, GrTexture*) const; |
| + virtual bool asNewEffect(GrEffectRef** effect, |
| + GrTexture*, |
| + const SkMatrix& ctm) const; |
| /** |
| - * Returns true if the filter can be processed on the GPU. This is most |
| - * often used for multi-pass effects, where intermediate results must be |
| - * rendered to textures. For single-pass effects, use asNewEffect(). |
| + * If asNewEffect() fails the filter may be implemented on the GPU by a subclass overriding |
| + * filterMaskGPU (declared below). That code path requires constructing a src mask as input. |
| + * Since that is a potentially expensive operation, the subclass must also override this |
| + * function to indicate whether filterTextureMaskGPU would succeeed if the mask were to be |
| + * created. |
| * |
| - * 'maskRect' returns the device space portion of the mask the the filter |
| - * needs. The mask passed into 'filterMaskGPU' should have the same extent |
| - * as 'maskRect' but be translated to the upper-left corner of the mask |
| - * (i.e., (maskRect.fLeft, maskRect.fTop) appears at (0, 0) in the mask). |
| + * 'maskRect' returns the device space portion of the mask that the filter needs. The mask |
| + * passed into 'filterMaskGPU' should have the same extent as 'maskRect' but be translated |
| + * to the upper-left corner of the mask (i.e., (maskRect.fLeft, maskRect.fTop) appears at |
| + * (0, 0) in the mask). |
| */ |
| virtual bool canFilterMaskGPU(const SkRect& devBounds, |
| const SkIRect& clipBounds, |
| @@ -89,24 +94,15 @@ public: |
| SkRect* maskRect) const; |
| /** |
| - * Perform this mask filter on the GPU. This is most often used for |
| - * multi-pass effects, where intermediate results must be rendered to |
| - * textures. For single-pass effects, use asNewEffect(). 'src' is the |
| - * source image for processing, as a texture-backed bitmap. 'result' is |
| - * the destination bitmap, which should contain a texture-backed pixelref |
| - * on success. 'maskRect' should be the rect returned from canFilterMaskGPU. |
| - */ |
| - bool filterMaskGPU(GrContext* context, |
| - const SkBitmap& src, |
| - const SkRect& maskRect, |
| - SkBitmap* result) const; |
| - |
| - /** |
| - * This flavor of 'filterMaskGPU' provides a more direct means of accessing |
| - * the filtering capabilities. Setting 'canOverwriteSrc' can allow some |
| - * filters to skip the allocation of an additional texture. |
| + * This function is used to implement filters that require an explicit src mask. It should only |
| + * be called if canFilterMaskGPU returned true and the maskRect param should be the output from |
| + * that call. canOverwriteSrc indicates whether the implementation may treat src as a scratch |
| + * texture and overwrite its contents. When true it is also legal to return src as the result. |
| + * Implementations are free to get the GrContext from the src texture in order to create |
| + * additional textures and perform multiple passes. |
| */ |
| virtual bool filterMaskGPU(GrTexture* src, |
|
robertphillips
2014/01/08 20:15:18
I wonder if "maskRect" should go second. It seems
bsalomon
2014/01/08 21:38:36
I did it that way to match canFilterMaskGPU()
|
| + const SkMatrix& ctm, |
| const SkRect& maskRect, |
| GrTexture** result, |
| bool canOverwriteSrc) const; |