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

Side by Side Diff: src/utils/SkParsePath.cpp

Issue 16195004: add asserts to point<-->verb helpers (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkDumpCanvas.cpp ('k') | tests/PathOpsAngleTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/utils/SkDumpCanvas.cpp ('k') | tests/PathOpsAngleTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698