OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkParse.h" | 7 #include "SkParse.h" |
8 #include "SkParsePath.h" | 8 #include "SkParsePath.h" |
9 | 9 |
10 static inline bool is_between(int c, int min, int max) { | 10 static inline bool is_between(int c, int min, int max) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 for (;;) { | 84 for (;;) { |
85 if (!data) { | 85 if (!data) { |
86 // Truncated data | 86 // Truncated data |
87 return false; | 87 return false; |
88 } | 88 } |
89 data = skip_ws(data); | 89 data = skip_ws(data); |
90 if (data[0] == '\0') { | 90 if (data[0] == '\0') { |
91 break; | 91 break; |
92 } | 92 } |
93 char ch = data[0]; | 93 char ch = data[0]; |
94 if (is_digit(ch) || ch == '-' || ch == '+') { | 94 if (is_digit(ch) || ch == '-' || ch == '+' || ch == '.') { |
95 if (op == '\0') { | 95 if (op == '\0') { |
96 return false; | 96 return false; |
97 } | 97 } |
98 } else if (is_sep(ch)) { | 98 } else if (is_sep(ch)) { |
99 data = skip_sep(data); | 99 data = skip_sep(data); |
100 } else { | 100 } else { |
101 op = ch; | 101 op = ch; |
102 relative = false; | 102 relative = false; |
103 if (is_lower(op)) { | 103 if (is_lower(op)) { |
104 op = (char) to_upper(op); | 104 op = (char) to_upper(op); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 case SkPath::kClose_Verb: | 260 case SkPath::kClose_Verb: |
261 stream.write("Z", 1); | 261 stream.write("Z", 1); |
262 break; | 262 break; |
263 case SkPath::kDone_Verb: | 263 case SkPath::kDone_Verb: |
264 str->resize(stream.getOffset()); | 264 str->resize(stream.getOffset()); |
265 stream.copyTo(str->writable_str()); | 265 stream.copyTo(str->writable_str()); |
266 return; | 266 return; |
267 } | 267 } |
268 } | 268 } |
269 } | 269 } |
OLD | NEW |