Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: include/effects/SkPictureImageFilter.h

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | include/effects/SkResizeImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkPictureImageFilter.h
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index a10d23eebb2454264552d4c27602563aab5072f1..1eda5dcceb22a35ad34cd5ef629845b072dcb9e9 100644
--- a/include/effects/SkPictureImageFilter.h
+++ b/include/effects/SkPictureImageFilter.h
@@ -16,13 +16,17 @@ public:
/**
* 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 @@ protected:
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;
};
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | include/effects/SkResizeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698