Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceRadialGradient.cpp

Issue 908243002: Move rendering/svg/RenderSVGResource* to layout/svg. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22 #include "config.h"
23
24 #include "core/rendering/svg/RenderSVGResourceRadialGradient.h"
25
26 #include "core/svg/SVGRadialGradientElement.h"
27
28 namespace blink {
29
30 RenderSVGResourceRadialGradient::RenderSVGResourceRadialGradient(SVGRadialGradie ntElement* node)
31 : RenderSVGResourceGradient(node)
32 #if ENABLE(OILPAN)
33 , m_attributesWrapper(RadialGradientAttributesWrapper::create())
34 #endif
35 {
36 }
37
38 RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient()
39 {
40 }
41
42 bool RenderSVGResourceRadialGradient::collectGradientAttributes(SVGGradientEleme nt* gradientElement)
43 {
44 #if ENABLE(OILPAN)
45 m_attributesWrapper->set(RadialGradientAttributes());
46 #else
47 m_attributes = RadialGradientAttributes();
48 #endif
49 return toSVGRadialGradientElement(gradientElement)->collectGradientAttribute s(mutableAttributes());
50 }
51
52 FloatPoint RenderSVGResourceRadialGradient::centerPoint(const RadialGradientAttr ibutes& attributes) const
53 {
54 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), attributes.cx(), attributes.cy());
55 }
56
57 FloatPoint RenderSVGResourceRadialGradient::focalPoint(const RadialGradientAttri butes& attributes) const
58 {
59 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), attributes.fx(), attributes.fy());
60 }
61
62 float RenderSVGResourceRadialGradient::radius(const RadialGradientAttributes& at tributes) const
63 {
64 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits() , attributes.r());
65 }
66
67 float RenderSVGResourceRadialGradient::focalRadius(const RadialGradientAttribute s& attributes) const
68 {
69 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits() , attributes.fr());
70 }
71
72 void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData) const
73 {
74 const RadialGradientAttributes& attributes = this->attributes();
75 gradientData->gradient = Gradient::create(this->focalPoint(attributes),
76 this->focalRadius(attributes),
77 this->centerPoint(attributes),
78 this->radius(attributes));
79
80 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attr ibutes.spreadMethod()));
81
82 addStops(gradientData, attributes.stops());
83 }
84
85 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceRadialGradient.h ('k') | Source/core/svg/SVGClipPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698