From 76d4d04b18a773061559533a3b774a82ddc94d0f Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Thu, 23 Jan 2014 18:45:23 +0000 Subject: Refactor SkMorphologyImageFilter, CPU and GPU paths. This required making opts/ dependent on effects/, so that we could use the SkMorphologyProc type in SkMorphologyImageFilter.h. Correctness and performance covered by existing tests; no change in functionality. R=bsalomon@google.com, djsollen@google.com, reed@google.com Review URL: https://codereview.chromium.org/135013004 git-svn-id: http://skia.googlecode.com/svn/trunk@13154 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/effects/SkMorphologyImageFilter.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/effects/SkMorphologyImageFilter.h b/include/effects/SkMorphologyImageFilter.h index 880fc2ec2c..3a55199939 100644 --- a/include/effects/SkMorphologyImageFilter.h +++ b/include/effects/SkMorphologyImageFilter.h @@ -9,6 +9,7 @@ #ifndef SkMorphologyImageFilter_DEFINED #define SkMorphologyImageFilter_DEFINED +#include "SkColor.h" #include "SkImageFilter.h" #include "SkSize.h" @@ -16,11 +17,27 @@ class SK_API SkMorphologyImageFilter : public SkImageFilter { public: SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect); + /** + * All morphology procs have the same signature: src is the source buffer, dst the + * destination buffer, radius is the morphology radius, width and height are the bounds + * of the destination buffer (in pixels), and srcStride and dstStride are the + * number of pixels per row in each buffer. All buffers are 8888. + */ + + typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius, + int width, int height, int srcStride, int dstStride); + protected: + bool filterImageGeneric(Proc procX, Proc procY, + Proxy*, const SkBitmap& src, const SkMatrix&, + SkBitmap* result, SkIPoint* offset); SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; #if SK_SUPPORT_GPU virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } + bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, + const SkMatrix& ctm, SkBitmap* result, + SkIPoint* offset); #endif SkISize radius() const { return fRadius; } -- cgit v1.2.3