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

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

Issue 571463002: Factor out common code from RenderSVGResource*::postApplyResource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGResourcePattern.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
132 { 132 {
133 ASSERT(context); 133 ASSERT(context);
134 ASSERT(resourceMode != ApplyToDefaultMode); 134 SVGRenderSupport::fillOrStrokePrimitive(context, resourceMode, path, shape);
135
136 if (resourceMode & ApplyToFillMode) {
137 if (path)
138 context->fillPath(*path);
139 else if (shape)
140 shape->fillShape(context);
141 }
142 if (resourceMode & ApplyToStrokeMode) {
143 if (path)
144 context->strokePath(*path);
145 else if (shape)
146 shape->strokeShape(context);
147 }
148 135
149 context->restore(); 136 context->restore();
150 } 137 }
151 138
152 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const 139 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const
153 { 140 {
154 ASSERT(gradientData->gradient); 141 ASSERT(gradientData->gradient);
155 142
156 const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); 143 const Vector<Gradient::ColorStop>::const_iterator end = stops.end();
157 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it) 144 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it)
(...skipping 10 matching lines...) Expand all
168 return SpreadMethodReflect; 155 return SpreadMethodReflect;
169 case SVGSpreadMethodRepeat: 156 case SVGSpreadMethodRepeat:
170 return SpreadMethodRepeat; 157 return SpreadMethodRepeat;
171 } 158 }
172 159
173 ASSERT_NOT_REACHED(); 160 ASSERT_NOT_REACHED();
174 return SpreadMethodPad; 161 return SpreadMethodPad;
175 } 162 }
176 163
177 } 164 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGResourcePattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698