blob: 4b458db9e771bdf9e636ca7edb0c434964fe9f57 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkSVGPolygon.h"
11#include "SkSVGParser.h"
12
13const SkSVGAttribute SkSVGPolygon::gAttributes[] = {
14 SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule),
15 SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule),
16 SVG_ATTRIBUTE(points)
17};
18
19DEFINE_SVG_INFO(Polygon)
20
rmistry@google.comd6176b02012-08-23 18:14:13 +000021void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex,
reed@android.com8a1c16f2008-12-17 15:59:43 +000022 const char* attrValue, size_t attrLength) {
23 INHERITED::addAttribute(parser, attrIndex, attrValue, attrLength);
24}
25
26void SkSVGPolygon::translate(SkSVGParser& parser, bool defState) {
27 parser._startElement("polygon");
28 SkSVGElement::translate(parser, defState);
29 SVG_ADD_ATTRIBUTE(points);
rmistry@google.comd6176b02012-08-23 18:14:13 +000030 if (f_fillRule.size() > 0)
reed@android.com8a1c16f2008-12-17 15:59:43 +000031 parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
32 parser._endElement();
33}