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

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

Issue 1308983007: Move painting code out of LayoutSVGResourceClipper (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/paint/SVGClipPainter.h" 6 #include "core/paint/SVGClipPainter.h"
7 7
8 #include "core/dom/ElementTraversal.h" 8 #include "core/dom/ElementTraversal.h"
9 #include "core/layout/svg/LayoutSVGResourceClipper.h" 9 #include "core/layout/svg/LayoutSVGResourceClipper.h"
10 #include "core/layout/svg/SVGResources.h" 10 #include "core/layout/svg/SVGResources.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 AffineTransform animatedLocalTransform = toSVGClipPathElement(m_clip.element ())->calculateAnimatedLocalTransform(); 53 AffineTransform animatedLocalTransform = toSVGClipPathElement(m_clip.element ())->calculateAnimatedLocalTransform();
54 // When drawing a clip for non-SVG elements, the CTM does not include the zo om factor. 54 // When drawing a clip for non-SVG elements, the CTM does not include the zo om factor.
55 // In this case, we need to apply the zoom scale explicitly - but only for c lips with 55 // In this case, we need to apply the zoom scale explicitly - but only for c lips with
56 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve d lengths). 56 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve d lengths).
57 if (!target.isSVG() && m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE _USERSPACEONUSE) { 57 if (!target.isSVG() && m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE _USERSPACEONUSE) {
58 ASSERT(m_clip.style()); 58 ASSERT(m_clip.style());
59 animatedLocalTransform.scale(m_clip.style()->effectiveZoom()); 59 animatedLocalTransform.scale(m_clip.style()->effectiveZoom());
60 } 60 }
61 61
62 // First, try to apply the clip as a clipPath. 62 // First, try to apply the clip as a clipPath.
63 if (m_clip.tryPathOnlyClipping(target, context, animatedLocalTransform, targ etBoundingBox)) { 63 Path clipPath;
64 if (m_clip.asPath(animatedLocalTransform, targetBoundingBox, clipPath)) {
64 clipperState = ClipperAppliedPath; 65 clipperState = ClipperAppliedPath;
66 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
67 if (!context->displayItemList()->displayItemConstructionIsDisabled() )
68 context->displayItemList()->createAndAppend<BeginClipPathDisplay Item>(target, clipPath);
69 } else {
70 BeginClipPathDisplayItem clipPathDisplayItem(target, clipPath);
71 clipPathDisplayItem.replay(*context);
72 }
65 return true; 73 return true;
66 } 74 }
67 75
68 // Fall back to masking. 76 // Fall back to masking.
69 clipperState = ClipperAppliedMask; 77 clipperState = ClipperAppliedMask;
70 78
71 // Begin compositing the clip mask. 79 // Begin compositing the clip mask.
72 CompositingRecorder::beginCompositing(*context, target, SkXfermode::kSrcOver _Mode, 1, &paintInvalidationRect); 80 CompositingRecorder::beginCompositing(*context, target, SkXfermode::kSrcOver _Mode, 1, &paintInvalidationRect);
73 { 81 {
74 TransformRecorder recorder(*context, target, animatedLocalTransform); 82 TransformRecorder recorder(*context, target, animatedLocalTransform);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return; 143 return;
136 144
137 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI tem::SVGClip, targetPaintInvalidationRect); 145 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI tem::SVGClip, targetPaintInvalidationRect);
138 context->save(); 146 context->save();
139 context->concatCTM(contentTransformation); 147 context->concatCTM(contentTransformation);
140 context->drawPicture(clipContentPicture.get()); 148 context->drawPicture(clipContentPicture.get());
141 context->restore(); 149 context->restore();
142 } 150 }
143 151
144 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698