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

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

Issue 885103002: fix parsing SVG strings to paths with comma delimiters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | tests/ParsePathTest.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for (;;) { 79 for (;;) {
80 data = skip_ws(data); 80 data = skip_ws(data);
81 if (data[0] == '\0') { 81 if (data[0] == '\0') {
82 break; 82 break;
83 } 83 }
84 char ch = data[0]; 84 char ch = data[0];
85 if (is_digit(ch) || ch == '-' || ch == '+') { 85 if (is_digit(ch) || ch == '-' || ch == '+') {
86 if (op == '\0') { 86 if (op == '\0') {
87 return false; 87 return false;
88 } 88 }
89 } else if (is_sep(ch)) {
90 data = skip_sep(data);
89 } else { 91 } else {
90 op = ch; 92 op = ch;
91 relative = false; 93 relative = false;
92 if (is_lower(op)) { 94 if (is_lower(op)) {
93 op = (char) to_upper(op); 95 op = (char) to_upper(op);
94 relative = true; 96 relative = true;
95 } 97 }
96 data++; 98 data++;
97 data = skip_sep(data); 99 data = skip_sep(data);
98 } 100 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 case SkPath::kClose_Verb: 242 case SkPath::kClose_Verb:
241 stream.write("Z", 1); 243 stream.write("Z", 1);
242 break; 244 break;
243 case SkPath::kDone_Verb: 245 case SkPath::kDone_Verb:
244 str->resize(stream.getOffset()); 246 str->resize(stream.getOffset());
245 stream.copyTo(str->writable_str()); 247 stream.copyTo(str->writable_str());
246 return; 248 return;
247 } 249 }
248 } 250 }
249 } 251 }
OLDNEW
« no previous file with comments | « no previous file | tests/ParsePathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698