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

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

Issue 629073003: Simplify/cleanup {postApply,apply}Resource signatures (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 AffineTransform patternTransform = m_attributes.patternTransform(); 105 AffineTransform patternTransform = m_attributes.patternTransform();
106 if (!patternTransform.isIdentity()) 106 if (!patternTransform.isIdentity())
107 patternData->transform = patternTransform * patternData->transform; 107 patternData->transform = patternTransform * patternData->transform;
108 108
109 // Various calls above may trigger invalidations in some fringe cases (Image Buffer allocation 109 // Various calls above may trigger invalidations in some fringe cases (Image Buffer allocation
110 // failures in the SVG image cache for example). To avoid having our Pattern Data deleted by 110 // failures in the SVG image cache for example). To avoid having our Pattern Data deleted by
111 // removeAllClientsFromCache(), we only make it visible in the cache at the very end. 111 // removeAllClientsFromCache(), we only make it visible in the cache at the very end.
112 return m_patternMap.set(object, patternData.release()).storedValue->value.ge t(); 112 return m_patternMap.set(object, patternData.release()).storedValue->value.ge t();
113 } 113 }
114 114
115 bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) 115 bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext* context, RenderSVGResourceModeFlags resourceMode)
116 { 116 {
117 ASSERT(object); 117 ASSERT(object);
118 ASSERT(style); 118 ASSERT(style);
119 ASSERT(context); 119 ASSERT(context);
120 120
121 clearInvalidationMask(); 121 clearInvalidationMask();
122 122
123 SVGPatternElement* patternElement = toSVGPatternElement(element()); 123 SVGPatternElement* patternElement = toSVGPatternElement(element());
124 if (!patternElement) 124 if (!patternElement)
125 return false; 125 return false;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (resourceMode & ApplyToTextMode) { 163 if (resourceMode & ApplyToTextMode) {
164 if (resourceMode & ApplyToFillMode) 164 if (resourceMode & ApplyToFillMode)
165 context->setTextDrawingMode(TextModeFill); 165 context->setTextDrawingMode(TextModeFill);
166 else if (resourceMode & ApplyToStrokeMode) 166 else if (resourceMode & ApplyToStrokeMode)
167 context->setTextDrawingMode(TextModeStroke); 167 context->setTextDrawingMode(TextModeStroke);
168 } 168 }
169 169
170 return true; 170 return true;
171 } 171 }
172 172
173 void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext* & context) 173 void RenderSVGResourcePattern::postApplyResource(GraphicsContext* context)
174 { 174 {
175 ASSERT(context); 175 ASSERT(context);
176 context->restore(); 176 context->restore();
177 } 177 }
178 178
179 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes, 179 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes,
180 const FloatRect& objectBoundi ngBox, 180 const FloatRect& objectBoundi ngBox,
181 const SVGPatternElement* patt ernElement) 181 const SVGPatternElement* patt ernElement)
182 { 182 {
183 ASSERT(patternElement); 183 ASSERT(patternElement);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 continue; 247 continue;
248 if (element->renderer()->needsLayout()) 248 if (element->renderer()->needsLayout())
249 return nullptr; 249 return nullptr;
250 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation); 250 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation);
251 } 251 }
252 252
253 return tileImage.release(); 253 return tileImage.release();
254 } 254 }
255 255
256 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698