aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-08 22:25:53 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-08 22:25:53 +0000
commit41bf930039314cc71039b12957195f1c65c30ce1 (patch)
tree8c3014a907eefb9c6968bfdaff18bed82f01203d /include
parentf1901788d8753332c5748a30e8d14e290c155bd1 (diff)
Rename GPU functions on SkBlurMaskFilter and pass ctm.
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/109823012 git-svn-id: http://skia.googlecode.com/svn/trunk@12978 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkMaskFilter.h56
1 files changed, 26 insertions, 30 deletions
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index f4448ddddb..ce0debd442 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
+ * explicit input mask. Per-pixel, the effect receives the incoming mask's coverage as
+ * the input color and outputs the filtered covereage value. 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,
+ const SkMatrix& ctm,
const SkRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const;