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

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

Issue 571923002: Move geometry generation out of RenderSVGResource*::postApplyResource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop curly braces. Created 6 years, 3 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
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 context->setFillRule(svgStyle.fillRule()); 121 context->setFillRule(svgStyle.fillRule());
122 } else if (resourceMode & ApplyToStrokeMode) { 122 } else if (resourceMode & ApplyToStrokeMode) {
123 context->setAlphaAsFloat(svgStyle.strokeOpacity()); 123 context->setAlphaAsFloat(svgStyle.strokeOpacity());
124 context->setStrokeGradient(gradientData->gradient); 124 context->setStrokeGradient(gradientData->gradient);
125 SVGRenderSupport::applyStrokeStyleToContext(context, style, object); 125 SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
126 } 126 }
127 127
128 return true; 128 return true;
129 } 129 }
130 130
131 void RenderSVGResourceGradient::postApplyResource(RenderObject*, GraphicsContext *& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape) 131 void RenderSVGResourceGradient::postApplyResource(RenderObject*, GraphicsContext *& context)
132 { 132 {
133 ASSERT(context); 133 ASSERT(context);
134 SVGRenderSupport::fillOrStrokePrimitive(context, resourceMode, path, shape);
135
136 context->restore(); 134 context->restore();
137 } 135 }
138 136
139 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const 137 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const
140 { 138 {
141 ASSERT(gradientData->gradient); 139 ASSERT(gradientData->gradient);
142 140
143 const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); 141 const Vector<Gradient::ColorStop>::const_iterator end = stops.end();
144 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it) 142 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it)
145 gradientData->gradient->addColorStop(*it); 143 gradientData->gradient->addColorStop(*it);
146 } 144 }
147 145
148 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType( SVGSpreadMethodType method) const 146 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType( SVGSpreadMethodType method) const
149 { 147 {
150 switch (method) { 148 switch (method) {
151 case SVGSpreadMethodUnknown: 149 case SVGSpreadMethodUnknown:
152 case SVGSpreadMethodPad: 150 case SVGSpreadMethodPad:
153 return SpreadMethodPad; 151 return SpreadMethodPad;
154 case SVGSpreadMethodReflect: 152 case SVGSpreadMethodReflect:
155 return SpreadMethodReflect; 153 return SpreadMethodReflect;
156 case SVGSpreadMethodRepeat: 154 case SVGSpreadMethodRepeat:
157 return SpreadMethodRepeat; 155 return SpreadMethodRepeat;
158 } 156 }
159 157
160 ASSERT_NOT_REACHED(); 158 ASSERT_NOT_REACHED();
161 return SpreadMethodPad; 159 return SpreadMethodPad;
162 } 160 }
163 161
164 } 162 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceGradient.h ('k') | Source/core/rendering/svg/RenderSVGResourceMasker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698