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

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

Issue 2045253005: Re-implement SVG transform paint property nodes [spv2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 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"
11 #include "core/layout/svg/SVGResources.h" 11 #include "core/layout/svg/SVGResources.h"
12 #include "core/layout/svg/SVGResourcesCache.h" 12 #include "core/layout/svg/SVGResourcesCache.h"
13 #include "core/paint/FloatClipRecorder.h" 13 #include "core/paint/FloatClipRecorder.h"
14 #include "core/paint/LayoutObjectDrawingRecorder.h" 14 #include "core/paint/LayoutObjectDrawingRecorder.h"
15 #include "core/paint/ObjectPaintProperties.h"
15 #include "core/paint/ObjectPainter.h" 16 #include "core/paint/ObjectPainter.h"
16 #include "core/paint/PaintInfo.h" 17 #include "core/paint/PaintInfo.h"
17 #include "core/paint/SVGContainerPainter.h" 18 #include "core/paint/SVGContainerPainter.h"
18 #include "core/paint/SVGPaintContext.h" 19 #include "core/paint/SVGPaintContext.h"
19 #include "core/paint/TransformRecorder.h" 20 #include "core/paint/TransformRecorder.h"
20 #include "platform/graphics/GraphicsContextStateSaver.h" 21 #include "platform/graphics/GraphicsContextStateSaver.h"
22 #include "platform/graphics/paint/ScopedPaintChunkProperties.h"
21 #include "platform/graphics/paint/SkPictureBuilder.h" 23 #include "platform/graphics/paint/SkPictureBuilder.h"
22 #include "third_party/skia/include/core/SkPaint.h" 24 #include "third_party/skia/include/core/SkPaint.h"
23 #include "third_party/skia/include/core/SkPicture.h" 25 #include "third_party/skia/include/core/SkPicture.h"
24 #include "wtf/Optional.h" 26 #include "wtf/Optional.h"
25 27
26 namespace blink { 28 namespace blink {
27 29
28 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph icsContextStateSaver& stateSaver) 30 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph icsContextStateSaver& stateSaver)
29 { 31 {
30 if (!strokeTransform.isInvertible()) 32 if (!strokeTransform.isInvertible())
(...skipping 14 matching lines...) Expand all
45 if (paintInfo.phase != PaintPhaseForeground 47 if (paintInfo.phase != PaintPhaseForeground
46 || m_layoutSVGShape.style()->visibility() == HIDDEN 48 || m_layoutSVGShape.style()->visibility() == HIDDEN
47 || m_layoutSVGShape.isShapeEmpty()) 49 || m_layoutSVGShape.isShapeEmpty())
48 return; 50 return;
49 51
50 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalSVGCoor dinates(); 52 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalSVGCoor dinates();
51 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGShape.localSVGTransf orm(), boundingBox)) 53 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGShape.localSVGTransf orm(), boundingBox))
52 return; 54 return;
53 55
54 PaintInfo paintInfoBeforeFiltering(paintInfo); 56 PaintInfo paintInfoBeforeFiltering(paintInfo);
57
58 // FIXME(pdr): Extract this out and use it in all non-root SVG painters.
jbroman 2016/06/09 22:16:49 TODO, not FIXME (also below). Why have you travele
pdr. 2016/06/09 23:39:04 WTF::ShameCube(pdr) We should add a presubmit scr
59 Optional<ScopedPaintChunkProperties> propertyScope;
60 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
61 const auto* objectProperties = m_layoutSVGShape.objectPaintProperties();
62 if (objectProperties && objectProperties->transform()) {
63 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon troller();
64 PaintChunkProperties properties(paintController.currentPaintChunkPro perties());
65 // FIXME(pdr): Include other properties such as effects and clips to o.
66 properties.transform = objectProperties->transform();
67 propertyScope.emplace(paintController, properties);
68 }
69 }
70
55 // Shapes cannot have children so do not call updateCullRect. 71 // Shapes cannot have children so do not call updateCullRect.
56 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGShape, m_layoutSVGShape.localSVGTransform()); 72 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGShape, m_layoutSVGShape.localSVGTransform());
57 { 73 {
58 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering) ; 74 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering) ;
59 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra wingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_lay outSVGShape, paintContext.paintInfo().phase)) { 75 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra wingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_lay outSVGShape, paintContext.paintInfo().phase)) {
60 LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().contex t, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox); 76 LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().contex t, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox);
61 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl e(); 77 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl e();
62 78
63 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES && svgStyle.shapeRendering() != SR_OPTIMIZESPEED; 79 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES && svgStyle.shapeRendering() != SR_OPTIMIZESPEED;
64 80
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return; 231 return;
216 232
217 TransformRecorder transformRecorder(paintInfo.context, marker, marker.marker Transformation(position.origin, position.angle, strokeWidth)); 233 TransformRecorder transformRecorder(paintInfo.context, marker, marker.marker Transformation(position.origin, position.angle, strokeWidth));
218 Optional<FloatClipRecorder> clipRecorder; 234 Optional<FloatClipRecorder> clipRecorder;
219 if (SVGLayoutSupport::isOverflowHidden(&marker)) 235 if (SVGLayoutSupport::isOverflowHidden(&marker))
220 clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, marker. viewport()); 236 clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, marker. viewport());
221 SVGContainerPainter(marker).paint(paintInfo); 237 SVGContainerPainter(marker).paint(paintInfo);
222 } 238 }
223 239
224 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698