blob: 92f5b14887c97aa02bcaf8bdcafbf93c0e552f1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkSVGPath.h"
#include "SkSVGParser.h"
const SkSVGAttribute SkSVGPath::gAttributes[] = {
SVG_ATTRIBUTE(d)
};
DEFINE_SVG_INFO(Path)
void SkSVGPath::translate(SkSVGParser& parser, bool defState) {
parser._startElement("path");
INHERITED::translate(parser, defState);
bool hasMultiplePaths = false;
const char* firstZ = strchr(f_d.c_str(), 'z');
if (firstZ != NULL) {
firstZ++; // skip over 'z'
while (*firstZ == ' ')
firstZ++;
hasMultiplePaths = *firstZ != '\0';
}
if (hasMultiplePaths) {
SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule);
if (fillRule.size() > 0)
parser._addAttribute("fillType", fillRule.equals("evenodd") ? "evenOdd" : "winding");
}
SVG_ADD_ATTRIBUTE(d);
parser._endElement();
}
|