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

Unified Diff: include/effects/SkMorphologyImageFilter.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/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkMorphologyImageFilter.h
diff --git a/include/effects/SkMorphologyImageFilter.h b/include/effects/SkMorphologyImageFilter.h
index 4d60180aeb67b834a00dc927a1058312056943b0..edf1040fd39723ee396ab8f5c2804474e6ed280f 100644
--- a/include/effects/SkMorphologyImageFilter.h
+++ b/include/effects/SkMorphologyImageFilter.h
@@ -15,7 +15,6 @@
class SK_API SkMorphologyImageFilter : public SkImageFilter {
public:
- SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect);
virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
@@ -30,6 +29,8 @@ public:
int width, int height, int srcStride, int dstStride);
protected:
+ SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input,
+ const CropRect* cropRect);
bool filterImageGeneric(Proc procX, Proc procY,
Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const;
@@ -51,10 +52,11 @@ private:
class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
public:
- SkDilateImageFilter(int radiusX, int radiusY,
- SkImageFilter* input = NULL,
- const CropRect* cropRect = NULL)
- : INHERITED(radiusX, radiusY, input, cropRect) {}
+ static SkDilateImageFilter* Create(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL) {
+ return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRect));
+ }
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
@@ -68,16 +70,25 @@ public:
protected:
SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkDilateImageFilter(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL)
+ : INHERITED(radiusX, radiusY, input, cropRect) {}
+
private:
typedef SkMorphologyImageFilter INHERITED;
};
class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
public:
- SkErodeImageFilter(int radiusX, int radiusY,
- SkImageFilter* input = NULL,
- const CropRect* cropRect = NULL)
- : INHERITED(radiusX, radiusY, input, cropRect) {}
+ static SkErodeImageFilter* Create(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL) {
+ return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect));
+ }
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
@@ -91,6 +102,14 @@ public:
protected:
SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkErodeImageFilter(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL)
+ : INHERITED(radiusX, radiusY, input, cropRect) {}
+
private:
typedef SkMorphologyImageFilter INHERITED;
};
« no previous file with comments | « include/effects/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698