From 302cffba86a188373c99833d83392f33e6014542 Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Wed, 1 Aug 2012 20:16:34 +0000 Subject: Replace the asAFoo() functions in SkImageFilter with canFilterImageGPU() and onFilterImageGPU() virtuals. This allows each filter to implement its own GPU processing code, even for multi-pass filters. Review URL: http://codereview.appspot.com/6449075/ git-svn-id: http://skia.googlecode.com/svn/trunk@4900 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkImageFilter.h | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'include/core') diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 0915b90714..b16fb0f7a2 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -90,28 +90,21 @@ public: virtual bool asNewCustomStage(GrCustomStage** stage, GrTexture*) const; /** - * Experimental. - * - * If the filter can be expressed as a gaussian-blur, return true and - * set the sigma to the values for horizontal and vertical. - */ - virtual bool asABlur(SkSize* sigma) const; - - /** - * Experimental. - * - * If the filter can be expressed as an erode, return true and - * set the radius in X and Y. + * 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 asNewCustomStage(). + * The default implementation returns false. */ - virtual bool asAnErode(SkISize* radius) const; + virtual bool canFilterImageGPU() const; /** - * Experimental. - * - * If the filter can be expressed as a dilation, return true and - * set the radius in X and Y. + * Process this image filter on the GPU. texture is the source texture + * for processing, and rect is the effect region to process. The + * function must allocate a new texture of at least rect width/height + * size, and return it to the caller. The default implementation returns + * NULL. */ - virtual bool asADilate(SkISize* radius) const; + virtual GrTexture* onFilterImageGPU(GrTexture* texture, const SkRect& rect); protected: SkImageFilter() {} -- cgit v1.2.3