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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourcePattern.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
OLDNEW
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 else if (resourceMode & ApplyToStrokeMode) 167 else if (resourceMode & ApplyToStrokeMode)
168 context->setTextDrawingMode(TextModeStroke); 168 context->setTextDrawingMode(TextModeStroke);
169 } 169 }
170 170
171 return true; 171 return true;
172 } 172 }
173 173
174 void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext* & context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape) 174 void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext* & context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
175 { 175 {
176 ASSERT(context); 176 ASSERT(context);
177 ASSERT(resourceMode != ApplyToDefaultMode); 177 SVGRenderSupport::fillOrStrokePrimitive(context, resourceMode, path, shape);
178
179 if (resourceMode & ApplyToFillMode) {
180 if (path)
181 context->fillPath(*path);
182 else if (shape)
183 shape->fillShape(context);
184 }
185 if (resourceMode & ApplyToStrokeMode) {
186 if (path)
187 context->strokePath(*path);
188 else if (shape)
189 shape->strokeShape(context);
190 }
191 178
192 context->restore(); 179 context->restore();
193 } 180 }
194 181
195 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes, 182 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes,
196 const FloatRect& objectBoundi ngBox, 183 const FloatRect& objectBoundi ngBox,
197 const SVGPatternElement* patt ernElement) 184 const SVGPatternElement* patt ernElement)
198 { 185 {
199 ASSERT(patternElement); 186 ASSERT(patternElement);
200 return SVGLengthContext::resolveRectangle(patternElement, attributes.pattern Units(), objectBoundingBox, attributes.x(), attributes.y(), attributes.width(), attributes.height()); 187 return SVGLengthContext::resolveRectangle(patternElement, attributes.pattern Units(), objectBoundingBox, attributes.x(), attributes.y(), attributes.width(), attributes.height());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 continue; 250 continue;
264 if (element->renderer()->needsLayout()) 251 if (element->renderer()->needsLayout())
265 return nullptr; 252 return nullptr;
266 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation); 253 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation);
267 } 254 }
268 255
269 return tileImage.release(); 256 return tileImage.release();
270 } 257 }
271 258
272 } 259 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceGradient.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceSolidColor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698