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/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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Shapes cannot have children so do not call updateCullRectForSVGTransform. | 57 // Shapes cannot have children so do not call updateCullRectForSVGTransform. |
58 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGShape, m_layoutSVGShape.localTransform()); | 58 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGShape, m_layoutSVGShape.localTransform()); |
59 { | 59 { |
60 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering)
; | 60 SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering)
; |
61 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra
wingRecorder::useCachedDrawingIfPossible(*paintContext.paintInfo().context, m_la
youtSVGShape, paintContext.paintInfo().phase)) { | 61 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra
wingRecorder::useCachedDrawingIfPossible(*paintContext.paintInfo().context, m_la
youtSVGShape, paintContext.paintInfo().phase)) { |
62 LayoutObjectDrawingRecorder recorder(*paintContext.paintInfo().conte
xt, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox); | 62 LayoutObjectDrawingRecorder recorder(*paintContext.paintInfo().conte
xt, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox); |
63 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl
e(); | 63 const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyl
e(); |
64 | 64 |
65 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES; | 65 bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES; |
66 | 66 |
67 for (int i = 0; i < 3; i++) { | 67 auto paintOrder = svgStyle.paintTypesForPaintOrder(); |
68 switch (svgStyle.paintOrderType(i)) { | 68 for (unsigned i = 0; i < paintOrder.size(); ++i) { |
| 69 switch (paintOrder.at(i)) { |
69 case PT_FILL: { | 70 case PT_FILL: { |
70 SkPaint fillPaint; | 71 SkPaint fillPaint; |
71 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)) |
72 break; | 73 break; |
73 fillPaint.setAntiAlias(shouldAntiAlias); | 74 fillPaint.setAntiAlias(shouldAntiAlias); |
74 fillShape(paintContext.paintInfo().context, fillPaint, fillR
uleFromStyle(paintContext.paintInfo(), svgStyle)); | 75 fillShape(paintContext.paintInfo().context, fillPaint, fillR
uleFromStyle(paintContext.paintInfo(), svgStyle)); |
75 break; | 76 break; |
76 } | 77 } |
77 case PT_STROKE: | 78 case PT_STROKE: |
78 if (svgStyle.hasVisibleStroke()) { | 79 if (svgStyle.hasVisibleStroke()) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 position = nonScalingTransform.mapPoint(position); | 256 position = nonScalingTransform.mapPoint(position); |
256 FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect(position, m
_layoutSVGShape.strokeWidth()); | 257 FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect(position, m
_layoutSVGShape.strokeWidth()); |
257 if (m_layoutSVGShape.style()->svgStyle().capStyle() == SquareCap) | 258 if (m_layoutSVGShape.style()->svgStyle().capStyle() == SquareCap) |
258 context->drawRect(subpathRect, fillPaint); | 259 context->drawRect(subpathRect, fillPaint); |
259 else | 260 else |
260 context->drawOval(subpathRect, fillPaint); | 261 context->drawOval(subpathRect, fillPaint); |
261 } | 262 } |
262 } | 263 } |
263 | 264 |
264 } // namespace blink | 265 } // namespace blink |
OLD | NEW |