1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkSVGRadialGradient.h"
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkSVGParser.h"
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkSVGAttribute SkSVGRadialGradient::gAttributes[] = {
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(cx),
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(cy),
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(fx),
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(fy),
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(gradientTransform),
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(gradientUnits),
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SVG_ATTRIBUTE(r)
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comDEFINE_SVG_INFO(RadialGradient)
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkSVGRadialGradient::translate(SkSVGParser& parser, bool defState) {
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (fMatrixID.size() == 0)
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        parser.translateMatrix(f_gradientTransform, &fMatrixID);
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    parser._startElement("radialGradient");
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (fMatrixID.size() > 0)
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        parser._addAttribute("matrix", fMatrixID);
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    INHERITED::translateGradientUnits(f_gradientUnits);
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString center;
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    center.appendUnichar('[');
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    center.append(f_cx);
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    center.appendUnichar(',');
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    center.append(f_cy);
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    center.appendUnichar(']');
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    parser._addAttribute("center", center);
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    parser._addAttribute("radius", f_r);
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    INHERITED::translate(parser, defState);
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    parser._endElement();
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
43