aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkMagnifierImageFilter.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/SkMagnifierImageFilter.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/SkMagnifierImageFilter.h')
-rw-r--r--include/effects/SkMagnifierImageFilter.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/effects/SkMagnifierImageFilter.h b/include/effects/SkMagnifierImageFilter.h
index 44f0d0d689..cfe1f09b41 100644
--- a/include/effects/SkMagnifierImageFilter.h
+++ b/include/effects/SkMagnifierImageFilter.h
@@ -14,7 +14,9 @@
class SK_API SkMagnifierImageFilter : public SkImageFilter {
public:
- SkMagnifierImageFilter(SkRect srcRect, SkScalar inset);
+ static SkMagnifierImageFilter* Create(const SkRect& srcRect, SkScalar inset) {
+ return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset));
+ }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
@@ -28,6 +30,11 @@ protected:
virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
#endif
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset);
+
private:
SkRect fSrcRect;
SkScalar fInset;