aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkTileImageFilter.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-10 10:51:58 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-10 10:51:58 +0000
commitcac5fd597f6e2495f50aaa6bcbe3dadc56f0b977 (patch)
treeaeeee764feb84da585a469d005bfaf0e4a69bc13 /include/effects/SkTileImageFilter.h
parentb471a32460a44043e1f00d28cbefc87579dc30c5 (diff)
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
Diffstat (limited to 'include/effects/SkTileImageFilter.h')
-rw-r--r--include/effects/SkTileImageFilter.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/effects/SkTileImageFilter.h b/include/effects/SkTileImageFilter.h
index 390e00c9a4..4bc2a20091 100644
--- a/include/effects/SkTileImageFilter.h
+++ b/include/effects/SkTileImageFilter.h
@@ -14,13 +14,15 @@ class SK_API SkTileImageFilter : public SkImageFilter {
typedef SkImageFilter INHERITED;
public:
- /** Tile image filter constructor
+ /** Create a tile image filter
@param srcRect Defines the pixels to tile
@param dstRect Defines the pixels where tiles are drawn
@param input Input from which the subregion defined by srcRect will be tiled
*/
- SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
- : INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
+ static SkTileImageFilter* Create(const SkRect& srcRect, const SkRect& dstRect,
+ SkImageFilter* input) {
+ return SkNEW_ARGS(SkTileImageFilter, (srcRect, dstRect, input));
+ }
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
@@ -32,6 +34,12 @@ protected:
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
+ : INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
+
private:
SkRect fSrcRect;
SkRect fDstRect;