Implement an SkPicture image filter source. This is required for the external-SVG reference feature of feImage. It simply plays back an SkPicture to a given destination rect.

R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk/include@12661 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/effects/SkPictureImageFilter.h b/effects/SkPictureImageFilter.h
new file mode 100644
index 0000000..98d72d9
--- /dev/null
+++ b/effects/SkPictureImageFilter.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2013 The Android Open Source Project
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPictureImageFilter_DEFINED
+#define SkPictureImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkPicture.h"
+
+class SK_API SkPictureImageFilter : public SkImageFilter {
+public:
+    /**
+     *  Refs the passed-in picture.
+     */
+    explicit SkPictureImageFilter(SkPicture* picture);
+
+    /**
+     *  Refs the passed-in picture. rect 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);
+
+    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
+
+protected:
+    virtual ~SkPictureImageFilter();
+    explicit SkPictureImageFilter(SkFlattenableReadBuffer& buffer);
+    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+                               SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
+
+private:
+    SkPicture* fPicture;
+    SkRect     fRect;
+    typedef SkImageFilter INHERITED;
+};
+
+#endif