gfx/skia/trunk/src/svg/SkSVGPolyline.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/svg/SkSVGPolyline.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2006 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#include "SkSVGPolyline.h"
    1.14 +#include "SkSVGParser.h"
    1.15 +
    1.16 +enum {
    1.17 +    kCliipRule,
    1.18 +    kFillRule,
    1.19 +    kPoints
    1.20 +};
    1.21 +
    1.22 +const SkSVGAttribute SkSVGPolyline::gAttributes[] = {
    1.23 +    SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule),
    1.24 +    SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule),
    1.25 +    SVG_ATTRIBUTE(points)
    1.26 +};
    1.27 +
    1.28 +DEFINE_SVG_INFO(Polyline)
    1.29 +
    1.30 +void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex,
    1.31 +        const char* attrValue, size_t attrLength) {
    1.32 +    if (attrIndex != kPoints)
    1.33 +        return;
    1.34 +    f_points.set("[");
    1.35 +    f_points.append(attrValue, attrLength);
    1.36 +    SkSVGParser::ConvertToArray(f_points);
    1.37 +}
    1.38 +
    1.39 +void SkSVGPolyline::translate(SkSVGParser& parser, bool defState) {
    1.40 +    parser._startElement("polyline");
    1.41 +    INHERITED::translate(parser, defState);
    1.42 +    SVG_ADD_ATTRIBUTE(points);
    1.43 +    if (f_fillRule.size() > 0)
    1.44 +        parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
    1.45 +    parser._endElement();
    1.46 +}

mercurial