FloatRect RenderSVGShape::calculateStrokeBoundingBox() const { ASSERT(m_path); FloatRect strokeBoundingBox = m_fillBoundingBox; const SVGRenderStyle& svgStyle = style().svgStyle(); if (svgStyle.hasStroke()) { BoundingRectStrokeStyleApplier strokeStyle(*this); if (hasNonScalingStroke()) { AffineTransform nonScalingTransform = nonScalingStrokeTransform(); if (Optional<AffineTransform> inverse = nonScalingTransform.inverse()) { Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); strokeBoundingRect = inverse.value().mapRect(strokeBoundingRect); strokeBoundingBox.unite(strokeBoundingRect); } } else strokeBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); } if (!m_markerPositions.isEmpty()) strokeBoundingBox.unite(markerRect(strokeWidth())); return strokeBoundingBox; }
void RenderSVGPath::strokeShape(GraphicsContext& context) const { if (!style().svgStyle().hasVisibleStroke()) return; RenderSVGShape::strokeShape(context); if (m_zeroLengthLinecapLocations.isEmpty()) return; Path* usePath; AffineTransform nonScalingTransform; if (hasNonScalingStroke()) nonScalingTransform = nonScalingStrokeTransform(); GraphicsContextStateSaver stateSaver(context, true); useStrokeStyleToFill(context); for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { usePath = zeroLengthLinecapPath(m_zeroLengthLinecapLocations[i]); if (hasNonScalingStroke()) usePath = nonScalingStrokePath(usePath, nonScalingTransform); context.fillPath(*usePath); } }
void RenderSVGShape::strokeShape(GraphicsContext* context) const { ASSERT(m_path); Path* usePath = m_path.get(); if (hasNonScalingStroke()) usePath = nonScalingStrokePath(usePath, nonScalingStrokeTransform()); context->strokePath(*usePath); }
void RenderSVGShape::strokeShape(GraphicsContext& context) { if (!style().svgStyle().hasVisibleStroke()) return; GraphicsContextStateSaver stateSaver(context, false); if (hasNonScalingStroke()) { AffineTransform nonScalingTransform = nonScalingStrokeTransform(); if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver)) return; } strokeShape(style(), context); }
bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point) { ASSERT(m_path); BoundingRectStrokeStyleApplier applier(this, style()); if (hasNonScalingStroke()) { AffineTransform nonScalingTransform = nonScalingStrokeTransform(); Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); return usePath->strokeContains(&applier, nonScalingTransform.mapPoint(point)); } return m_path->strokeContains(&applier, point); }
bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point) { ASSERT(m_path); StrokeData strokeData; SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); if (hasNonScalingStroke()) { AffineTransform nonScalingTransform = nonScalingStrokeTransform(); Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); return usePath->strokeContains(nonScalingTransform.mapPoint(point), strokeData); } return m_path->strokeContains(point, strokeData); }
FloatRect LayoutSVGShape::calculateStrokeBoundingBox() const { ASSERT(m_path); FloatRect strokeBoundingBox = m_fillBoundingBox; if (style()->svgStyle().hasStroke()) { StrokeData strokeData; SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this); if (hasNonScalingStroke()) { AffineTransform nonScalingTransform = nonScalingStrokeTransform(); if (nonScalingTransform.isInvertible()) { Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strokeData); strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); strokeBoundingBox.unite(strokeBoundingRect); } } else { strokeBoundingBox.unite(path().strokeBoundingRect(strokeData)); } } return strokeBoundingBox; }