Implement crop rect support for SkMatrixConvolutionImageFilter.

R=bsalomon@google.com

Review URL: https://codereview.chromium.org/27471002

git-svn-id: http://skia.googlecode.com/svn/trunk@11863 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/effects/SkMatrixConvolutionImageFilter.h b/include/effects/SkMatrixConvolutionImageFilter.h
index b2602fe..d3cf8e3 100644
--- a/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/include/effects/SkMatrixConvolutionImageFilter.h
@@ -47,9 +47,18 @@
                            alpha is copied from the source image.
         @param input       The input image filter.  If NULL, the src bitmap
                            passed to filterImage() is used instead.
+        @param cropRect    The rectangle to which the output processing will be limited.
     */
 
-    SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* kernel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, bool convolveAlpha, SkImageFilter* input = NULL);
+    SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
+                                   const SkScalar* kernel,
+                                   SkScalar gain,
+                                   SkScalar bias,
+                                   const SkIPoint& target,
+                                   TileMode tileMode,
+                                   bool convolveAlpha,
+                                   SkImageFilter* input = NULL,
+                                   const CropRect* cropRect = NULL);
     virtual ~SkMatrixConvolutionImageFilter();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
@@ -62,7 +71,10 @@
                                SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
 
 #if SK_SUPPORT_GPU
-    virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix& matrix) const SK_OVERRIDE;
+    virtual bool asNewEffect(GrEffectRef** effect,
+                             GrTexture*,
+                             const SkMatrix& matrix,
+                             const SkIRect& bounds) const SK_OVERRIDE;
 #endif
 
 private:
@@ -76,11 +88,23 @@
     typedef SkImageFilter INHERITED;
 
     template <class PixelFetcher, bool convolveAlpha>
-    void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
+    void filterPixels(const SkBitmap& src,
+                      SkBitmap* result,
+                      const SkIRect& rect,
+                      const SkIRect& bounds);
     template <class PixelFetcher>
-    void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
-    void filterInteriorPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
-    void filterBorderPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
+    void filterPixels(const SkBitmap& src,
+                      SkBitmap* result,
+                      const SkIRect& rect,
+                      const SkIRect& bounds);
+    void filterInteriorPixels(const SkBitmap& src,
+                              SkBitmap* result,
+                              const SkIRect& rect,
+                              const SkIRect& bounds);
+    void filterBorderPixels(const SkBitmap& src,
+                            SkBitmap* result,
+                            const SkIRect& rect,
+                            const SkIRect& bounds);
 };
 
 #endif