| 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 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SVGShapePainter::paint(const PaintInfo& paintInfo) | 43 void SVGShapePainter::paint(const PaintInfo& paintInfo) |
| 44 { | 44 { |
| 45 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGShape); | 45 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGShape); |
| 46 if (paintInfo.phase != PaintPhaseForeground | 46 if (paintInfo.phase != PaintPhaseForeground |
| 47 || m_renderSVGShape.style()->visibility() == HIDDEN | 47 || m_renderSVGShape.style()->visibility() == HIDDEN |
| 48 || m_renderSVGShape.isShapeEmpty()) | 48 || m_renderSVGShape.isShapeEmpty()) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 FloatRect boundingBox = m_renderSVGShape.paintInvalidationRectInLocalCoordin
ates(); | |
| 52 if (!SVGRenderSupport::paintInfoIntersectsPaintInvalidationRect(boundingBox,
m_renderSVGShape.localTransform(), paintInfo)) | |
| 53 return; | |
| 54 | |
| 55 PaintInfo childPaintInfo(paintInfo); | 51 PaintInfo childPaintInfo(paintInfo); |
| 56 | 52 |
| 57 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 53 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
| 58 childPaintInfo.applyTransform(m_renderSVGShape.localTransform()); | 54 childPaintInfo.applyTransform(m_renderSVGShape.localTransform()); |
| 59 | 55 |
| 60 SVGRenderingContext renderingContext(&m_renderSVGShape, childPaintInfo); | 56 SVGRenderingContext renderingContext(&m_renderSVGShape, childPaintInfo); |
| 61 | 57 |
| 62 if (renderingContext.isRenderingPrepared()) { | 58 if (renderingContext.isRenderingPrepared()) { |
| 63 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgStyle(); | 59 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgStyle(); |
| 64 if (svgStyle.shapeRendering() == SR_CRISPEDGES) | 60 if (svgStyle.shapeRendering() == SR_CRISPEDGES) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 paintMarkers(childPaintInfo); | 93 paintMarkers(childPaintInfo); |
| 98 break; | 94 break; |
| 99 default: | 95 default: |
| 100 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
| 101 break; | 97 break; |
| 102 } | 98 } |
| 103 } | 99 } |
| 104 } | 100 } |
| 105 | 101 |
| 106 if (m_renderSVGShape.style()->outlineWidth()) | 102 if (m_renderSVGShape.style()->outlineWidth()) |
| 107 ObjectPainter(m_renderSVGShape).paintOutline(childPaintInfo, IntRect(bou
ndingBox)); | 103 ObjectPainter(m_renderSVGShape).paintOutline(childPaintInfo, IntRect(m_r
enderSVGShape.paintInvalidationRectInLocalCoordinates())); |
| 108 } | 104 } |
| 109 | 105 |
| 110 void SVGShapePainter::fillShape(GraphicsContext* context) | 106 void SVGShapePainter::fillShape(GraphicsContext* context) |
| 111 { | 107 { |
| 112 switch (m_renderSVGShape.geometryCodePath()) { | 108 switch (m_renderSVGShape.geometryCodePath()) { |
| 113 case RectGeometryFastPath: | 109 case RectGeometryFastPath: |
| 114 context->fillRect(m_renderSVGShape.objectBoundingBox()); | 110 context->fillRect(m_renderSVGShape.objectBoundingBox()); |
| 115 break; | 111 break; |
| 116 case EllipseGeometryFastPath: | 112 case EllipseGeometryFastPath: |
| 117 context->fillEllipse(m_renderSVGShape.objectBoundingBox()); | 113 context->fillEllipse(m_renderSVGShape.objectBoundingBox()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 tempPath.clear(); | 212 tempPath.clear(); |
| 217 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap) | 213 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap) |
| 218 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m
_renderSVGShape.strokeWidth())); | 214 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m
_renderSVGShape.strokeWidth())); |
| 219 else | 215 else |
| 220 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition
, m_renderSVGShape.strokeWidth())); | 216 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition
, m_renderSVGShape.strokeWidth())); |
| 221 | 217 |
| 222 return &tempPath; | 218 return &tempPath; |
| 223 } | 219 } |
| 224 | 220 |
| 225 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |