| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkParse.h" | 8 #include "SkParse.h" |
| 9 #include "SkParsePath.h" | 9 #include "SkParsePath.h" |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 | 215 |
| 216 void SkParsePath::ToSVGString(const SkPath& path, SkString* str) { | 216 void SkParsePath::ToSVGString(const SkPath& path, SkString* str) { |
| 217 SkDynamicMemoryWStream stream; | 217 SkDynamicMemoryWStream stream; |
| 218 | 218 |
| 219 SkPath::Iter iter(path, false); | 219 SkPath::Iter iter(path, false); |
| 220 SkPoint pts[4]; | 220 SkPoint pts[4]; |
| 221 | 221 |
| 222 for (;;) { | 222 for (;;) { |
| 223 switch (iter.next(pts, false)) { | 223 switch (iter.next(pts, false)) { |
| 224 case SkPath::kMove_Verb: | 224 case SkPath::kConic_Verb: |
| 225 SkASSERT(0); |
| 226 break; |
| 227 case SkPath::kMove_Verb: |
| 225 append_scalars(&stream, 'M', &pts[0].fX, 2); | 228 append_scalars(&stream, 'M', &pts[0].fX, 2); |
| 226 break; | 229 break; |
| 227 case SkPath::kLine_Verb: | 230 case SkPath::kLine_Verb: |
| 228 append_scalars(&stream, 'L', &pts[1].fX, 2); | 231 append_scalars(&stream, 'L', &pts[1].fX, 2); |
| 229 break; | 232 break; |
| 230 case SkPath::kQuad_Verb: | 233 case SkPath::kQuad_Verb: |
| 231 append_scalars(&stream, 'Q', &pts[1].fX, 4); | 234 append_scalars(&stream, 'Q', &pts[1].fX, 4); |
| 232 break; | 235 break; |
| 233 case SkPath::kCubic_Verb: | 236 case SkPath::kCubic_Verb: |
| 234 append_scalars(&stream, 'C', &pts[1].fX, 6); | 237 append_scalars(&stream, 'C', &pts[1].fX, 6); |
| 235 break; | 238 break; |
| 236 case SkPath::kClose_Verb: | 239 case SkPath::kClose_Verb: |
| 237 stream.write("Z", 1); | 240 stream.write("Z", 1); |
| 238 break; | 241 break; |
| 239 case SkPath::kDone_Verb: | 242 case SkPath::kDone_Verb: |
| 240 str->resize(stream.getOffset()); | 243 str->resize(stream.getOffset()); |
| 241 stream.copyTo(str->writable_str()); | 244 stream.copyTo(str->writable_str()); |
| 242 return; | 245 return; |
| 243 } | 246 } |
| 244 } | 247 } |
| 245 } | 248 } |
| OLD | NEW |