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

Side by Side Diff: experimental/svg/model/SkSVGAttributeParser.cpp

Issue 2235273003: [SVGDom] <polygon> & <polyline> support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: GN build fix Created 4 years, 4 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 | « experimental/svg/model/SkSVGAttributeParser.h ('k') | experimental/svg/model/SkSVGDOM.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 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 7
8 #include "SkParse.h" 8 #include "SkParse.h"
9 #include "SkSVGAttributeParser.h" 9 #include "SkSVGAttributeParser.h"
10 #include "SkSVGTypes.h" 10 #include "SkSVGTypes.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 for (size_t i = 0; i < SK_ARRAY_COUNT(gJoinInfo); ++i) { 420 for (size_t i = 0; i < SK_ARRAY_COUNT(gJoinInfo); ++i) {
421 if (this->parseExpectedStringToken(gJoinInfo[i].fName)) { 421 if (this->parseExpectedStringToken(gJoinInfo[i].fName)) {
422 *join = SkSVGLineJoin(gJoinInfo[i].fType); 422 *join = SkSVGLineJoin(gJoinInfo[i].fType);
423 parsedValue = true; 423 parsedValue = true;
424 break; 424 break;
425 } 425 }
426 } 426 }
427 427
428 return parsedValue && this->parseEOSToken(); 428 return parsedValue && this->parseEOSToken();
429 } 429 }
430
431 // https://www.w3.org/TR/SVG/shapes.html#PolygonElementPointsAttribute
432 bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
433 SkTDArray<SkPoint> pts;
434
435 bool parsedValue = false;
436 for (;;) {
437 this->parseWSToken();
438
439 SkScalar x, y;
440 if (!this->parseScalarToken(&x)) {
441 break;
442 }
443
444 // comma-wsp:
445 // (wsp+ comma? wsp*) | (comma wsp*)
446 bool wsp = this->parseWSToken();
447 bool comma = this->parseExpectedStringToken(",");
448 if (!(wsp || comma)) {
449 break;
450 }
451 this->parseWSToken();
452
453 if (!this->parseScalarToken(&y)) {
454 break;
455 }
456
457 pts.push(SkPoint::Make(x, y));
458 parsedValue = true;
459 }
460
461 if (parsedValue && this->parseEOSToken()) {
462 *points = pts;
463 return true;
464 }
465
466 return false;
467 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGAttributeParser.h ('k') | experimental/svg/model/SkSVGDOM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698