OLD | NEW |
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 markerPosition.type, markerStart, markerMid, markerEnd)) { | 221 markerPosition.type, markerStart, markerMid, markerEnd)) { |
222 PaintRecordBuilder builder(boundingBox, nullptr, &paintInfo.context); | 222 PaintRecordBuilder builder(boundingBox, nullptr, &paintInfo.context); |
223 PaintInfo markerPaintInfo(builder.context(), paintInfo); | 223 PaintInfo markerPaintInfo(builder.context(), paintInfo); |
224 | 224 |
225 // It's expensive to track the transformed paint cull rect for each | 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 | 226 // marker so just disable culling. The shape paint call will already |
227 // be culled if it is outside the paint info cull rect. | 227 // be culled if it is outside the paint info cull rect. |
228 markerPaintInfo.m_cullRect.m_rect = LayoutRect::infiniteIntRect(); | 228 markerPaintInfo.m_cullRect.m_rect = LayoutRect::infiniteIntRect(); |
229 | 229 |
230 paintMarker(markerPaintInfo, *marker, markerPosition, strokeWidth); | 230 paintMarker(markerPaintInfo, *marker, markerPosition, strokeWidth); |
231 paintInfo.context.canvas()->drawPicture(builder.endRecording()); | 231 paintInfo.context.canvas()->PlaybackPaintRecord( |
| 232 builder.endRecording().get()); |
232 } | 233 } |
233 } | 234 } |
234 } | 235 } |
235 | 236 |
236 void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, | 237 void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, |
237 const LayoutSVGResourceMarker& marker, | 238 const LayoutSVGResourceMarker& marker, |
238 const MarkerPosition& position, | 239 const MarkerPosition& position, |
239 float strokeWidth) { | 240 float strokeWidth) { |
240 if (!marker.shouldPaint()) | 241 if (!marker.shouldPaint()) |
241 return; | 242 return; |
242 | 243 |
243 TransformRecorder transformRecorder( | 244 TransformRecorder transformRecorder( |
244 paintInfo.context, marker, | 245 paintInfo.context, marker, |
245 marker.markerTransformation(position.origin, position.angle, | 246 marker.markerTransformation(position.origin, position.angle, |
246 strokeWidth)); | 247 strokeWidth)); |
247 Optional<FloatClipRecorder> clipRecorder; | 248 Optional<FloatClipRecorder> clipRecorder; |
248 if (SVGLayoutSupport::isOverflowHidden(&marker)) | 249 if (SVGLayoutSupport::isOverflowHidden(&marker)) |
249 clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, | 250 clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, |
250 marker.viewport()); | 251 marker.viewport()); |
251 SVGContainerPainter(marker).paint(paintInfo); | 252 SVGContainerPainter(marker).paint(paintInfo); |
252 } | 253 } |
253 | 254 |
254 } // namespace blink | 255 } // namespace blink |
OLD | NEW |