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 "SkSVGLinearGradient.h" michael@0: #include "SkSVGParser.h" michael@0: michael@0: const SkSVGAttribute SkSVGLinearGradient::gAttributes[] = { michael@0: SVG_ATTRIBUTE(gradientTransform), michael@0: SVG_ATTRIBUTE(gradientUnits), michael@0: SVG_ATTRIBUTE(x1), michael@0: SVG_ATTRIBUTE(x2), michael@0: SVG_ATTRIBUTE(y1), michael@0: SVG_ATTRIBUTE(y2) michael@0: }; michael@0: michael@0: DEFINE_SVG_INFO(LinearGradient) michael@0: michael@0: void SkSVGLinearGradient::translate(SkSVGParser& parser, bool defState) { michael@0: if (fMatrixID.size() == 0) michael@0: parser.translateMatrix(f_gradientTransform, &fMatrixID); michael@0: parser._startElement("linearGradient"); michael@0: if (fMatrixID.size() > 0) michael@0: parser._addAttribute("matrix", fMatrixID); michael@0: INHERITED::translateGradientUnits(f_gradientUnits); michael@0: SkString points; michael@0: points.appendUnichar('['); michael@0: points.append(f_x1); michael@0: points.appendUnichar(','); michael@0: points.append(f_y1); michael@0: points.appendUnichar(','); michael@0: points.append(f_x2); michael@0: points.appendUnichar(','); michael@0: points.append(f_y2); michael@0: points.appendUnichar(']'); michael@0: parser._addAttribute("points", points.c_str()); michael@0: INHERITED::translate(parser, defState); michael@0: parser._endElement(); michael@0: }