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

Side by Side Diff: experimental/svg/model/SkSVGPoly.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/SkSVGPoly.h ('k') | experimental/svg/model/SkSVGTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkCanvas.h"
9 #include "SkSVGRenderContext.h"
10 #include "SkSVGPoly.h"
11 #include "SkSVGValue.h"
12
13 SkSVGPoly::SkSVGPoly(SkSVGTag t) : INHERITED(t) {}
14
15 void SkSVGPoly::setPoints(const SkSVGPointsType& pts) {
16 fPath.reset();
17 fPath.addPoly(pts.value().begin(),
18 pts.value().count(),
19 this->tag() == SkSVGTag::kPolygon); // only polygons are auto- closed
20 }
21
22 void SkSVGPoly::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
23 switch (attr) {
24 case SkSVGAttribute::kPoints:
25 if (const auto* pts = v.as<SkSVGPointsValue>()) {
26 this->setPoints(*pts);
27 }
28 break;
29 default:
30 this->INHERITED::onSetAttribute(attr, v);
31 }
32 }
33
34 void SkSVGPoly::onDraw(SkCanvas* canvas, const SkSVGLengthContext&, const SkPain t& paint) const {
35 canvas->drawPath(fPath, paint);
36 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGPoly.h ('k') | experimental/svg/model/SkSVGTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698