| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 4 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 | 23 |
| 24 #include "core/rendering/svg/RenderSVGResourceRadialGradient.h" | 24 #include "core/layout/svg/LayoutSVGResourceRadialGradient.h" |
| 25 | 25 |
| 26 #include "core/svg/SVGRadialGradientElement.h" | 26 #include "core/svg/SVGRadialGradientElement.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 RenderSVGResourceRadialGradient::RenderSVGResourceRadialGradient(SVGRadialGradie
ntElement* node) | 30 LayoutSVGResourceRadialGradient::LayoutSVGResourceRadialGradient(SVGRadialGradie
ntElement* node) |
| 31 : RenderSVGResourceGradient(node) | 31 : LayoutSVGResourceGradient(node) |
| 32 #if ENABLE(OILPAN) | 32 #if ENABLE(OILPAN) |
| 33 , m_attributesWrapper(RadialGradientAttributesWrapper::create()) | 33 , m_attributesWrapper(RadialGradientAttributesWrapper::create()) |
| 34 #endif | 34 #endif |
| 35 { | 35 { |
| 36 } | 36 } |
| 37 | 37 |
| 38 RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient() | 38 LayoutSVGResourceRadialGradient::~LayoutSVGResourceRadialGradient() |
| 39 { | 39 { |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool RenderSVGResourceRadialGradient::collectGradientAttributes(SVGGradientEleme
nt* gradientElement) | 42 bool LayoutSVGResourceRadialGradient::collectGradientAttributes(SVGGradientEleme
nt* gradientElement) |
| 43 { | 43 { |
| 44 #if ENABLE(OILPAN) | 44 #if ENABLE(OILPAN) |
| 45 m_attributesWrapper->set(RadialGradientAttributes()); | 45 m_attributesWrapper->set(RadialGradientAttributes()); |
| 46 #else | 46 #else |
| 47 m_attributes = RadialGradientAttributes(); | 47 m_attributes = RadialGradientAttributes(); |
| 48 #endif | 48 #endif |
| 49 return toSVGRadialGradientElement(gradientElement)->collectGradientAttribute
s(mutableAttributes()); | 49 return toSVGRadialGradientElement(gradientElement)->collectGradientAttribute
s(mutableAttributes()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 FloatPoint RenderSVGResourceRadialGradient::centerPoint(const RadialGradientAttr
ibutes& attributes) const | 52 FloatPoint LayoutSVGResourceRadialGradient::centerPoint(const RadialGradientAttr
ibutes& attributes) const |
| 53 { | 53 { |
| 54 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
attributes.cx(), attributes.cy()); | 54 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
attributes.cx(), attributes.cy()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 FloatPoint RenderSVGResourceRadialGradient::focalPoint(const RadialGradientAttri
butes& attributes) const | 57 FloatPoint LayoutSVGResourceRadialGradient::focalPoint(const RadialGradientAttri
butes& attributes) const |
| 58 { | 58 { |
| 59 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
attributes.fx(), attributes.fy()); | 59 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
attributes.fx(), attributes.fy()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 float RenderSVGResourceRadialGradient::radius(const RadialGradientAttributes& at
tributes) const | 62 float LayoutSVGResourceRadialGradient::radius(const RadialGradientAttributes& at
tributes) const |
| 63 { | 63 { |
| 64 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits()
, attributes.r()); | 64 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits()
, attributes.r()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 float RenderSVGResourceRadialGradient::focalRadius(const RadialGradientAttribute
s& attributes) const | 67 float LayoutSVGResourceRadialGradient::focalRadius(const RadialGradientAttribute
s& attributes) const |
| 68 { | 68 { |
| 69 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits()
, attributes.fr()); | 69 return SVGLengthContext::resolveLength(element(), attributes.gradientUnits()
, attributes.fr()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData)
const | 72 void LayoutSVGResourceRadialGradient::buildGradient(GradientData* gradientData)
const |
| 73 { | 73 { |
| 74 const RadialGradientAttributes& attributes = this->attributes(); | 74 const RadialGradientAttributes& attributes = this->attributes(); |
| 75 gradientData->gradient = Gradient::create(this->focalPoint(attributes), | 75 gradientData->gradient = Gradient::create(this->focalPoint(attributes), |
| 76 this->focalRadius(attributes), | 76 this->focalRadius(attributes), |
| 77 this->centerPoint(attributes), | 77 this->centerPoint(attributes), |
| 78 this->radius(attributes)); | 78 this->radius(attributes)); |
| 79 | 79 |
| 80 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attr
ibutes.spreadMethod())); | 80 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attr
ibutes.spreadMethod())); |
| 81 | 81 |
| 82 addStops(gradientData, attributes.stops()); | 82 addStops(gradientData, attributes.stops()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } | 85 } |
| OLD | NEW |