diff options
author | caryclark <caryclark@google.com> | 2014-10-23 13:08:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-23 13:08:57 -0700 |
commit | 08fa28cd31c96b4ebd9cb532539c3a8c88803d90 (patch) | |
tree | 36e95f1443d883d8e5e2bf1e9c5a0d66684085f1 | |
parent | 430b795cc8a1cdbddd8fdc5511a3a523348937f7 (diff) |
add float equivalent in dumpHex output as comment
R=reed@google.com,bsalomon@google.com
Review URL: https://codereview.chromium.org/676803002
-rw-r--r-- | src/core/SkPath.cpp | 16 | ||||
-rw-r--r-- | tests/PathTest.cpp | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 06f8b7e259..f756ce365c 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -2050,7 +2050,21 @@ static void append_params(SkString* str, const char label[], const SkPoint pts[] str->append(", "); append_scalar(str, conicWeight, dumpAsHex); } - str->append(");\n"); + str->append(");"); + if (dumpAsHex) { + str->append(" // "); + for (int i = 0; i < count; ++i) { + append_scalar(str, values[i], false); + if (i < count - 1) { + str->append(", "); + } + } + if (conicWeight >= 0) { + str->append(", "); + append_scalar(str, conicWeight, false); + } + } + str->append("\n"); } void SkPath::dump(SkWStream* wStream, bool forceClose, bool dumpAsHex) const { diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 1f0422d788..bc3a3d7bdb 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -3468,8 +3468,9 @@ static void test_dump(skiatest::Reporter* reporter) { p.reset(); p.moveTo(1, 2); p.lineTo(3, 4); - compare_dump(reporter, p, false, true, "path.moveTo(SkBits2Float(0x3f800000), SkBits2Float(0x40000000));\n" - "path.lineTo(SkBits2Float(0x40400000), SkBits2Float(0x40800000));\n"); + compare_dump(reporter, p, false, true, + "path.moveTo(SkBits2Float(0x3f800000), SkBits2Float(0x40000000)); // 1, 2\n" + "path.lineTo(SkBits2Float(0x40400000), SkBits2Float(0x40800000)); // 3, 4\n"); p.reset(); p.moveTo(SkBits2Float(0x3f800000), SkBits2Float(0x40000000)); p.lineTo(SkBits2Float(0x40400000), SkBits2Float(0x40800000)); |