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

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

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 "config.h" 5 #include "config.h"
6 #include "core/paint/SVGShapePainter.h" 6 #include "core/paint/SVGShapePainter.h"
7 7
8 #include "core/layout/svg/LayoutSVGPath.h" 8 #include "core/layout/svg/LayoutSVGPath.h"
9 #include "core/layout/svg/LayoutSVGResourceMarker.h" 9 #include "core/layout/svg/LayoutSVGResourceMarker.h"
10 #include "core/layout/svg/LayoutSVGShape.h" 10 #include "core/layout/svg/LayoutSVGShape.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalCoordin ates(); 53 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalCoordin ates();
54 if (!paintInfo.intersectsCullRect(m_layoutSVGShape.localTransform(), boundin gBox)) 54 if (!paintInfo.intersectsCullRect(m_layoutSVGShape.localTransform(), boundin gBox))
55 return; 55 return;
56 56
57 PaintInfo paintInfoBeforeFiltering(paintInfo); 57 PaintInfo paintInfoBeforeFiltering(paintInfo);
58 // Shapes cannot have children so do not call updateCullRectForSVGTransform. 58 // Shapes cannot have children so do not call updateCullRectForSVGTransform.
59 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGShape, m_layoutSVGShape.localTransform()); 59 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGShape, m_layoutSVGShape.localTransform());
60 { 60 {
61 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering) ; 61 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering) ;
62 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra wingRecorder::useCachedDrawingIfPossible(*paintContext.paintInfo().context, m_la youtSVGShape, paintContext.paintInfo().phase)) { 62 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra wingRecorder::useCachedDrawingIfPossible(*paintContext.paintInfo().context, m_la youtSVGShape, paintContext.paintInfo().phase, LayoutPoint())) {
63 LayoutObjectDrawingRecorder recorder(*paintContext.paintInfo().conte xt, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox); 63 LayoutObjectDrawingRecorder recorder(*paintContext.paintInfo().conte xt, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox, LayoutPoint() );
64 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl e(); 64 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl e();
65 65
66 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES; 66 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES;
67 67
68 for (int i = 0; i < 3; i++) { 68 for (int i = 0; i < 3; i++) {
69 switch (svgStyle.paintOrderType(i)) { 69 switch (svgStyle.paintOrderType(i)) {
70 case PT_FILL: { 70 case PT_FILL: {
71 SkPaint fillPaint; 71 SkPaint fillPaint;
72 if (!SVGPaintContext::paintForLayoutObject(paintContext.pain tInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToFillMode, fillPai nt)) 72 if (!SVGPaintContext::paintForLayoutObject(paintContext.pain tInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToFillMode, fillPai nt))
73 break; 73 break;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 if (m_layoutSVGShape.style()->outlineWidth()) { 116 if (m_layoutSVGShape.style()->outlineWidth()) {
117 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); 117 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
118 outlinePaintInfo.phase = PaintPhaseSelfOutline; 118 outlinePaintInfo.phase = PaintPhaseSelfOutline;
119 LayoutRect layoutObjectBounds(boundingBox); 119 LayoutRect layoutObjectBounds(boundingBox);
120 LayoutRect visualOverflowRect = ObjectPainter::outlineBounds(layoutObjec tBounds, m_layoutSVGShape.styleRef()); 120 LayoutRect visualOverflowRect = ObjectPainter::outlineBounds(layoutObjec tBounds, m_layoutSVGShape.styleRef());
121 ObjectPainter(m_layoutSVGShape).paintOutline(outlinePaintInfo, layoutObj ectBounds, visualOverflowRect); 121 ObjectPainter(m_layoutSVGShape).paintOutline(outlinePaintInfo, layoutObj ectBounds, visualOverflowRect, LayoutPoint());
122 } 122 }
123 } 123 }
124 124
125 class PathWithTemporaryWindingRule { 125 class PathWithTemporaryWindingRule {
126 public: 126 public:
127 PathWithTemporaryWindingRule(Path& path, SkPath::FillType fillType) 127 PathWithTemporaryWindingRule(Path& path, SkPath::FillType fillType)
128 : m_path(const_cast<SkPath&>(path.skPath())) 128 : m_path(const_cast<SkPath&>(path.skPath()))
129 { 129 {
130 m_savedFillType = m_path.getFillType(); 130 m_savedFillType = m_path.getFillType();
131 m_path.setFillType(fillType); 131 m_path.setFillType(fillType);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 position = nonScalingTransform.mapPoint(position); 256 position = nonScalingTransform.mapPoint(position);
257 FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect(position, m _layoutSVGShape.strokeWidth()); 257 FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect(position, m _layoutSVGShape.strokeWidth());
258 if (m_layoutSVGShape.style()->svgStyle().capStyle() == SquareCap) 258 if (m_layoutSVGShape.style()->svgStyle().capStyle() == SquareCap)
259 context->drawRect(subpathRect, fillPaint); 259 context->drawRect(subpathRect, fillPaint);
260 else 260 else
261 context->drawOval(subpathRect, fillPaint); 261 context->drawOval(subpathRect, fillPaint);
262 } 262 }
263 } 263 }
264 264
265 } // namespace blink 265 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698