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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceLinearGradient.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 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22
23 #include "core/rendering/svg/RenderSVGResourceLinearGradient.h"
24
25 #include "core/svg/SVGLinearGradientElement.h"
26
27 namespace blink {
28
29 RenderSVGResourceLinearGradient::RenderSVGResourceLinearGradient(SVGLinearGradie ntElement* node)
30 : RenderSVGResourceGradient(node)
31 #if ENABLE(OILPAN)
32 , m_attributesWrapper(LinearGradientAttributesWrapper::create())
33 #endif
34 {
35 }
36
37 RenderSVGResourceLinearGradient::~RenderSVGResourceLinearGradient()
38 {
39 }
40
41 bool RenderSVGResourceLinearGradient::collectGradientAttributes(SVGGradientEleme nt* gradientElement)
42 {
43 #if ENABLE(OILPAN)
44 m_attributesWrapper->set(LinearGradientAttributes());
45 #else
46 m_attributes = LinearGradientAttributes();
47 #endif
48 return toSVGLinearGradientElement(gradientElement)->collectGradientAttribute s(mutableAttributes());
49 }
50
51 FloatPoint RenderSVGResourceLinearGradient::startPoint(const LinearGradientAttri butes& attributes) const
52 {
53 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), attributes.x1(), attributes.y1());
54 }
55
56 FloatPoint RenderSVGResourceLinearGradient::endPoint(const LinearGradientAttribu tes& attributes) const
57 {
58 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), attributes.x2(), attributes.y2());
59 }
60
61 void RenderSVGResourceLinearGradient::buildGradient(GradientData* gradientData) const
62 {
63 const LinearGradientAttributes& attributes = this->attributes();
64 gradientData->gradient = Gradient::create(startPoint(attributes), endPoint(a ttributes));
65 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attr ibutes.spreadMethod()));
66 addStops(gradientData, attributes.stops());
67 }
68
69 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceLinearGradient.h ('k') | Source/core/rendering/svg/RenderSVGResourceMarker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698