Add toString methods to SkImageFilter-derived classes
authorrobertphillips <robertphillips@google.com>
Fri, 19 Dec 2014 21:49:15 +0000 (13:49 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 19 Dec 2014 21:49:15 +0000 (13:49 -0800)
This isn't definitive but at least makes something show up in the debugger.

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

44 files changed:
gm/imagefiltersbase.cpp
gm/imagefiltersgraph.cpp
include/core/SkImageFilter.h
include/effects/SkBitmapSource.h
include/effects/SkBlurImageFilter.h
include/effects/SkColorFilterImageFilter.h
include/effects/SkComposeImageFilter.h
include/effects/SkDisplacementMapEffect.h
include/effects/SkDropShadowImageFilter.h
include/effects/SkMagnifierImageFilter.h
include/effects/SkMatrixConvolutionImageFilter.h
include/effects/SkMatrixImageFilter.h
include/effects/SkMergeImageFilter.h
include/effects/SkMorphologyImageFilter.h
include/effects/SkOffsetImageFilter.h
include/effects/SkPictureImageFilter.h
include/effects/SkRectShaderImageFilter.h
include/effects/SkTestImageFilters.h
include/effects/SkTileImageFilter.h
include/effects/SkXfermodeImageFilter.h
src/core/SkPaint.cpp
src/effects/SkAlphaThresholdFilter.cpp
src/effects/SkBitmapSource.cpp
src/effects/SkBlurImageFilter.cpp
src/effects/SkColorFilterImageFilter.cpp
src/effects/SkComposeImageFilter.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/SkPictureImageFilter.cpp
src/effects/SkRectShaderImageFilter.cpp
src/effects/SkTableColorFilter.cpp
src/effects/SkTestImageFilters.cpp
src/effects/SkTileImageFilter.cpp
src/effects/SkXfermodeImageFilter.cpp
src/effects/gradients/SkGradientShader.cpp
tests/ImageFilterTest.cpp
tests/PDFPrimitivesTest.cpp

index 749334a61ea28154aa86e27be25895252fb244c7..be8d402528272646b2c5b7cb447e140161517ef8 100644 (file)
@@ -30,6 +30,7 @@ public:
         return SkNEW(FailImageFilter);
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
 
 protected:
@@ -51,6 +52,13 @@ SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) {
     return FailImageFilter::Create();
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void FailImageFilter::toString(SkString* str) const {
+    str->appendf("FailImageFilter: (");
+    str->append(")");
+}
+#endif
+
 class IdentityImageFilter : public SkImageFilter {
 public:
     class Registrar {
@@ -65,6 +73,7 @@ public:
         return SkNEW_ARGS(IdentityImageFilter, (input));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
 protected:
     IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {}
@@ -87,6 +96,13 @@ SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) {
     return IdentityImageFilter::Create(common.getInput(0));
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void IdentityImageFilter::toString(SkString* str) const {
+    str->appendf("IdentityImageFilter: (");
+    str->append(")");
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
index 8469a43b59e824d52d02d29a377c9edb59ed3149..ae6f4a6d1fa809a510a6afceea2b8c70d7a985ee 100644 (file)
@@ -62,6 +62,7 @@ public:
         return true;
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter);
 
 protected:
@@ -89,6 +90,13 @@ SkFlattenable* SimpleOffsetFilter::CreateProc(SkReadBuffer& buffer) {
     return Create(dx, dy, common.getInput(0));
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SimpleOffsetFilter::toString(SkString* str) const {
+    str->appendf("SimpleOffsetFilter: (");
+    str->append(")");
+}
+#endif
+
 class ImageFiltersGraphGM : public skiagm::GM {
 public:
     ImageFiltersGraphGM() {}
index 23456d31f9fc369389e5df6f535e734be12af3b5..42e2d7c33f394d6f8abf555258317bae5f95bfa1 100644 (file)
@@ -188,6 +188,7 @@ public:
                            SkBitmap* result, SkIPoint* offset) const;
 #endif
 
+    SK_TO_STRING_PUREVIRT()
     SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
 
 protected:
index 8b678b2eb815898127bdab9ae8423940c2ab08fa..cf57f8012e1f437bd522fd0a18a3fb24ce7ab7a2 100644 (file)
@@ -22,6 +22,7 @@ public:
     }
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
 
 protected:
index 9064579bea297bd1141d0cb41061b1beef151ee2..f2a3075593874ac576b7f8fd5c0feb9cd0a3619c 100644 (file)
@@ -22,6 +22,7 @@ public:
 
     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
 
 protected:
index ff163c7cd4e13a04044331deccc4fd42584ff617..facbfda106858badcfbe7f682505896c275c838a 100644 (file)
@@ -20,6 +20,7 @@ public:
                                             uint32_t uniqueID = 0);
     virtual ~SkColorFilterImageFilter();
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
 
 protected:
index 0478909cd19053d2c3551796435c3dad9a95835b..389ab824acdf5b8c10535e5f68d2ef5416efd833 100644 (file)
@@ -25,6 +25,7 @@ public:
         return SkNEW_ARGS(SkComposeImageFilter, (inputs));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
 
 protected:
index a5296fd6a79114f73467952a59be0866ba27da5f..dd11582bdb64d74884b41f18548a1167c8324d89 100644 (file)
@@ -48,6 +48,8 @@ public:
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
+    SK_TO_STRING_OVERRIDE()
+
 protected:
     SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
                             ChannelSelectorType yChannelSelector,
index a931ad00ffaaf3359b82b0d2a4b05f4a1c89dede..e4c192bc131e7543feb100a653234d3d819a85a0 100644 (file)
@@ -13,9 +13,13 @@ class SK_API SkDropShadowImageFilter : public SkImageFilter {
 public:
     enum ShadowMode {
         kDrawShadowAndForeground_ShadowMode,
-        kDrawShadowOnly_ShadowMode
+        kDrawShadowOnly_ShadowMode,
+
+        kLast_ShadowMode = kDrawShadowOnly_ShadowMode
     };
 
+    static const int kShadowModeCount = kLast_ShadowMode+1;
+
     /** @deprecated use another Create function below instead */
     static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
                                            SkScalar sigmaX, SkScalar sigmaY, SkColor color,
@@ -45,6 +49,7 @@ public:
     }
 
     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
 
 protected:
index 68c3fdfee44f33f29262ec2bcbade9a782e34d90..9e69dddc392f97df1b204329b901f6097ef9e77a 100644 (file)
@@ -16,6 +16,7 @@ class SK_API SkMagnifierImageFilter : public SkImageFilter {
 public:
     static SkImageFilter* Create(const SkRect& src, SkScalar inset, SkImageFilter* input = NULL);
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
 
 protected:
index b97dabe2695d394a1873d626a74cad733c1f4d24..e09ac944cbce6d2a706a17424668bd48690fe79e 100644 (file)
@@ -63,6 +63,7 @@ public:
                                                   const CropRect* cropRect = NULL,
                                                   uint32_t uniqueID = 0);
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
 
 protected:
index 0063e416301d1005268b1580c89c1a8b27d6857f..0f7ed0bb5fa87d5ee31aedc5184cce545326f45f 100644 (file)
@@ -36,6 +36,7 @@ public:
 
     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixImageFilter)
 
 protected:
index 59183e3fc1ee035e5bce4c8cb55fca7625bbfc3d..ba580f1c5b7b26afa4dba68f729ceaa6535ed364 100644 (file)
@@ -31,6 +31,7 @@ public:
         return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect, uniqueID));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
 
 protected:
index ff7ed89d43bcc7d6398f64fbda8a627e7a2c3716..aad7cb57761c1657c7f913610ed5735773c2ab1e 100644 (file)
@@ -68,6 +68,7 @@ public:
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
 
 protected:
@@ -96,6 +97,7 @@ public:
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
 
 protected:
index 6a60e62bda298b62000dbee4a568bc737332d2e2..de5a63116238a7b41d53f53ca6c0b3e1936c4fe7 100644 (file)
@@ -24,6 +24,7 @@ public:
         return SkNEW_ARGS(SkOffsetImageFilter, (dx, dy, input, cropRect, uniqueID));
     }
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter)
 
 protected:
index 9db6f2fc6a30ff779764cb68dee4d3744ffac0d5..a6b82258e528d259cfa0275d50785af96f6d05a9 100644 (file)
@@ -46,6 +46,7 @@ public:
                                                  kLocalSpace_PictureResolution, filterLevel));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
 
 protected:
index dc35c947baefa72b5f9a2192fa79f967c0bd1deb..dbc8a081cfa3dbb475b1a79204735ad69361d918 100644 (file)
@@ -31,6 +31,7 @@ public:
     static SkRectShaderImageFilter* Create(SkShader* s, const CropRect* rect = NULL, uint32_t uniqueID = 0);
     virtual ~SkRectShaderImageFilter();
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter)
 
 protected:
index 6acd1d293c6e49f014ae8578a014f7ec5ee96691..a460b3238fede46e0b74f4f938b80b14da22e285 100644 (file)
@@ -18,6 +18,7 @@ public:
         return SkNEW_ARGS(SkDownSampleImageFilter, (scale, input));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
 
 protected:
index 49d69a0ebf8ed3c2d8e82a8982381b57fb662387..3e1411ce832fa9404888dec3c832b31d74f7645f 100644 (file)
@@ -27,6 +27,7 @@ public:
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
                                 SkIRect* dst) const SK_OVERRIDE;
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
 
 protected:
index 96d258fd08ffa276179956947347a9e983b110b1..1b2a7636faca259f92d25e7866f3c1ec0e3d1bad 100644 (file)
@@ -31,6 +31,7 @@ public:
         return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect, uniqueID));
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
 
     virtual bool onFilterImage(Proxy* proxy,
index 2aadce1d0a4f1680c182c213ed05fc43fed5edd2..f1d5ab6468084b9fbd71a4b379da1d3836ed4505 100644 (file)
@@ -2160,6 +2160,7 @@ void SkPaint::toString(SkString* str) const {
     SkImageFilter* imageFilter = this->getImageFilter();
     if (imageFilter) {
         str->append("<dt>ImageFilter:</dt><dd>");
+        imageFilter->toString(str);
         str->append("</dd>");
     }
 
index 890cb71b516b53c8611e0e34067bb503fcabb0fd..791d1fee1c0f496c74356fd5113fe44f97be2c07 100644 (file)
@@ -16,6 +16,7 @@ public:
     SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
                                SkScalar outerThreshold, SkImageFilter* input);
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
 
 protected:
@@ -374,3 +375,12 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
 
     return true;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
+    str->appendf("SkAlphaThresholdImageFilter: (");
+    str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
+    str->append(")");
+}
+#endif
+
index ff76ab4bba71fd314e371ef7163cc736b7b06f15..fc86f194b059909651518d6c29da3413c316e36b 100644 (file)
@@ -83,3 +83,15 @@ bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context&
 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const {
     *dst = fDstRect;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkBitmapSource::toString(SkString* str) const {
+    str->appendf("SkBitmapSource: (");
+    str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ",
+                 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
+                 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBottom);
+    str->appendf("bitmap: (%d,%d)",
+                 fBitmap.width(), fBitmap.height());
+    str->append(")");
+}
+#endif
index e5bb8c1e74592ef7db9a5e77ae5341d73bf6f644..e9d24822c613dd68e3ab7e0bf99d09c67941cacc 100644 (file)
@@ -287,3 +287,11 @@ bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
     return false;
 #endif
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkBlurImageFilter::toString(SkString* str) const {
+    str->appendf("SkBlurImageFilter: (");
+    str->appendf("sigma: (%f, %f)", fSigma.fWidth, fSigma.fHeight);
+    str->append(")");
+}
+#endif
index 10976d77f0db790c50de8ca3daa0c731ee6e33b6..571d69ce77919d8e0154edf59420ee44e6673a7c 100755 (executable)
@@ -141,3 +141,14 @@ bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
     }
     return false;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkColorFilterImageFilter::toString(SkString* str) const {
+    str->appendf("SkColorFilterImageFilter: (");
+
+    str->appendf("color filter: ");
+    fColorFilter->toString(str);
+
+    str->append(")");
+}
+#endif
index 9bec5009760e406c5403cb6d0db0ad7d23048d3b..4a17e152de704d7b0369ea9ba3f2c731632ea0ec 100644 (file)
@@ -40,3 +40,20 @@ SkFlattenable* SkComposeImageFilter::CreateProc(SkReadBuffer& buffer) {
     SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
     return SkComposeImageFilter::Create(common.getInput(0), common.getInput(1));
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkComposeImageFilter::toString(SkString* str) const {
+    SkImageFilter* outer = getInput(0);
+    SkImageFilter* inner = getInput(1);
+
+    str->appendf("SkComposeImageFilter: (");
+
+    str->appendf("outer: ");
+    outer->toString(str);
+
+    str->appendf("inner: ");
+    inner->toString(str);
+
+    str->appendf(")");
+}
+#endif
index b1f6a97e7147ac4e84f58bca0b584974f62347c4..2c7f5ee8cee5b9e71217a886d10af662cbbaf3fb 100644 (file)
@@ -281,6 +281,22 @@ bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
     return true;
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SkDisplacementMapEffect::toString(SkString* str) const {
+    str->appendf("SkDisplacementMapEffect: (");
+    str->appendf("scale: %f ", fScale);
+    str->appendf("displacement: (");
+    if (this->getDisplacementInput()) {
+        this->getDisplacementInput()->toString(str);
+    }
+    str->appendf(") color: (");
+    if (this->getColorInput()) {
+        this->getColorInput()->toString(str);
+    }
+    str->appendf("))");
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #if SK_SUPPORT_GPU
@@ -620,3 +636,4 @@ void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
     b->add32(xKey | yKey);
 }
 #endif
+
index 5bbb958e9cc8852e0a6281c255bef986eb95b9b8..22bee9dade72c6f75438863f08925d3567b96b49 100644 (file)
@@ -136,3 +136,27 @@ bool SkDropShadowImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
     *dst = bounds;
     return true;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDropShadowImageFilter::toString(SkString* str) const {
+    str->appendf("SkDropShadowImageFilter: (");
+
+    str->appendf("dX: %f ", fDx);
+    str->appendf("dY: %f ", fDy);
+    str->appendf("sigmaX: %f ", fSigmaX);
+    str->appendf("sigmaY: %f ", fSigmaY);
+
+    str->append("Color: ");
+    str->appendHex(fColor);
+
+    static const char* gModeStrings[] = {
+        "kDrawShadowAndForeground", "kDrawShadowOnly"
+    };
+
+    SK_COMPILE_ASSERT(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), enum_mismatch);
+
+    str->appendf(" mode: %s", gModeStrings[fShadowMode]);
+
+    str->append(")");
+}
+#endif
index 8acd7fd97d2c6ca44e75807fd49528c60b1d79a2..b1271d8493194a8a1251a7c776cf5feb2b147314 100644 (file)
@@ -282,6 +282,7 @@ public:
     static SkImageFilter* Create(SkLight* light, SkScalar surfaceScale, SkScalar kd, SkImageFilter*,
                                  const CropRect*, uint32_t uniqueID = 0);
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiffuseLightingImageFilter)
     SkScalar kd() const { return fKD; }
 
@@ -309,6 +310,7 @@ public:
                                  SkScalar ks, SkScalar shininess, SkImageFilter*, const CropRect*,
                                  uint32_t uniqueID = 0);
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSpecularLightingImageFilter)
 
     SkScalar ks() const { return fKS; }
@@ -1035,6 +1037,14 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
     return true;
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SkDiffuseLightingImageFilter::toString(SkString* str) const {
+    str->appendf("SkDiffuseLightingImageFilter: (");
+    str->appendf("kD: %f\n", fKD);
+    str->append(")");
+}
+#endif
+
 #if SK_SUPPORT_GPU
 bool SkDiffuseLightingImageFilter::asFragmentProcessor(GrFragmentProcessor** fp,
                                                        GrTexture* texture,
@@ -1142,6 +1152,14 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
     return true;
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SkSpecularLightingImageFilter::toString(SkString* str) const {
+    str->appendf("SkSpecularLightingImageFilter: (");
+    str->appendf("kS: %f shininess: %f", fKS, fShininess);
+    str->append(")");
+}
+#endif
+
 #if SK_SUPPORT_GPU
 bool SkSpecularLightingImageFilter::asFragmentProcessor(GrFragmentProcessor** fp,
                                                         GrTexture* texture,
index ae6637b28227f12b7b09fa4500b310737b7ff598..e236da53ffb126af00be7b6db30b1ed7f9a405e3 100644 (file)
@@ -357,3 +357,13 @@ bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src,
     }
     return true;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkMagnifierImageFilter::toString(SkString* str) const {
+    str->appendf("SkMagnifierImageFilter: (");
+    str->appendf("src: (%f,%f,%f,%f) ",
+                 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom);
+    str->appendf("inset: %f", fInset);
+    str->append(")");
+}
+#endif
index 045f6a96d58cce817489badad9c3162e01c342b6..e9dd87852f4ee406d0165e65ee7b2cd354d69bd3 100644 (file)
@@ -369,3 +369,20 @@ bool SkMatrixConvolutionImageFilter::asFragmentProcessor(GrFragmentProcessor** f
     return true;
 }
 #endif
+
+#ifndef SK_IGNORE_TO_STRING
+void SkMatrixConvolutionImageFilter::toString(SkString* str) const {
+    str->appendf("SkMatrixConvolutionImageFilter: (");
+    str->appendf("size: (%d,%d) kernel: (", fKernelSize.width(), fKernelSize.height());
+    for (int y = 0; y < fKernelSize.height(); y++) {
+        for (int x = 0; x < fKernelSize.width(); x++) {
+            str->appendf("%f ", fKernel[y * fKernelSize.width() + x]);
+        }
+    }
+    str->appendf(")");
+    str->appendf("gain: %f bias: %f ", fGain, fBias);
+    str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY);
+    str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false");
+    str->append(")");
+}
+#endif
index f2c403f443aa450e64ec75108f390bf1b4a8cabe..4d9b1fa33517130f083500a31092c9125d88424d 100644 (file)
@@ -124,3 +124,27 @@ bool SkMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm
     *dst = bounds;
     return true;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkMatrixImageFilter::toString(SkString* str) const {
+    str->appendf("SkMatrixImageFilter: (");
+
+    str->appendf("transform: (%f %f %f %f %f %f %f %f %f)",
+                 fTransform[SkMatrix::kMScaleX],
+                 fTransform[SkMatrix::kMSkewX],
+                 fTransform[SkMatrix::kMTransX],
+                 fTransform[SkMatrix::kMSkewY],
+                 fTransform[SkMatrix::kMScaleY],
+                 fTransform[SkMatrix::kMTransY],
+                 fTransform[SkMatrix::kMPersp0],
+                 fTransform[SkMatrix::kMPersp1],
+                 fTransform[SkMatrix::kMPersp2]);
+
+    str->append("<dt>FilterLevel:</dt><dd>");
+    static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" };
+    str->append(gFilterLevelStrings[fFilterLevel]);    
+    str->append("</dd>");
+
+    str->appendf(")");
+}
+#endif
index d932d3ccce50a05ffd5689cece10a926d3a16ada..7034e158e5ef48e95d49007c180f09bee1443a05 100755 (executable)
@@ -140,3 +140,18 @@ void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
         buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
     }
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkMergeImageFilter::toString(SkString* str) const {
+    str->appendf("SkMergeImageFilter: (");
+    
+    for (int i = 0; i < this->countInputs(); ++i) {
+        SkImageFilter* filter = this->getInput(i);
+        str->appendf("%d: (", i);
+        filter->toString(str);
+        str->appendf(")");
+    }
+
+    str->append(")");
+}
+#endif
index d533448fe00ff6d99fabf0c9316705f73a968018..d18dc394eb93072545664650eca13d5fa3a0f344 100644 (file)
@@ -264,6 +264,22 @@ SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) {
     return Create(width, height, common.getInput(0), &common.cropRect(), common.uniqueID());
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SkErodeImageFilter::toString(SkString* str) const {
+    str->appendf("SkErodeImageFilter: (");
+    str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeight);
+    str->append(")");
+}
+#endif
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDilateImageFilter::toString(SkString* str) const {
+    str->appendf("SkDilateImageFilter: (");
+    str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeight);
+    str->append(")");
+}
+#endif
+
 #if SK_SUPPORT_GPU
 
 ///////////////////////////////////////////////////////////////////////////////
