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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGShapePainter.cpp

Issue 2751433002: [SPv2] Flatten property trees in PaintRecordBuilder into a single display list. (Closed)
Patch Set: none Created 3 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/SVGShapePainter.h" 5 #include "core/paint/SVGShapePainter.h"
6 6
7 #include "core/layout/svg/LayoutSVGResourceMarker.h" 7 #include "core/layout/svg/LayoutSVGResourceMarker.h"
8 #include "core/layout/svg/LayoutSVGShape.h" 8 #include "core/layout/svg/LayoutSVGShape.h"
9 #include "core/layout/svg/SVGLayoutSupport.h" 9 #include "core/layout/svg/SVGLayoutSupport.h"
10 #include "core/layout/svg/SVGMarkerData.h" 10 #include "core/layout/svg/SVGMarkerData.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 LayoutSVGResourceMarker* markerMid = resources->markerMid(); 212 LayoutSVGResourceMarker* markerMid = resources->markerMid();
213 LayoutSVGResourceMarker* markerEnd = resources->markerEnd(); 213 LayoutSVGResourceMarker* markerEnd = resources->markerEnd();
214 if (!markerStart && !markerMid && !markerEnd) 214 if (!markerStart && !markerMid && !markerEnd)
215 return; 215 return;
216 216
217 float strokeWidth = m_layoutSVGShape.strokeWidth(); 217 float strokeWidth = m_layoutSVGShape.strokeWidth();
218 218
219 for (const MarkerPosition& markerPosition : *markerPositions) { 219 for (const MarkerPosition& markerPosition : *markerPositions) {
220 if (const LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType( 220 if (const LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType(
221 markerPosition.type, markerStart, markerMid, markerEnd)) { 221 markerPosition.type, markerStart, markerMid, markerEnd)) {
222 PaintRecordBuilder builder(boundingBox, nullptr, &paintInfo.context); 222 paintMarker(paintInfo, *marker, markerPosition, strokeWidth);
223 PaintInfo markerPaintInfo(builder.context(), paintInfo);
224
225 // It's expensive to track the transformed paint cull rect for each
226 // marker so just disable culling. The shape paint call will already
227 // be culled if it is outside the paint info cull rect.
228 markerPaintInfo.m_cullRect.m_rect = LayoutRect::infiniteIntRect();
229
230 paintMarker(markerPaintInfo, *marker, markerPosition, strokeWidth);
231 paintInfo.context.canvas()->PlaybackPaintRecord(builder.endRecording());
232 } 223 }
233 } 224 }
234 } 225 }
235 226
236 void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, 227 void SVGShapePainter::paintMarker(const PaintInfo& paintInfo,
237 const LayoutSVGResourceMarker& marker, 228 const LayoutSVGResourceMarker& marker,
238 const MarkerPosition& position, 229 const MarkerPosition& position,
239 float strokeWidth) { 230 float strokeWidth) {
240 if (!marker.shouldPaint()) 231 if (!marker.shouldPaint())
241 return; 232 return;
242 233
243 TransformRecorder transformRecorder( 234 AffineTransform transform =
244 paintInfo.context, marker, 235 marker.markerTransformation(position.origin, position.angle, strokeWidth);
245 marker.markerTransformation(position.origin, position.angle, 236
246 strokeWidth)); 237 PaintCanvas* canvas = paintInfo.context.canvas();
247 Optional<FloatClipRecorder> clipRecorder; 238
239 canvas->save();
240 canvas->concat(affineTransformToSkMatrix(transform));
248 if (SVGLayoutSupport::isOverflowHidden(&marker)) 241 if (SVGLayoutSupport::isOverflowHidden(&marker))
249 clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, 242 canvas->clipRect(marker.viewport());
250 marker.viewport()); 243
251 SVGContainerPainter(marker).paint(paintInfo); 244 // It's expensive to track the transformed paint cull rect for each
245 // marker so just disable culling. The shape paint call will already
246 // be culled if it is outside the paint info cull rect.
247 IntRect bounds(LayoutRect::infiniteIntRect());
248 PaintRecordBuilder builder(FloatRect(bounds), nullptr, &paintInfo.context);
249 PaintInfo markerPaintInfo(builder.context(), paintInfo);
250 markerPaintInfo.m_cullRect.m_rect = bounds;
251
252 SVGContainerPainter(marker).paint(markerPaintInfo);
253 canvas->PlaybackPaintRecord(builder.endRecording());
254
255 canvas->restore();
252 } 256 }
253 257
254 } // namespace blink 258 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGShapePainter.h ('k') | third_party/WebKit/Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698