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

Unified Diff: src/core/SkPath.cpp

Issue 351833003: add path dump test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: generate a single line feed (or none if empty) Created 6 years, 6 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 | « src/core/SkClipStack.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 075cfdb42154dcd830ffb4a10f2854c619242734..7f2e67a327ac2538e7cae5879056fa343ae2a121 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -2111,6 +2111,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
///////////////////////////////////////////////////////////////////////////////
#include "SkString.h"
+#include "SkStream.h"
static void append_scalar(SkString* str, SkScalar value) {
SkString tmp;
@@ -2142,14 +2143,14 @@ static void append_params(SkString* str, const char label[], const SkPoint pts[]
str->append(");\n");
}
-void SkPath::dump(bool forceClose, const char title[]) const {
+void SkPath::dump(SkWStream* wStream, bool forceClose) const {
Iter iter(*this, forceClose);
SkPoint pts[4];
Verb verb;
- SkDebugf("path: forceClose=%s %s\n", forceClose ? "true" : "false",
- title ? title : "");
-
+ if (!wStream) {
+ SkDebugf("path: forceClose=%s\n", forceClose ? "true" : "false");
+ }
SkString builder;
while ((verb = iter.next(pts, false)) != kDone_Verb) {
@@ -2170,7 +2171,7 @@ void SkPath::dump(bool forceClose, const char title[]) const {
append_params(&builder, "path.cubicTo", &pts[1], 3);
break;
case kClose_Verb:
- builder.append("path.close();");
+ builder.append("path.close();\n");
break;
default:
SkDebugf(" path: UNKNOWN VERB %d, aborting dump...\n", verb);
@@ -2178,11 +2179,15 @@ void SkPath::dump(bool forceClose, const char title[]) const {
break;
}
}
- SkDebugf("%s\n", builder.c_str());
+ if (wStream) {
+ wStream->writeText(builder.c_str());
+ } else {
+ SkDebugf("%s", builder.c_str());
+ }
}
void SkPath::dump() const {
- this->dump(false);
+ this->dump(NULL, false);
}
#ifdef SK_DEBUG
« no previous file with comments | « src/core/SkClipStack.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698