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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/svg/SkSVGRadialGradient.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     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 "SkSVGRadialGradient.h"
    1.14 +#include "SkSVGParser.h"
    1.15 +
    1.16 +const SkSVGAttribute SkSVGRadialGradient::gAttributes[] = {
    1.17 +    SVG_ATTRIBUTE(cx),
    1.18 +    SVG_ATTRIBUTE(cy),
    1.19 +    SVG_ATTRIBUTE(fx),
    1.20 +    SVG_ATTRIBUTE(fy),
    1.21 +    SVG_ATTRIBUTE(gradientTransform),
    1.22 +    SVG_ATTRIBUTE(gradientUnits),
    1.23 +    SVG_ATTRIBUTE(r)
    1.24 +};
    1.25 +
    1.26 +DEFINE_SVG_INFO(RadialGradient)
    1.27 +
    1.28 +void SkSVGRadialGradient::translate(SkSVGParser& parser, bool defState) {
    1.29 +    if (fMatrixID.size() == 0)
    1.30 +        parser.translateMatrix(f_gradientTransform, &fMatrixID);
    1.31 +    parser._startElement("radialGradient");
    1.32 +    if (fMatrixID.size() > 0)
    1.33 +        parser._addAttribute("matrix", fMatrixID);
    1.34 +    INHERITED::translateGradientUnits(f_gradientUnits);
    1.35 +    SkString center;
    1.36 +    center.appendUnichar('[');
    1.37 +    center.append(f_cx);
    1.38 +    center.appendUnichar(',');
    1.39 +    center.append(f_cy);
    1.40 +    center.appendUnichar(']');
    1.41 +    parser._addAttribute("center", center);
    1.42 +    parser._addAttribute("radius", f_r);
    1.43 +    INHERITED::translate(parser, defState);
    1.44 +    parser._endElement();
    1.45 +}

mercurial