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

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

Issue 536573002: Modifications to DisplayList for better Slimming Paint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Testing FIXME 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 AffineTransform contentTransformation; 116 AffineTransform contentTransformation;
117 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo ntentUnits()->currentValue()->enumValue(); 117 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo ntentUnits()->currentValue()->enumValue();
118 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 118 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
119 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y()); 119 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
120 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height()); 120 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
121 context->concatCTM(contentTransformation); 121 context->concatCTM(contentTransformation);
122 } 122 }
123 123
124 if (!m_maskContentDisplayList) 124 if (!m_maskContentDisplayList)
125 m_maskContentDisplayList = asDisplayList(context, contentTransformation) ; 125 createDisplayList(context, contentTransformation);
126 ASSERT(m_maskContentDisplayList); 126 ASSERT(m_maskContentDisplayList);
127 context->drawDisplayList(m_maskContentDisplayList.get()); 127 context->drawDisplayList(m_maskContentDisplayList.get());
128 } 128 }
129 129
130 PassRefPtr<DisplayList> RenderSVGResourceMasker::asDisplayList(GraphicsContext* context, 130 void RenderSVGResourceMasker::createDisplayList(GraphicsContext* context,
131 const AffineTransform& contentTransform) 131 const AffineTransform& contentTransform)
132 { 132 {
133 ASSERT(context); 133 ASSERT(context);
134 134
135 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 135 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
136 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 136 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
137 // userSpaceOnUse units (http://crbug.com/294900). 137 // userSpaceOnUse units (http://crbug.com/294900).
138 context->beginRecording(strokeBoundingBox()); 138 FloatRect bounds = strokeBoundingBox();
139 context->beginRecording(bounds);
139 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 140 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
140 RenderObject* renderer = childElement->renderer(); 141 RenderObject* renderer = childElement->renderer();
141 if (!renderer) 142 if (!renderer)
142 continue; 143 continue;
143 RenderStyle* style = renderer->style(); 144 RenderStyle* style = renderer->style();
144 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 145 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
145 continue; 146 continue;
146 147
147 SVGRenderingContext::renderSubtree(context, renderer, contentTransform); 148 SVGRenderingContext::renderSubtree(context, renderer, contentTransform);
148 } 149 }
149 150 m_maskContentDisplayList = context->endRecording();
150 return context->endRecording();
151 } 151 }
152 152
153 void RenderSVGResourceMasker::calculateMaskContentPaintInvalidationRect() 153 void RenderSVGResourceMasker::calculateMaskContentPaintInvalidationRect()
154 { 154 {
155 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 155 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
156 RenderObject* renderer = childElement->renderer(); 156 RenderObject* renderer = childElement->renderer();
157 if (!renderer) 157 if (!renderer)
158 continue; 158 continue;
159 RenderStyle* style = renderer->style(); 159 RenderStyle* style = renderer->style();
160 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 160 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
(...skipping 23 matching lines...) Expand all
184 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 184 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
185 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 185 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
186 maskRect = transform.mapRect(maskRect); 186 maskRect = transform.mapRect(maskRect);
187 } 187 }
188 188
189 maskRect.intersect(maskBoundaries); 189 maskRect.intersect(maskBoundaries);
190 return maskRect; 190 return maskRect;
191 } 191 }
192 192
193 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698