OLD | NEW |
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/paint/ObjectPainter.h" | 8 #include "core/paint/ObjectPainter.h" |
9 #include "core/paint/SVGContainerPainter.h" | 9 #include "core/paint/SVGContainerPainter.h" |
10 #include "core/rendering/GraphicsContextAnnotator.h" | 10 #include "core/rendering/GraphicsContextAnnotator.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 if (renderingContext.isRenderingPrepared()) { | 62 if (renderingContext.isRenderingPrepared()) { |
63 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgStyle(); | 63 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgStyle(); |
64 if (svgStyle.shapeRendering() == SR_CRISPEDGES) | 64 if (svgStyle.shapeRendering() == SR_CRISPEDGES) |
65 childPaintInfo.context->setShouldAntialias(false); | 65 childPaintInfo.context->setShouldAntialias(false); |
66 | 66 |
67 for (int i = 0; i < 3; i++) { | 67 for (int i = 0; i < 3; i++) { |
68 switch (svgStyle.paintOrderType(i)) { | 68 switch (svgStyle.paintOrderType(i)) { |
69 case PT_FILL: { | 69 case PT_FILL: { |
70 GraphicsContextStateSaver stateSaver(*childPaintInfo.context, fa
lse); | 70 GraphicsContextStateSaver stateSaver(*childPaintInfo.context, fa
lse); |
71 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, m_rende
rSVGShape.style(), m_renderSVGShape, ApplyToFillMode)) | 71 if (!SVGRenderSupport::updateGraphicsContext(childPaintInfo, sta
teSaver, m_renderSVGShape.style(), m_renderSVGShape, ApplyToFillMode)) |
72 break; | 72 break; |
73 fillShape(childPaintInfo.context); | 73 fillShape(childPaintInfo.context); |
74 break; | 74 break; |
75 } | 75 } |
76 case PT_STROKE: | 76 case PT_STROKE: |
77 if (svgStyle.hasVisibleStroke()) { | 77 if (svgStyle.hasVisibleStroke()) { |
78 GraphicsContextStateSaver stateSaver(*childPaintInfo.context
, false); | 78 GraphicsContextStateSaver stateSaver(*childPaintInfo.context
, false); |
79 AffineTransform nonScalingTransform; | 79 AffineTransform nonScalingTransform; |
80 const AffineTransform* additionalPaintServerTransform = 0; | 80 const AffineTransform* additionalPaintServerTransform = 0; |
81 | 81 |
82 if (m_renderSVGShape.hasNonScalingStroke()) { | 82 if (m_renderSVGShape.hasNonScalingStroke()) { |
83 nonScalingTransform = m_renderSVGShape.nonScalingStrokeT
ransform(); | 83 nonScalingTransform = m_renderSVGShape.nonScalingStrokeT
ransform(); |
84 if (!setupNonScalingStrokeContext(nonScalingTransform, s
tateSaver)) | 84 if (!setupNonScalingStrokeContext(nonScalingTransform, s
tateSaver)) |
85 return; | 85 return; |
86 | 86 |
87 // Non-scaling stroke needs to reset the transform back
to the host transform. | 87 // Non-scaling stroke needs to reset the transform back
to the host transform. |
88 additionalPaintServerTransform = &nonScalingTransform; | 88 additionalPaintServerTransform = &nonScalingTransform; |
89 } | 89 } |
90 | 90 |
91 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, m_r
enderSVGShape.style(), m_renderSVGShape, ApplyToStrokeMode, additionalPaintServe
rTransform)) | 91 if (!SVGRenderSupport::updateGraphicsContext(childPaintInfo,
stateSaver, m_renderSVGShape.style(), m_renderSVGShape, ApplyToStrokeMode, addi
tionalPaintServerTransform)) |
92 break; | 92 break; |
93 strokeShape(childPaintInfo.context); | 93 strokeShape(childPaintInfo.context); |
94 } | 94 } |
95 break; | 95 break; |
96 case PT_MARKERS: | 96 case PT_MARKERS: |
97 paintMarkers(childPaintInfo); | 97 paintMarkers(childPaintInfo); |
98 break; | 98 break; |
99 default: | 99 default: |
100 ASSERT_NOT_REACHED(); | 100 ASSERT_NOT_REACHED(); |
101 break; | 101 break; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 tempPath.clear(); | 216 tempPath.clear(); |
217 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap) | 217 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap) |
218 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m
_renderSVGShape.strokeWidth())); | 218 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m
_renderSVGShape.strokeWidth())); |
219 else | 219 else |
220 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition
, m_renderSVGShape.strokeWidth())); | 220 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition
, m_renderSVGShape.strokeWidth())); |
221 | 221 |
222 return &tempPath; | 222 return &tempPath; |
223 } | 223 } |
224 | 224 |
225 } // namespace blink | 225 } // namespace blink |
OLD | NEW |