Factory methods for heap-allocated SkImageFilter objects.

This is part of an effort to ensure that all SkPaint effects can only be
allocated on the heap.

This patch makes the constructors of SkImageFilter and its subclasses non-public
and instead provides factory methods for creating these objects on the heap. We
temporarily keep constructor of publicly visible classes public behind a flag.

BUG=skia:2187
R=scroggo@google.com, mtklein@chromium.org, reed@google.com, senorblanco@google.com, senorblanco@chromium.org, bsalomon@google.com, sugoi@chromium.org, zork@chromium.org

Author: dominikg@chromium.org

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

git-svn-id: http://skia.googlecode.com/svn/trunk@13718 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index a10d23e..1eda5dc 100644
--- a/include/effects/SkPictureImageFilter.h
+++ b/include/effects/SkPictureImageFilter.h
@@ -16,13 +16,17 @@
     /**
      *  Refs the passed-in picture.
      */
-    explicit SkPictureImageFilter(SkPicture* picture);
+    static SkPictureImageFilter* Create(SkPicture* picture) {
+        return SkNEW_ARGS(SkPictureImageFilter, (picture));
+    }
 
     /**
-     *  Refs the passed-in picture. rect can be used to crop or expand the destination rect when
+     *  Refs the passed-in picture. cropRect can be used to crop or expand the destination rect when
      *  the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
      */
-    SkPictureImageFilter(SkPicture* picture, const SkRect& rect);
+    static SkPictureImageFilter* Create(SkPicture* picture, const SkRect& cropRect) {
+        return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
 
@@ -39,9 +43,15 @@
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    explicit SkPictureImageFilter(SkPicture* picture);
+    SkPictureImageFilter(SkPicture* picture, const SkRect& cropRect);
+
 private:
     SkPicture* fPicture;
-    SkRect     fRect;
+    SkRect     fCropRect;
     typedef SkImageFilter INHERITED;
 };