OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/SVGClipPainter.h" | 5 #include "core/paint/SVGClipPainter.h" |
6 | 6 |
7 #include "core/dom/ElementTraversal.h" | 7 #include "core/dom/ElementTraversal.h" |
8 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 8 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
9 #include "core/layout/svg/SVGLayoutSupport.h" | 9 #include "core/layout/svg/SVGLayoutSupport.h" |
10 #include "core/layout/svg/SVGResources.h" | 10 #include "core/layout/svg/SVGResources.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO
bject, DisplayItem::kSVGClip)) | 111 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO
bject, DisplayItem::kSVGClip)) |
112 return true; | 112 return true; |
113 | 113 |
114 SkPictureBuilder maskPictureBuilder(targetPaintInvalidationRect, nullptr, &c
ontext); | 114 SkPictureBuilder maskPictureBuilder(targetPaintInvalidationRect, nullptr, &c
ontext); |
115 GraphicsContext& maskContext = maskPictureBuilder.context(); | 115 GraphicsContext& maskContext = maskPictureBuilder.context(); |
116 { | 116 { |
117 TransformRecorder recorder(maskContext, layoutObject, localTransform); | 117 TransformRecorder recorder(maskContext, layoutObject, localTransform); |
118 | 118 |
119 // Apply any clip-path clipping this clipPath (nested shape/clipPath.) | 119 // Apply any clip-path clipping this clipPath (nested shape/clipPath.) |
120 Optional<ClipPathClipper> nestedClipPathClipper; | 120 Optional<ClipPathClipper> nestedClipPathClipper; |
121 if (ClipPathOperation* clipPathOperation = m_clip.styleRef().svgStyle().
clipPath()) | 121 if (ClipPathOperation* clipPathOperation = m_clip.styleRef().clipPath()) |
122 nestedClipPathClipper.emplace(maskContext, *clipPathOperation, m_cli
p, targetBoundingBox, layerPositionOffset); | 122 nestedClipPathClipper.emplace(maskContext, *clipPathOperation, m_cli
p, targetBoundingBox, layerPositionOffset); |
123 | 123 |
124 { | 124 { |
125 AffineTransform contentTransform; | 125 AffineTransform contentTransform; |
126 if (m_clip.clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundi
ngbox) { | 126 if (m_clip.clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundi
ngbox) { |
127 contentTransform.translate(targetBoundingBox.x(), targetBounding
Box.y()); | 127 contentTransform.translate(targetBoundingBox.x(), targetBounding
Box.y()); |
128 contentTransform.scaleNonUniform(targetBoundingBox.width(), targ
etBoundingBox.height()); | 128 contentTransform.scaleNonUniform(targetBoundingBox.width(), targ
etBoundingBox.height()); |
129 } | 129 } |
130 SubtreeContentTransformScope contentTransformScope(contentTransform)
; | 130 SubtreeContentTransformScope contentTransformScope(contentTransform)
; |
131 | 131 |
132 TransformRecorder contentTransformRecorder(maskContext, layoutObject
, contentTransform); | 132 TransformRecorder contentTransformRecorder(maskContext, layoutObject
, contentTransform); |
133 maskContext.getPaintController().createAndAppend<DrawingDisplayItem>
(layoutObject, DisplayItem::kSVGClip, m_clip.createContentPicture()); | 133 maskContext.getPaintController().createAndAppend<DrawingDisplayItem>
(layoutObject, DisplayItem::kSVGClip, m_clip.createContentPicture()); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt
em::kSVGClip, targetPaintInvalidationRect); | 137 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt
em::kSVGClip, targetPaintInvalidationRect); |
138 sk_sp<SkPicture> maskPicture = maskPictureBuilder.endRecording(); | 138 sk_sp<SkPicture> maskPicture = maskPictureBuilder.endRecording(); |
139 context.drawPicture(maskPicture.get()); | 139 context.drawPicture(maskPicture.get()); |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |