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 30 matching lines...) Expand all Loading... |
41 const FloatRect& targetBoundingBox, | 41 const FloatRect& targetBoundingBox, |
42 const FloatRect& visualRect, | 42 const FloatRect& visualRect, |
43 const FloatPoint& layerPositionOffset, | 43 const FloatPoint& layerPositionOffset, |
44 GraphicsContext& context, | 44 GraphicsContext& context, |
45 ClipperState& clipperState) { | 45 ClipperState& clipperState) { |
46 DCHECK_EQ(clipperState, ClipperState::NotApplied); | 46 DCHECK_EQ(clipperState, ClipperState::NotApplied); |
47 SECURITY_DCHECK(!m_clip.needsLayout()); | 47 SECURITY_DCHECK(!m_clip.needsLayout()); |
48 | 48 |
49 m_clip.clearInvalidationMask(); | 49 m_clip.clearInvalidationMask(); |
50 | 50 |
51 if (visualRect.isEmpty() || m_clip.hasCycle()) | 51 if (m_clip.hasCycle()) |
52 return false; | 52 return false; |
53 | 53 |
54 SVGClipExpansionCycleHelper inClipExpansionChange(m_clip); | 54 SVGClipExpansionCycleHelper inClipExpansionChange(m_clip); |
55 | 55 |
56 AffineTransform animatedLocalTransform = | 56 AffineTransform animatedLocalTransform = |
57 toSVGClipPathElement(m_clip.element()) | 57 toSVGClipPathElement(m_clip.element()) |
58 ->calculateTransform(SVGElement::IncludeMotionTransform); | 58 ->calculateTransform(SVGElement::IncludeMotionTransform); |
59 // When drawing a clip for non-SVG elements, the CTM does not include the zoom | 59 // When drawing a clip for non-SVG elements, the CTM does not include the zoom |
60 // factor. In this case, we need to apply the zoom scale explicitly - but | 60 // factor. In this case, we need to apply the zoom scale explicitly - but |
61 // only for clips with userSpaceOnUse units (the zoom is accounted for | 61 // only for clips with userSpaceOnUse units (the zoom is accounted for |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 LayoutObjectDrawingRecorder drawingRecorder( | 164 LayoutObjectDrawingRecorder drawingRecorder( |
165 context, layoutObject, DisplayItem::kSVGClip, targetVisualRect); | 165 context, layoutObject, DisplayItem::kSVGClip, targetVisualRect); |
166 sk_sp<SkPicture> maskPicture = maskPictureBuilder.endRecording(); | 166 sk_sp<SkPicture> maskPicture = maskPictureBuilder.endRecording(); |
167 context.drawPicture(maskPicture.get()); | 167 context.drawPicture(maskPicture.get()); |
168 return true; | 168 return true; |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |