return SkNEW(FailImageFilter);
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
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 {
return SkNEW_ARGS(IdentityImageFilter, (input));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
protected:
IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {}
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) {
return true;
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter);
protected:
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() {}
SkBitmap* result, SkIPoint* offset) const;
#endif
+ SK_TO_STRING_PUREVIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
protected:
}
virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
protected:
virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
protected:
uint32_t uniqueID = 0);
virtual ~SkColorFilterImageFilter();
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
protected:
return SkNEW_ARGS(SkComposeImageFilter, (inputs));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
protected:
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
+ SK_TO_STRING_OVERRIDE()
+
protected:
SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
ChannelSelectorType yChannelSelector,
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,
}
virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
protected:
public:
static SkImageFilter* Create(const SkRect& src, SkScalar inset, SkImageFilter* input = NULL);
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
protected:
const CropRect* cropRect = NULL,
uint32_t uniqueID = 0);
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
protected:
virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixImageFilter)
protected:
return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect, uniqueID));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
protected:
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
protected:
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
protected:
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:
kLocalSpace_PictureResolution, filterLevel));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
protected:
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:
return SkNEW_ARGS(SkDownSampleImageFilter, (scale, input));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
protected:
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:
return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect, uniqueID));
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
virtual bool onFilterImage(Proxy* proxy,
SkImageFilter* imageFilter = this->getImageFilter();
if (imageFilter) {
str->append("<dt>ImageFilter:</dt><dd>");
+ imageFilter->toString(str);
str->append("</dd>");
}
SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
SkScalar outerThreshold, SkImageFilter* input);
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
protected:
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
+
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
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
}
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
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
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
b->add32(xKey | yKey);
}
#endif
+
*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
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; }
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; }
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,
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,
}
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
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
*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
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
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
///////////////////////////////////////////////////////////////////////////////
: 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
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
offset->fY = bounds.fTop;
return true;
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkRectShaderImageFilter::toString(SkString* str) const {
+ str->appendf("SkRectShaderImageFilter: (");
+ str->append(")");
+}
+#endif
#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
this->INHERITED::flatten(buffer);
buffer.writeScalar(fScale);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDownSampleImageFilter::toString(SkString* str) const {
+ str->appendf("SkDownSampleImageFilter: (");
+ str->append(")");
+}
+#endif
buffer.writeRect(fSrcRect);
buffer.writeRect(fDstRect);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkTileImageFilter::toString(SkString* str) const {
+ str->appendf("SkTileImageFilter: (");
+ str->append(")");
+}
+#endif
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 {
}
#endif
+
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(", ");
}
return true;
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
protected:
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);
*result = src;
return true;
}
+ SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter)
bool visited() const { return fVisited; }
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