Add patheffects to debugger printout
TBR=bsalomon@google.com
Review URL: https://codereview.chromium.org/872043002
diff --git a/src/animator/SkDrawExtraPathEffect.cpp b/src/animator/SkDrawExtraPathEffect.cpp
index 0e4582b..b13429e 100644
--- a/src/animator/SkDrawExtraPathEffect.cpp
+++ b/src/animator/SkDrawExtraPathEffect.cpp
@@ -139,6 +139,14 @@
return result;
}
+#ifndef SK_IGNORE_TO_STRING
+ void toString(SkString* str) const SK_OVERRIDE {
+ str->appendf("SkShape1DPathEffect: (");
+ // TODO: fill in
+ str->appendf(")");
+ }
+#endif
+
private:
static bool GetContourLength(const char* token, size_t len, void* clen, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("contourLength", token, len)) {
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index dd9611e..7c6c8e0 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2113,6 +2113,7 @@
SkPathEffect* pathEffect = this->getPathEffect();
if (pathEffect) {
str->append("<dt>PathEffect:</dt><dd>");
+ pathEffect->toString(str);
str->append("</dd>");
}
diff --git a/src/core/SkPathEffect.cpp b/src/core/SkPathEffect.cpp
index 7338789..2403ffc 100644
--- a/src/core/SkPathEffect.cpp
+++ b/src/core/SkPathEffect.cpp
@@ -49,6 +49,19 @@
buffer.writeFlattenable(fPE1);
}
+#ifndef SK_IGNORE_TO_STRING
+void SkPairPathEffect::toString(SkString* str) const {
+ str->appendf("first: ");
+ if (fPE0) {
+ fPE0->toString(str);
+ }
+ str->appendf(" second: ");
+ if (fPE1) {
+ fPE1->toString(str);
+ }
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
SkFlattenable* SkComposePathEffect::CreateProc(SkReadBuffer& buffer) {
@@ -73,6 +86,15 @@
return fPE0->filterPath(dst, *ptr, rec, cullRect);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkComposePathEffect::toString(SkString* str) const {
+ str->appendf("SkComposePathEffect: (");
+ this->INHERITED::toString(str);
+ str->appendf(")");
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
SkFlattenable* SkSumPathEffect::CreateProc(SkReadBuffer& buffer) {
@@ -87,3 +109,12 @@
return fPE0->filterPath(dst, src, rec, cullRect) |
fPE1->filterPath(dst, src, rec, cullRect);
}
+
+
+#ifndef SK_IGNORE_TO_STRING
+void SkSumPathEffect::toString(SkString* str) const {
+ str->appendf("SkSumPathEffect: (");
+ this->INHERITED::toString(str);
+ str->appendf(")");
+}
+#endif
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 83f684e..3af9887 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -196,3 +196,13 @@
}
return fAdvance;
}
+
+
+#ifndef SK_IGNORE_TO_STRING
+void SkPath1DPathEffect::toString(SkString* str) const {
+ str->appendf("SkPath1DPathEffect: (");
+ // TODO: add path and style
+ str->appendf("advance: %.2f phase %.2f", fAdvance, fInitialOffset);
+ str->appendf(")");
+}
+#endif
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 2ad202a..1df69a5 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -73,6 +73,15 @@
buffer.writeMatrix(fMatrix);
}
+#ifndef SK_IGNORE_TO_STRING
+void Sk2DPathEffect::toString(SkString* str) const {
+ str->appendf("(matrix: %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f)",
+ fMatrix[SkMatrix::kMScaleX], fMatrix[SkMatrix::kMSkewX], fMatrix[SkMatrix::kMTransX],
+ fMatrix[SkMatrix::kMSkewY], fMatrix[SkMatrix::kMScaleY], fMatrix[SkMatrix::kMTransY],
+ fMatrix[SkMatrix::kMPersp0], fMatrix[SkMatrix::kMPersp1], fMatrix[SkMatrix::kMPersp2]);
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
@@ -109,6 +118,16 @@
buffer.writeScalar(fWidth);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkLine2DPathEffect::toString(SkString* str) const {
+ str->appendf("SkLine2DPathEffect: (");
+ this->INHERITED::toString(str);
+ str->appendf("width: %f", fWidth);
+ str->appendf(")");
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p)
@@ -132,3 +151,12 @@
SkPath* dst) const {
dst->addPath(fPath, loc.fX, loc.fY);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkPath2DPathEffect::toString(SkString* str) const {
+ str->appendf("SkPath2DPathEffect: (");
+ this->INHERITED::toString(str);
+ // TODO: print out path information
+ str->appendf(")");
+}
+#endif
diff --git a/src/effects/SkArcToPathEffect.cpp b/src/effects/SkArcToPathEffect.cpp
index 79398b3..06cba96 100644
--- a/src/effects/SkArcToPathEffect.cpp
+++ b/src/effects/SkArcToPathEffect.cpp
@@ -68,3 +68,11 @@
void SkArcToPathEffect::flatten(SkWriteBuffer& buffer) const {
buffer.writeScalar(fRadius);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkArcToPathEffect::toString(SkString* str) const {
+ str->appendf("SkArcToPathEffect: (");
+ str->appendf("radius: %f", fRadius);
+ str->appendf(")");
+}
+#endif
diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp
index 31f55a3..79d4c4c 100644
--- a/src/effects/SkCornerPathEffect.cpp
+++ b/src/effects/SkCornerPathEffect.cpp
@@ -146,3 +146,11 @@
void SkCornerPathEffect::flatten(SkWriteBuffer& buffer) const {
buffer.writeScalar(fRadius);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkCornerPathEffect::toString(SkString* str) const {
+ str->appendf("SkCornerPathEffect: (");
+ str->appendf("radius: %.2f", fRadius);
+ str->appendf(")");
+}
+#endif
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 8cd703f..5296f97 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -369,3 +369,17 @@
}
return NULL;
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDashPathEffect::toString(SkString* str) const {
+ str->appendf("SkDashPathEffect: (");
+ str->appendf("count: %d phase %.2f intervals: (", fCount, fPhase);
+ for (int i = 0; i < fCount; ++i) {
+ str->appendf("%.2f", fIntervals[i]);
+ if (i < fCount-1) {
+ str->appendf(", ");
+ }
+ }
+ str->appendf("))");
+}
+#endif
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index 6765b29..ac84a60 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -128,3 +128,11 @@
buffer.writeScalar(fPerterb);
buffer.writeUInt(fSeedAssist);
}
+
+#ifndef SK_IGNORE_TO_STRING
+void SkDiscretePathEffect::toString(SkString* str) const {
+ str->appendf("SkDiscretePathEffect: (");
+ str->appendf("segLength: %.2f deviation: %.2f seed %d", fSegLength, fPerterb, fSeedAssist);
+ str->append(")");
+}
+#endif