Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: include/core/SkMaskFilter.h

Issue 109823012: Pass ctm when performing image filtering in GPU backend. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkMaskFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMaskFilter.h
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index f4448ddddb453e9502f075f928303a0c9fb428f0..ce0debd4426f923768cd7dd4e8f835ed91659ca0 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;
« no previous file with comments | « no previous file | src/core/SkMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698