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

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

Issue 652243002: Hoist paint-server transform adaption out of preparePaintServer (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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 AffineTransform patternTransform = m_attributes.patternTransform(); 103 AffineTransform patternTransform = m_attributes.patternTransform();
104 if (!patternTransform.isIdentity()) 104 if (!patternTransform.isIdentity())
105 patternData->transform = patternTransform * patternData->transform; 105 patternData->transform = patternTransform * patternData->transform;
106 106
107 // Various calls above may trigger invalidations in some fringe cases (Image Buffer allocation 107 // Various calls above may trigger invalidations in some fringe cases (Image Buffer allocation
108 // failures in the SVG image cache for example). To avoid having our Pattern Data deleted by 108 // failures in the SVG image cache for example). To avoid having our Pattern Data deleted by
109 // removeAllClientsFromCache(), we only make it visible in the cache at the very end. 109 // removeAllClientsFromCache(), we only make it visible in the cache at the very end.
110 return m_patternMap.set(object, patternData.release()).storedValue->value.ge t(); 110 return m_patternMap.set(object, patternData.release()).storedValue->value.ge t();
111 } 111 }
112 112
113 SVGPaintServer RenderSVGResourcePattern::preparePaintServer(RenderObject* object , RenderStyle* style, RenderSVGResourceModeFlags resourceMode) 113 SVGPaintServer RenderSVGResourcePattern::preparePaintServer(RenderObject* object )
114 { 114 {
115 ASSERT(object); 115 ASSERT(object);
116 ASSERT(style);
117 116
118 clearInvalidationMask(); 117 clearInvalidationMask();
119 118
120 SVGPatternElement* patternElement = toSVGPatternElement(element()); 119 SVGPatternElement* patternElement = toSVGPatternElement(element());
121 if (!patternElement) 120 if (!patternElement)
122 return SVGPaintServer::invalid(); 121 return SVGPaintServer::invalid();
123 122
124 if (m_shouldCollectPatternAttributes) { 123 if (m_shouldCollectPatternAttributes) {
125 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); 124 patternElement->synchronizeAnimatedSVGAttribute(anyQName());
126 125
127 m_attributes = PatternAttributes(); 126 m_attributes = PatternAttributes();
128 patternElement->collectPatternAttributes(m_attributes); 127 patternElement->collectPatternAttributes(m_attributes);
129 m_shouldCollectPatternAttributes = false; 128 m_shouldCollectPatternAttributes = false;
130 } 129 }
131 130
132 // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified, 131 // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
133 // then the given effect (e.g. a gradient or a filter) will be ignored. 132 // then the given effect (e.g. a gradient or a filter) will be ignored.
134 FloatRect objectBoundingBox = object->objectBoundingBox(); 133 FloatRect objectBoundingBox = object->objectBoundingBox();
135 if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDIN GBOX && objectBoundingBox.isEmpty()) 134 if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDIN GBOX && objectBoundingBox.isEmpty())
136 return SVGPaintServer::invalid(); 135 return SVGPaintServer::invalid();
137 136
138 PatternData* patternData = buildPattern(object, patternElement); 137 PatternData* patternData = buildPattern(object, patternElement);
139 if (!patternData) 138 if (!patternData)
140 return SVGPaintServer::invalid(); 139 return SVGPaintServer::invalid();
141 140
142 const SVGRenderStyle& svgStyle = style->svgStyle(); 141 patternData->pattern->setPatternSpaceTransform(patternData->transform);
143
144 AffineTransform computedPatternSpaceTransform = computeResourceSpaceTransfor m(object, patternData->transform, svgStyle, resourceMode);
145 patternData->pattern->setPatternSpaceTransform(computedPatternSpaceTransform );
146 142
147 return SVGPaintServer(patternData->pattern); 143 return SVGPaintServer(patternData->pattern);
148 } 144 }
149 145
150 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes, 146 static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr ibutes,
151 const FloatRect& objectBoundi ngBox, 147 const FloatRect& objectBoundi ngBox,
152 const SVGPatternElement* patt ernElement) 148 const SVGPatternElement* patt ernElement)
153 { 149 {
154 ASSERT(patternElement); 150 ASSERT(patternElement);
155 return SVGLengthContext::resolveRectangle(patternElement, attributes.pattern Units(), objectBoundingBox, attributes.x(), attributes.y(), attributes.width(), attributes.height()); 151 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
218 continue; 214 continue;
219 if (element->renderer()->needsLayout()) 215 if (element->renderer()->needsLayout())
220 return nullptr; 216 return nullptr;
221 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation); 217 SVGRenderingContext::renderSubtree(tileImage->context(), element->render er(), contentTransformation);
222 } 218 }
223 219
224 return tileImage.release(); 220 return tileImage.release();
225 } 221 }
226 222
227 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698