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 "SkSVGPath.h" michael@0: #include "SkSVGParser.h" michael@0: michael@0: const SkSVGAttribute SkSVGPath::gAttributes[] = { michael@0: SVG_ATTRIBUTE(d) michael@0: }; michael@0: michael@0: DEFINE_SVG_INFO(Path) michael@0: michael@0: void SkSVGPath::translate(SkSVGParser& parser, bool defState) { michael@0: parser._startElement("path"); michael@0: INHERITED::translate(parser, defState); michael@0: bool hasMultiplePaths = false; michael@0: const char* firstZ = strchr(f_d.c_str(), 'z'); michael@0: if (firstZ != NULL) { michael@0: firstZ++; // skip over 'z' michael@0: while (*firstZ == ' ') michael@0: firstZ++; michael@0: hasMultiplePaths = *firstZ != '\0'; michael@0: } michael@0: if (hasMultiplePaths) { michael@0: SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule); michael@0: if (fillRule.size() > 0) michael@0: parser._addAttribute("fillType", fillRule.equals("evenodd") ? "evenOdd" : "winding"); michael@0: } michael@0: SVG_ADD_ATTRIBUTE(d); michael@0: parser._endElement(); michael@0: }