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

Unified Diff: include/effects/SkMatrixConvolutionImageFilter.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/SkMagnifierImageFilter.h ('k') | include/effects/SkMergeImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkMatrixConvolutionImageFilter.h
diff --git a/include/effects/SkMatrixConvolutionImageFilter.h b/include/effects/SkMatrixConvolutionImageFilter.h
index 59af83e025275ed29b934fa624151481602f784a..524d05d9cabe113648313f1e978c9e8234aba0b4 100644
--- a/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/include/effects/SkMatrixConvolutionImageFilter.h
@@ -28,38 +28,42 @@ public:
kClampToBlack_TileMode, /*!< Fill with transparent black. */
};
+ virtual ~SkMatrixConvolutionImageFilter();
+
/** Construct a matrix convolution image filter.
- @param kernelSize The kernel size in pixels, in each dimension (N by M).
- @param kernel The image processing kernel. Must contain N * M
- elements, in row order.
- @param gain A scale factor applied to each pixel after
- convolution. This can be used to normalize the
- kernel, if it does not sum to 1.
- @param bias A bias factor added to each pixel after convolution.
- @param target An offset applied to each pixel coordinate before
- convolution. This can be used to center the kernel
- over the image (e.g., a 3x3 kernel should have a
- target of {1, 1}).
- @param tileMode How accesses outside the image are treated. (@see
- TileMode).
+ @param kernelSize The kernel size in pixels, in each dimension (N by M).
+ @param kernel The image processing kernel. Must contain N * M
+ elements, in row order.
+ @param gain A scale factor applied to each pixel after
+ convolution. This can be used to normalize the
+ kernel, if it does not sum to 1.
+ @param bias A bias factor added to each pixel after convolution.
+ @param kernelOffset An offset applied to each pixel coordinate before
+ convolution. This can be used to center the kernel
+ over the image (e.g., a 3x3 kernel should have an
+ offset of {1, 1}).
+ @param tileMode How accesses outside the image are treated. (@see
+ TileMode).
@param convolveAlpha If true, all channels are convolved. If false,
- only the RGB channels are convolved, and
- alpha is copied from the source image.
- @param input The input image filter. If NULL, the src bitmap
- passed to filterImage() is used instead.
- @param cropRect The rectangle to which the output processing will be limited.
+ only the RGB channels are convolved, and
+ alpha is copied from the source image.
+ @param input The input image filter. If NULL, the src bitmap
+ passed to filterImage() is used instead.
+ @param cropRect The rectangle to which the output processing will be limited.
*/
-
- SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
- const SkScalar* kernel,
- SkScalar gain,
- SkScalar bias,
- const SkIPoint& target,
- TileMode tileMode,
- bool convolveAlpha,
- SkImageFilter* input = NULL,
- const CropRect* cropRect = NULL);
- virtual ~SkMatrixConvolutionImageFilter();
+ static SkMatrixConvolutionImageFilter* Create(const SkISize& kernelSize,
+ const SkScalar* kernel,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ TileMode tileMode,
+ bool convolveAlpha,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL) {
+ return SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias,
+ kernelOffset, tileMode, convolveAlpha,
+ input, cropRect));
+ }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
@@ -77,12 +81,25 @@ protected:
const SkIRect& bounds) const SK_OVERRIDE;
#endif
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
+ const SkScalar* kernel,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ TileMode tileMode,
+ bool convolveAlpha,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL);
+
private:
SkISize fKernelSize;
SkScalar* fKernel;
SkScalar fGain;
SkScalar fBias;
- SkIPoint fTarget;
+ SkIPoint fKernelOffset;
TileMode fTileMode;
bool fConvolveAlpha;
typedef SkImageFilter INHERITED;
« no previous file with comments | « include/effects/SkMagnifierImageFilter.h ('k') | include/effects/SkMergeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698