1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/svg/SkSVGLinearGradient.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 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 "SkSVGLinearGradient.h" 1.14 +#include "SkSVGParser.h" 1.15 + 1.16 +const SkSVGAttribute SkSVGLinearGradient::gAttributes[] = { 1.17 + SVG_ATTRIBUTE(gradientTransform), 1.18 + SVG_ATTRIBUTE(gradientUnits), 1.19 + SVG_ATTRIBUTE(x1), 1.20 + SVG_ATTRIBUTE(x2), 1.21 + SVG_ATTRIBUTE(y1), 1.22 + SVG_ATTRIBUTE(y2) 1.23 +}; 1.24 + 1.25 +DEFINE_SVG_INFO(LinearGradient) 1.26 + 1.27 +void SkSVGLinearGradient::translate(SkSVGParser& parser, bool defState) { 1.28 + if (fMatrixID.size() == 0) 1.29 + parser.translateMatrix(f_gradientTransform, &fMatrixID); 1.30 + parser._startElement("linearGradient"); 1.31 + if (fMatrixID.size() > 0) 1.32 + parser._addAttribute("matrix", fMatrixID); 1.33 + INHERITED::translateGradientUnits(f_gradientUnits); 1.34 + SkString points; 1.35 + points.appendUnichar('['); 1.36 + points.append(f_x1); 1.37 + points.appendUnichar(','); 1.38 + points.append(f_y1); 1.39 + points.appendUnichar(','); 1.40 + points.append(f_x2); 1.41 + points.appendUnichar(','); 1.42 + points.append(f_y2); 1.43 + points.appendUnichar(']'); 1.44 + parser._addAttribute("points", points.c_str()); 1.45 + INHERITED::translate(parser, defState); 1.46 + parser._endElement(); 1.47 +}