michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #include "SkSVGPolyline.h" michael@0: #include "SkSVGParser.h" michael@0: michael@0: enum { michael@0: kCliipRule, michael@0: kFillRule, michael@0: kPoints michael@0: }; michael@0: michael@0: const SkSVGAttribute SkSVGPolyline::gAttributes[] = { michael@0: SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule), michael@0: SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule), michael@0: SVG_ATTRIBUTE(points) michael@0: }; michael@0: michael@0: DEFINE_SVG_INFO(Polyline) michael@0: michael@0: void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex, michael@0: const char* attrValue, size_t attrLength) { michael@0: if (attrIndex != kPoints) michael@0: return; michael@0: f_points.set("["); michael@0: f_points.append(attrValue, attrLength); michael@0: SkSVGParser::ConvertToArray(f_points); michael@0: } michael@0: michael@0: void SkSVGPolyline::translate(SkSVGParser& parser, bool defState) { michael@0: parser._startElement("polyline"); michael@0: INHERITED::translate(parser, defState); michael@0: SVG_ADD_ATTRIBUTE(points); michael@0: if (f_fillRule.size() > 0) michael@0: parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding"); michael@0: parser._endElement(); michael@0: }