index b7ded082d9c3b462471cbe5f9eeea05c9839b2eb..8a17ce34ec7b7c1320494e02e5db97ffb4dc91ad 100644 (file)
@@ -108,3 +108,15 @@ SkOffsetImageFilter::SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter
   : INHERITED(1, &input, cropRect, uniqueID) {
     fOffset.set(dx, dy);
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkOffsetImageFilter::toString(SkString* str) const {
+    str->appendf("SkOffsetImageFilter: (");
+    str->appendf("offset: (%f, %f) ", fOffset.fX, fOffset.fY);
+    str->append("input: (");
+    if (this->getInput(0)) {
+        this->getInput(0)->toString(str);
+    }
+    str->append("))");
+}
+#endif
index 8075f365d0b400bca40db92688eb3a7001636c66..37d86ce0d2be256bd82e12fcdda26d8f8326823c 100644 (file)
@@ -167,3 +167,17 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(Proxy* proxy, SkBaseDevi
                       SkIntToScalar(localIBounds.fTop), &paint);
     //canvas.drawPicture(fPicture);
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkPictureImageFilter::toString(SkString* str) const {
+    str->appendf("SkPictureImageFilter: (");
+    str->appendf("crop: (%f,%f,%f,%f) ", 
+                 fCropRect.fLeft, fCropRect.fTop, fCropRect.fRight, fCropRect.fBottom);
+    if (fPicture) {
+        str->appendf("picture: (%f,%f,%f,%f)",
+                     fPicture->cullRect().fLeft, fPicture->cullRect().fTop,
+                     fPicture->cullRect().fRight, fPicture->cullRect().fBottom);
+    }
+    str->append(")");
+}
+#endif
index 91a127e0e3f2479a866a4211b7333bd221b6570d..a00994e75b64ffe5b5145822ac9a6c8db054a467 100644 (file)
@@ -79,3 +79,10 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
     offset->fY = bounds.fTop;
     return true;
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkRectShaderImageFilter::toString(SkString* str) const {
+    str->appendf("SkRectShaderImageFilter: (");
+    str->append(")");
+}
+#endif
index 942bae7d06361d2b136cda1bcff482eab71dcc22..e12b3d78ec2d0ed0e2f6d0ea90da9ebd322a78bc 100644 (file)
@@ -155,7 +155,32 @@ void SkTable_ColorFilter::filterSpan(const SkPMColor src[], int count,
 
 #ifndef SK_IGNORE_TO_STRING
 void SkTable_ColorFilter::toString(SkString* str) const {
-    str->append("SkTable_ColorFilter");
+    const uint8_t* table = fStorage;
+    const uint8_t* tableA = gIdentityTable;
+    const uint8_t* tableR = gIdentityTable;
+    const uint8_t* tableG = gIdentityTable;
+    const uint8_t* tableB = gIdentityTable;
+    if (fFlags & kA_Flag) {
+        tableA = table; table += 256;
+    }
+    if (fFlags & kR_Flag) {
+        tableR = table; table += 256;
+    }
+    if (fFlags & kG_Flag) {
+        tableG = table; table += 256;
+    }
+    if (fFlags & kB_Flag) {
+        tableB = table;
+    }
+
+    str->append("SkTable_ColorFilter (");
+
+    for (int i = 0; i < 256; ++i) {
+        str->appendf("%d: %d,%d,%d,%d\n",
+                     i, tableR[i], tableG[i], tableB[i], tableA[i]);
+    }
+
+    str->append(")");
 }
 #endif
 
index be991f6f837eb8741b89ca258827b6f907e2c7e1..f0f8ae039041e3ecd6b05bd4468439b3d9af3209 100755 (executable)
@@ -80,3 +80,10 @@ void SkDownSampleImageFilter::flatten(SkWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
     buffer.writeScalar(fScale);
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDownSampleImageFilter::toString(SkString* str) const {
+    str->appendf("SkDownSampleImageFilter: (");
+    str->append(")");
+}
+#endif
index d640ac7adbd969331c8a43e98b15dddc64027b39..669c234d95c7934b456cc6ba208faf8e0286fd40 100644 (file)
@@ -106,3 +106,10 @@ void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const {
     buffer.writeRect(fSrcRect);
     buffer.writeRect(fDstRect);
 }
+
+#ifndef SK_IGNORE_TO_STRING
+void SkTileImageFilter::toString(SkString* str) const {
+    str->appendf("SkTileImageFilter: (");
+    str->append(")");
+}
+#endif
index 00e9ed639b0f790b7b4e9b3c369af73da947916c..617593eae6e559b300a6f435f6f0bb0642b4a74f 100644 (file)
@@ -98,6 +98,17 @@ bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
     return true;
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void SkXfermodeImageFilter::toString(SkString* str) const {
+    str->appendf("SkXfermodeImageFilter: (");
+    str->appendf("xfermode: (");
+    if (fMode) {
+        fMode->toString(str);
+    }
+    str->append("))");
+}
+#endif
+
 #if SK_SUPPORT_GPU
 
 bool SkXfermodeImageFilter::canFilterImageGPU() const {
@@ -165,3 +176,4 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
 }
 
 #endif
+
index 3b73eae6aa46a0b7925e5fbfdd1f8f5f025a67f7..d50afb763838e7e1e819884094ef2233dbaa1d36 100644 (file)
@@ -704,7 +704,7 @@ void SkGradientShaderBase::toString(SkString* str) const {
     str->appendf("%d colors: ", fColorCount);
 
     for (int i = 0; i < fColorCount; ++i) {
-        str->appendHex(fOrigColors[i]);
+        str->appendHex(fOrigColors[i], 8);
         if (i < fColorCount-1) {
             str->append(", ");
         }
index 9fd4351b42a65c9cc575183d66b71017fac1200a..b67383682bf77b70ad7fb8598ae42dc3689a68e5 100644 (file)
@@ -55,6 +55,7 @@ public:
         return true;
     }
 
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
 
 protected:
@@ -81,6 +82,13 @@ SkFlattenable* MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) {
     return SkNEW_ARGS(MatrixTestImageFilter, (reporter, matrix));
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void MatrixTestImageFilter::toString(SkString* str) const {
+    str->appendf("MatrixTestImageFilter: (");
+    str->append(")");
+}
+#endif
+
 static void make_small_bitmap(SkBitmap& bitmap) {
     bitmap.allocN32Pixels(kBitmapSize, kBitmapSize);
     SkCanvas canvas(bitmap);
index ca18b2aebf1775aa71887593aae0f8524bbb0908..3f539e384379e60a60e8f333aa8ee703a8690bc9 100644 (file)
@@ -443,6 +443,7 @@ public:
         *result = src;
         return true;
     }
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter)
     bool visited() const { return fVisited; }
 
@@ -456,6 +457,13 @@ SkFlattenable* DummyImageFilter::CreateProc(SkReadBuffer& buffer) {
     return SkNEW_ARGS(DummyImageFilter, (visited));
 }
 
+#ifndef SK_IGNORE_TO_STRING
+void DummyImageFilter::toString(SkString* str) const {
+    str->appendf("DummyImageFilter: (");
+    str->append(")");
+}
+#endif
+
 };
 
 // Check that PDF rendering of image filters successfully falls back to