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

Unified Diff: src/utils/SkParsePath.cpp

Issue 455043002: use conics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments Created 6 years 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/SkPathMeasure.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkParsePath.cpp
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 1a3c87f31d9177cc596a6053f95b3ff7bb29988d..a1261b051a3f411602ffbb003519f21bebadb39f 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -184,6 +184,7 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
///////////////////////////////////////////////////////////////////////////////
+#include "SkGeometry.h"
#include "SkString.h"
#include "SkStream.h"
@@ -216,9 +217,14 @@ void SkParsePath::ToSVGString(const SkPath& path, SkString* str) {
for (;;) {
switch (iter.next(pts, false)) {
- case SkPath::kConic_Verb:
- SkASSERT(0);
- break;
+ case SkPath::kConic_Verb: {
+ const SkScalar tol = SK_Scalar1 / 1024; // how close to a quad
+ SkAutoConicToQuads quadder;
+ const SkPoint* quadPts = quadder.computeQuads(pts, iter.conicWeight(), tol);
+ for (int i = 0; i < quadder.countQuads(); ++i) {
+ append_scalars(&stream, 'Q', &quadPts[i*2 + 1].fX, 4);
+ }
+ } break;
case SkPath::kMove_Verb:
append_scalars(&stream, 'M', &pts[0].fX, 2);
break;
« no previous file with comments | « src/core/SkPathMeasure.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698