Clean up SkImageFilter constructors.
authorsenorblanco <senorblanco@chromium.org>
Tue, 8 Jul 2014 16:16:22 +0000 (09:16 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 8 Jul 2014 16:16:22 +0000 (09:16 -0700)
Now that all creation of SkImageFilters goes through
factory Create() methods, there's no real reason for the
convenience constructors. Some SkImageFilter subclasses
which actually have zero DAG-able inputs were passing NULL
to the superclass constructor. This actually means 1 input,
with a NULL value, not zero inputs. This becomes more
relevant for the upcoming cache infrastructure, where this
indicates that the filter will use its src input, where in
fact some of these filters do not (they are image generators
only).

Limiting SkImageFilter to a single constructor resolves this
ambiguity.

Along the way, I removed all of the default parameters to
the constructors, since the Create methods always call them
with the full argument list.

BUG=skia:
R=reed@google.com

Author: senorblanco@chromium.org

Review URL: https://codereview.chromium.org/376953003

31 files changed:
gm/imagefiltersbase.cpp
gm/imagefiltersgraph.cpp
include/core/SkImageFilter.h
include/effects/SkAlphaThresholdFilter.h
include/effects/SkColorFilterImageFilter.h
include/effects/SkComposeImageFilter.h
include/effects/SkDisplacementMapEffect.h
include/effects/SkLightingImageFilter.h
include/effects/SkMagnifierImageFilter.h
include/effects/SkMatrixImageFilter.h
include/effects/SkMergeImageFilter.h
include/effects/SkMorphologyImageFilter.h
include/effects/SkTestImageFilters.h
include/effects/SkTileImageFilter.h
include/effects/SkXfermodeImageFilter.h
src/core/SkImageFilter.cpp
src/effects/SkAlphaThresholdFilter.cpp
src/effects/SkBlurImageFilter.cpp
src/effects/SkColorFilterImageFilter.cpp
src/effects/SkDisplacementMapEffect.cpp
src/effects/SkDropShadowImageFilter.cpp
src/effects/SkLightingImageFilter.cpp
src/effects/SkMagnifierImageFilter.cpp
src/effects/SkMatrixConvolutionImageFilter.cpp
src/effects/SkMatrixImageFilter.cpp
src/effects/SkMergeImageFilter.cpp
src/effects/SkMorphologyImageFilter.cpp
src/effects/SkOffsetImageFilter.cpp
src/effects/SkRectShaderImageFilter.cpp
src/effects/SkXfermodeImageFilter.cpp
tests/ImageFilterTest.cpp

index 4779c81438ee226cb5f19d57ba32377907340b9b..0760fcda760e1cbf8a6024040d3b0ec440a6539e 100644 (file)
@@ -24,14 +24,14 @@ public:
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
 protected:
-    FailImageFilter() : INHERITED(0) {}
+    FailImageFilter() : INHERITED(0, NULL) {}
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE {
         return false;
     }
 
     FailImageFilter(SkReadBuffer& buffer)
-      : INHERITED(1, buffer) {}
+      : INHERITED(0, buffer) {}
 
 private:
     typedef SkImageFilter INHERITED;
@@ -44,13 +44,13 @@ static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter",
 
 class IdentityImageFilter : public SkImageFilter {
 public:
-    static IdentityImageFilter* Create() {
-        return SkNEW(IdentityImageFilter);
+    static IdentityImageFilter* Create(SkImageFilter* input = NULL) {
+        return SkNEW_ARGS(IdentityImageFilter, (input));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
 protected:
-    IdentityImageFilter() : INHERITED(0) {}
+    IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {}
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE {
         *result = src;
index ec6559ffa3dcc8125a38992f155e756143d86918..af3ebb7bc15efeecc755e904dcb41fc2e8c1a0a9 100644 (file)
@@ -71,7 +71,7 @@ protected:
 
 private:
     SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input)
-    : SkImageFilter(input), fDX(dx), fDY(dy) {}
+    : SkImageFilter(1, &input), fDX(dx), fDY(dy) {}
 
     SkScalar fDX, fDY;
 };
index 012a7f728fee1329230f3fdc9c660931144c3465..a571184aa21bb66c4bc38b4b2eeca942245e4931 100644 (file)
@@ -201,12 +201,6 @@ public:
 protected:
     SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL);
 
-    // Convenience constructor for 1-input filters.
-    explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL);
-
-    // Convenience constructor for 2-input filters.
-    SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect = NULL);
-
     virtual ~SkImageFilter();
 
     /**
index 23af56fc549aea172698b58096ebb4a35f3cb590..f409ee08c46d3a7d6c7be18ccefa8db04080601e 100644 (file)
@@ -20,7 +20,8 @@ public:
      * The 0,0 point of the region corresponds to the upper left corner of the
      * source image.
      */
-    static SkImageFilter* Create(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold);
+    static SkImageFilter* Create(const SkRegion& region, SkScalar innerThreshold,
+                                 SkScalar outerThreshold, SkImageFilter* input = NULL);
 };
 
 #endif
index 6c88361b5857f97053bfbe7dc12dc2369680b65f..b915e8835786088c9b7bf9a8bb0aec5944b2cd4c 100644 (file)
@@ -33,7 +33,7 @@ protected:
 private:
     SkColorFilterImageFilter(SkColorFilter* cf,
                              SkImageFilter* input,
-                             const CropRect* cropRect = NULL);
+                             const CropRect* cropRect);
     SkColorFilter*  fColorFilter;
 
     typedef SkImageFilter INHERITED;
index 32304b964636c6e6a250de96203490d6ea5b8121..068bcab7b86e16b06ebd348c3c88ec675f6130a2 100644 (file)
@@ -15,13 +15,14 @@ public:
     virtual ~SkComposeImageFilter();
 
     static SkComposeImageFilter* Create(SkImageFilter* outer, SkImageFilter* inner) {
-        return SkNEW_ARGS(SkComposeImageFilter, (outer, inner));
+        SkImageFilter* inputs[2] = { outer, inner };
+        return SkNEW_ARGS(SkComposeImageFilter, (inputs));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
 
 protected:
-    SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
+    explicit SkComposeImageFilter(SkImageFilter* inputs[2]) : INHERITED(2, inputs) {}
     explicit SkComposeImageFilter(SkReadBuffer& buffer);
 
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
index 4d64aaeb41d3f19f437f6af88c6bde0c013e95ee..07f8ee9e85efe05c57e71d0b99c54a4c194706ea 100644 (file)
@@ -28,8 +28,9 @@ public:
                                            SkScalar scale, SkImageFilter* displacement,
                                            SkImageFilter* color = NULL,
                                            const CropRect* cropRect = NULL) {
+        SkImageFilter* inputs[2] = { displacement, color };
         return SkNEW_ARGS(SkDisplacementMapEffect, (xChannelSelector, yChannelSelector, scale,
-                                                    displacement, color, cropRect));
+                                                    inputs, cropRect));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
@@ -53,9 +54,8 @@ public:
 protected:
     SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
                             ChannelSelectorType yChannelSelector,
-                            SkScalar scale, SkImageFilter* displacement,
-                            SkImageFilter* color = NULL,
-                            const CropRect* cropRect = NULL);
+                            SkScalar scale, SkImageFilter* inputs[2],
+                            const CropRect* cropRect);
     explicit SkDisplacementMapEffect(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index 4a76a9cd7e8744ae4810c67dfb56136544720311..81e8f43f11e5360c6710e2c301d483ca2922d0f4 100644 (file)
@@ -73,7 +73,7 @@ protected:
     SkLightingImageFilter(SkLight* light,
                           SkScalar surfaceScale,
                           SkImageFilter* input,
-                          const CropRect* cropRect = NULL);
+                          const CropRect* cropRect);
     explicit SkLightingImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
     const SkLight* light() const { return fLight; }
index b992e282b60b6d459f39e37b457333d9b3ab6c60..3f799d6555f41914dde7f765bb971682f17fb0cf 100644 (file)
 
 class SK_API SkMagnifierImageFilter : public SkImageFilter {
 public:
-    static SkMagnifierImageFilter* Create(const SkRect& srcRect, SkScalar inset) {
-        return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset));
+    static SkMagnifierImageFilter* Create(const SkRect& srcRect, SkScalar inset,
+                                          SkImageFilter* input = NULL) {
+        return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset, input));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
 
 protected:
-    SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset);
+    SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset, SkImageFilter* input);
     explicit SkMagnifierImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index 004c6ef9ed00bf9480b5d3fafd380702f0d40ccb..14b0b8e153ac76bd8ce51ad4a9f4db2eb68c163b 100644 (file)
@@ -40,7 +40,7 @@ public:
 protected:
     SkMatrixImageFilter(const SkMatrix& transform,
                         SkPaint::FilterLevel,
-                        SkImageFilter* input = NULL);
+                        SkImageFilter* input);
     SkMatrixImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index 3ac4aaa6c3d9353ad888c0c2f05a61baa2628927..ed316d78538e18b879876dbb7dea9a226bb63cd5 100644 (file)
@@ -19,7 +19,9 @@ public:
     static SkMergeImageFilter* Create(SkImageFilter* first, SkImageFilter* second,
                                       SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
                                       const CropRect* cropRect = NULL) {
-        return SkNEW_ARGS(SkMergeImageFilter, (first, second, mode, cropRect));
+        SkImageFilter* inputs[2] = { first, second };
+        SkXfermode::Mode modes[2] = { mode, mode };
+        return SkNEW_ARGS(SkMergeImageFilter, (inputs, 2, modes, cropRect));
     }
     static SkMergeImageFilter* Create(SkImageFilter* filters[], int count,
                                       const SkXfermode::Mode modes[] = NULL,
@@ -30,12 +32,9 @@ public:
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
 
 protected:
-    SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
-                       SkXfermode::Mode = SkXfermode::kSrcOver_Mode,
-                       const CropRect* cropRect = NULL);
     SkMergeImageFilter(SkImageFilter* filters[], int count,
-                       const SkXfermode::Mode modes[] = NULL,
-                       const CropRect* cropRect = NULL);
+                       const SkXfermode::Mode modes[],
+                       const CropRect* cropRect);
     explicit SkMergeImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index a464da3d3b0a0adf71780b22dc24057e8673aed9..75551b6d8a5bc4265ecf2cec9ec73c98f3408f6b 100644 (file)
@@ -68,9 +68,7 @@ public:
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
 
 protected:
-    SkDilateImageFilter(int radiusX, int radiusY,
-                        SkImageFilter* input = NULL,
-                        const CropRect* cropRect = NULL)
+    SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect)
         : INHERITED(radiusX, radiusY, input, cropRect) {}
     explicit SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
@@ -96,9 +94,7 @@ public:
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
 
 protected:
-    SkErodeImageFilter(int radiusX, int radiusY,
-                       SkImageFilter* input = NULL,
-                       const CropRect* cropRect = NULL)
+    SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect)
         : INHERITED(radiusX, radiusY, input, cropRect) {}
     explicit SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
index 4b20936c3bf39e28bc4bbce80e6116fe65fd31ea..28360403715abb9fe55d0d7b827e0ca547e5858b 100644 (file)
@@ -7,14 +7,15 @@
 // Fun mode that scales down (only) and then scales back up to look pixelated
 class SK_API SkDownSampleImageFilter : public SkImageFilter {
 public:
-    static SkDownSampleImageFilter* Create(SkScalar scale) {
-        return SkNEW_ARGS(SkDownSampleImageFilter, (scale));
+    static SkDownSampleImageFilter* Create(SkScalar scale, SkImageFilter* input = NULL) {
+        return SkNEW_ARGS(SkDownSampleImageFilter, (scale, input));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
 
 protected:
-    SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {}
+    SkDownSampleImageFilter(SkScalar scale, SkImageFilter* input)
+      : INHERITED(1, &input), fScale(scale) {}
     SkDownSampleImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index 01d6c64641bd64ba8f79b028862222ed1392cc8c..29e3ca571ff6a16b5aa221afc5a418b50bc470d2 100644 (file)
@@ -33,7 +33,7 @@ public:
 
 protected:
     SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
-        : INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
+        : INHERITED(1, &input), fSrcRect(srcRect), fDstRect(dstRect) {}
     explicit SkTileImageFilter(SkReadBuffer& buffer);
 
     virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
index a5404f91c584737a4137df68f843da82b58977a1..05f96c49112760dc94a2626464a1975dc5be72f4 100644 (file)
@@ -26,7 +26,8 @@ public:
     static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* background,
                                          SkImageFilter* foreground = NULL,
                                          const CropRect* cropRect = NULL) {
-        return SkNEW_ARGS(SkXfermodeImageFilter, (mode, background, foreground, cropRect));
+        SkImageFilter* inputs[2] = { background, foreground };
+        return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect));
     }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
@@ -43,8 +44,8 @@ public:
 #endif
 
 protected:
-    SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* background,
-                          SkImageFilter* foreground, const CropRect* cropRect);
+    SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2],
+                          const CropRect* cropRect);
     explicit SkXfermodeImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
index dfe74cb74bd280273464c47abee9b89dbeef3742..6240902e1b268361107691c918748ae6839faa51 100644 (file)
@@ -32,23 +32,6 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
     }
 }
 
-SkImageFilter::SkImageFilter(SkImageFilter* input, const CropRect* cropRect)
-  : fInputCount(1),
-    fInputs(new SkImageFilter*[1]),
-    fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
-    fInputs[0] = input;
-    SkSafeRef(fInputs[0]);
-}
-
-SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect)
-  : fInputCount(2), fInputs(new SkImageFilter*[2]),
-    fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
-    fInputs[0] = input1;
-    fInputs[1] = input2;
-    SkSafeRef(fInputs[0]);
-    SkSafeRef(fInputs[1]);
-}
-
 SkImageFilter::~SkImageFilter() {
     for (int i = 0; i < fInputCount; i++) {
         SkSafeUnref(fInputs[i]);
index b375c88c11d8b2f2cade918941ea39fcbc083cc6..a77891a38526b889edc1dab23a699192cb4d2b9e 100644 (file)
@@ -13,7 +13,8 @@
 
 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
 public:
-    SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold);
+    SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
+                               SkScalar outerThreshold, SkImageFilter* input);
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
 
@@ -37,8 +38,9 @@ private:
 
 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
                                               SkScalar innerThreshold,
-                                              SkScalar outerThreshold) {
-    return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outerThreshold));
+                                              SkScalar outerThreshold,
+                                              SkImageFilter* input) {
+    return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outerThreshold, input));
 }
 
 #if SK_SUPPORT_GPU
@@ -239,8 +241,9 @@ SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer)
 
 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
                                                        SkScalar innerThreshold,
-                                                       SkScalar outerThreshold)
-    : INHERITED(0)
+                                                       SkScalar outerThreshold,
+                                                       SkImageFilter* input)
+    : INHERITED(1, &input)
     , fRegion(region)
     , fInnerThreshold(innerThreshold)
     , fOuterThreshold(outerThreshold) {
index 470dcac3c851e913dbc753727c15a42561af7dd5..5c3ff493c27ebae1eee6ed1c301e7280b8dd8a63 100644 (file)
@@ -37,7 +37,7 @@ SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX,
                                      SkScalar sigmaY,
                                      SkImageFilter* input,
                                      const CropRect* cropRect)
-    : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) {
+    : INHERITED(1, &input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) {
     SkASSERT(sigmaX >= 0 && sigmaY >= 0);
 }
 
index f2490e32735819356d32d0aa8799c342c746b3df..2c3706769fa400a91e8ffdf3aa9a1e03c097e2e1 100755 (executable)
@@ -78,7 +78,7 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf,
 
 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
         SkImageFilter* input, const CropRect* cropRect)
-    : INHERITED(input, cropRect), fColorFilter(cf) {
+    : INHERITED(1, &input, cropRect), fColorFilter(cf) {
     SkASSERT(cf);
     SkSafeRef(cf);
 }
index 44c3908779a5e9fa7b16b44512f78a6a3f255422..28a4ab395a54ef7ae3e72ffd504907554f0dacfd 100644 (file)
@@ -161,10 +161,9 @@ bool channel_selector_type_is_valid(SkDisplacementMapEffect::ChannelSelectorType
 SkDisplacementMapEffect::SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
                                                  ChannelSelectorType yChannelSelector,
                                                  SkScalar scale,
-                                                 SkImageFilter* displacement,
-                                                 SkImageFilter* color,
+                                                 SkImageFilter* inputs[2],
                                                  const CropRect* cropRect)
-  : INHERITED(displacement, color, cropRect)
+  : INHERITED(2, inputs, cropRect)
   , fXChannelSelector(xChannelSelector)
   , fYChannelSelector(yChannelSelector)
   , fScale(scale)
index 032acec8c6c69dbce70e2ce5cec9a388b65fb676..c79cf0bcd39bf580930a19a35266dbfa0a90b096 100644 (file)
@@ -17,7 +17,7 @@
 
 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma,
                                                  SkColor color, SkImageFilter* input)
-    : INHERITED(input)
+    : INHERITED(1, &input)
     , fDx(dx)
     , fDy(dy)
     , fSigmaX(sigma)
@@ -29,7 +29,7 @@ SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkSca
 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy,
                                                  SkScalar sigmaX, SkScalar sigmaY, SkColor color,
                                                  SkImageFilter* input, const CropRect* cropRect)
-    : INHERITED(input, cropRect)
+    : INHERITED(1, &input, cropRect)
     , fDx(dx)
     , fDy(dy)
     , fSigmaX(sigmaX)
index 5fc3474e3d35c1a5c433278fdc83572dabb1feb4..54bfc0408a527aa117eb5127196e881a742e930e 100644 (file)
@@ -827,8 +827,9 @@ void SkLight::flattenLight(SkWriteBuffer& buffer) const {
 }
 ///////////////////////////////////////////////////////////////////////////////
 
-SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkImageFilter* input, const CropRect* cropRect)
-  : INHERITED(input, cropRect),
+SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceScale,
+                                             SkImageFilter* input, const CropRect* cropRect)
+  : INHERITED(1, &input, cropRect),
     fLight(light),
     fSurfaceScale(SkScalarDiv(surfaceScale, SkIntToScalar(255)))
 {
index 16f4066d3add1f1a6a8285f4d0fd621d99ee8a08..a8556d1384d07567796a85d87848768705eebcf6 100644 (file)
@@ -245,9 +245,9 @@ SkMagnifierImageFilter::SkMagnifierImageFilter(SkReadBuffer& buffer)
                     (fSrcRect.fLeft >= 0) && (fSrcRect.fTop >= 0));
 }
 
-// FIXME:  implement single-input semantics
-SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset)
-    : INHERITED(0), fSrcRect(srcRect), fInset(inset) {
+SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset,
+                                               SkImageFilter* input)
+    : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) {
     SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0);
 }
 
index 2740edc3eff0bff1a0f57d9659ea6e78f466c1a2..684281a1174eba89e9b9c460c9ca358cbc1652a9 100644 (file)
@@ -43,7 +43,7 @@ SkMatrixConvolutionImageFilter::SkMatrixConvolutionImageFilter(
     bool convolveAlpha,
     SkImageFilter* input,
     const CropRect* cropRect)
-  : INHERITED(input, cropRect),
+  : INHERITED(1, &input, cropRect),
     fKernelSize(kernelSize),
     fGain(gain),
     fBias(bias),
index 55179d3565cd7d97cab3bca711551474831af07a..c7c815a761dec37b3acb782bba71220ee4a69352 100644 (file)
@@ -18,7 +18,7 @@
 SkMatrixImageFilter::SkMatrixImageFilter(const SkMatrix& transform,
                                          SkPaint::FilterLevel filterLevel,
                                          SkImageFilter* input)
-  : INHERITED(input),
+  : INHERITED(1, &input),
     fTransform(transform),
     fFilterLevel(filterLevel) {
 }
index adf9afe9b3dd100d5c276f509931b74857ab22ed..4022da3096d4c49a9696991b9c0a6172c32c42c6 100755 (executable)
@@ -40,17 +40,6 @@ void SkMergeImageFilter::initModes(const SkXfermode::Mode modes[]) {
     }
 }
 
-SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
-                                       SkXfermode::Mode mode,
-                                       const CropRect* cropRect) : INHERITED(first, second, cropRect) {
-    if (SkXfermode::kSrcOver_Mode != mode) {
-        SkXfermode::Mode modes[] = { mode, mode };
-        this->initModes(modes);
-    } else {
-        fModes = NULL;
-    }
-}
-
 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
                                        const SkXfermode::Mode modes[],
                                        const CropRect* cropRect) : INHERITED(count, filters, cropRect) {
index 8de8ddaf68c1c4cb0e39c73b3c6d3e819579b4be..a18388e09666dea03619d361efa29b11b15f909d 100644 (file)
@@ -32,7 +32,7 @@ SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX,
                                                  int radiusY,
                                                  SkImageFilter* input,
                                                  const CropRect* cropRect)
-    : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) {
+    : INHERITED(1, &input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) {
 }
 
 
index 7680c62cfc948738b9f8e9dea124ef07666f50d7..57f36db113ca066c6bcb00019c17eb53076659a6 100644 (file)
@@ -97,7 +97,8 @@ void SkOffsetImageFilter::flatten(SkWriteBuffer& buffer) const {
 }
 
 SkOffsetImageFilter::SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input,
-                                         const CropRect* cropRect) : INHERITED(input, cropRect) {
+                                         const CropRect* cropRect)
+  : INHERITED(1, &input, cropRect) {
     fOffset.set(dx, dy);
 }
 
index bed017c32607c4bfbb71349de56e27bf6f6cbf01..6961facc10b4ef359ca1ccb0eba958b8b01a21c7 100644 (file)
@@ -29,14 +29,14 @@ SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const Crop
 }
 
 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect)
-  : INHERITED(NULL, cropRect)
+  : INHERITED(0, NULL, cropRect)
   , fShader(s) {
     SkASSERT(s);
     s->ref();
 }
 
 SkRectShaderImageFilter::SkRectShaderImageFilter(SkReadBuffer& buffer)
-  : INHERITED(1, buffer) {
+  : INHERITED(0, buffer) {
     fShader = buffer.readShader();
 }
 
index acb8fd381b88cf9c3f89c3a7e045c5879206a869..bcfb78576e3fa647a2de241ad75c54b301ebb565 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode,
-                                             SkImageFilter* background,
-                                             SkImageFilter* foreground,
+                                             SkImageFilter* inputs[2],
                                              const CropRect* cropRect)
-  : INHERITED(background, foreground, cropRect), fMode(mode) {
+  : INHERITED(2, inputs, cropRect), fMode(mode) {
     SkSafeRef(fMode);
 }
 
index d6af24453b26a2c545566cc513417e11fa01b382..20899f4ee99c1b26bf25be32055081c1f178f4f4 100644 (file)
@@ -44,7 +44,7 @@ namespace {
 class MatrixTestImageFilter : public SkImageFilter {
 public:
     MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix)
-      : SkImageFilter(0), fReporter(reporter), fExpectedMatrix(expectedMatrix) {
+      : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMatrix) {
     }
 
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx,
@@ -56,7 +56,7 @@ public:
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
 
 protected:
-    explicit MatrixTestImageFilter(SkReadBuffer& buffer) : SkImageFilter(0) {
+    explicit MatrixTestImageFilter(SkReadBuffer& buffer) : SkImageFilter(0, NULL) {
         fReporter = static_cast<skiatest::Reporter*>(buffer.readFunctionPtr());
         buffer.readMatrix(&fExpectedMatrix);
     }