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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 if (paintInvalidationRect.isEmpty() || m_clip.hasCycle()) 43 if (paintInvalidationRect.isEmpty() || m_clip.hasCycle())
44 return false; 44 return false;
45 45
46 SVGClipExpansionCycleHelper inClipExpansionChange(m_clip); 46 SVGClipExpansionCycleHelper inClipExpansionChange(m_clip);
47 47
48 AffineTransform animatedLocalTransform = toSVGClipPathElement(m_clip.element ())->calculateAnimatedLocalTransform(); 48 AffineTransform animatedLocalTransform = toSVGClipPathElement(m_clip.element ())->calculateAnimatedLocalTransform();
49 // When drawing a clip for non-SVG elements, the CTM does not include the zo om factor. 49 // When drawing a clip for non-SVG elements, the CTM does not include the zo om factor.
50 // In this case, we need to apply the zoom scale explicitly - but only for c lips with 50 // In this case, we need to apply the zoom scale explicitly - but only for c lips with
51 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve d lengths). 51 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve d lengths).
52 if (!target.isSVG() && m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE _USERSPACEONUSE) { 52 if (!target.isSVG() && m_clip.clipPathUnits() == SVGUnitTypes::kSvgUnitTypeU serspaceonuse) {
53 ASSERT(m_clip.style()); 53 ASSERT(m_clip.style());
54 animatedLocalTransform.scale(m_clip.style()->effectiveZoom()); 54 animatedLocalTransform.scale(m_clip.style()->effectiveZoom());
55 } 55 }
56 56
57 // First, try to apply the clip as a clipPath. 57 // First, try to apply the clip as a clipPath.
58 Path clipPath; 58 Path clipPath;
59 if (m_clip.asPath(animatedLocalTransform, targetBoundingBox, clipPath)) { 59 if (m_clip.asPath(animatedLocalTransform, targetBoundingBox, clipPath)) {
60 AffineTransform positionTransform; 60 AffineTransform positionTransform;
61 positionTransform.translate(layerPositionOffset.x(), layerPositionOffset .y()); 61 positionTransform.translate(layerPositionOffset.x(), layerPositionOffset .y());
62 clipPath.transform(positionTransform); 62 clipPath.transform(positionTransform);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Create a clipPathClipper if this clipPath is clipped by another clipP ath. 117 // Create a clipPathClipper if this clipPath is clipped by another clipP ath.
118 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj ect(&m_clip); 118 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj ect(&m_clip);
119 LayoutSVGResourceClipper* clipPathClipper = resources ? resources->clipp er() : nullptr; 119 LayoutSVGResourceClipper* clipPathClipper = resources ? resources->clipp er() : nullptr;
120 ClipperState clipPathClipperState = ClipperNotApplied; 120 ClipperState clipPathClipperState = ClipperNotApplied;
121 if (clipPathClipper && !SVGClipPainter(*clipPathClipper).prepareEffect(m _clip, targetBoundingBox, targetPaintInvalidationRect, layerPositionOffset, mask Context, clipPathClipperState)) 121 if (clipPathClipper && !SVGClipPainter(*clipPathClipper).prepareEffect(m _clip, targetBoundingBox, targetPaintInvalidationRect, layerPositionOffset, mask Context, clipPathClipperState))
122 return false; 122 return false;
123 123
124 { 124 {
125 AffineTransform contentTransform; 125 AffineTransform contentTransform;
126 if (m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUN DINGBOX) { 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 RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPic ture(); 133 RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPic ture();
134 maskContext.getPaintController().createAndAppend<DrawingDisplayItem> (layoutObject, DisplayItem::SVGClip, clipContentPicture.get()); 134 maskContext.getPaintController().createAndAppend<DrawingDisplayItem> (layoutObject, DisplayItem::SVGClip, clipContentPicture.get());
135 } 135 }
136 136
137 if (clipPathClipper) 137 if (clipPathClipper)
138 SVGClipPainter(*clipPathClipper).finishEffect(m_clip, maskContext, c lipPathClipperState); 138 SVGClipPainter(*clipPathClipper).finishEffect(m_clip, maskContext, c lipPathClipperState);
139 } 139 }
140 140
141 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGClip, targetPaintInvalidationRect); 141 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGClip, targetPaintInvalidationRect);
142 RefPtr<SkPicture> maskPicture = maskPictureBuilder.endRecording(); 142 RefPtr<SkPicture> maskPicture = maskPictureBuilder.endRecording();
143 context.drawPicture(maskPicture.get()); 143 context.drawPicture(maskPicture.get());
144 return true; 144 return true;
145 } 145 }
146 146
147 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | third_party/WebKit/Source/core/paint/SVGImagePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698