Esempio n. 1
0
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);
    }
}
Esempio n. 2
0
void SVGShapePainter::strokeZeroLengthLineCaps(GraphicsContext* context)
{
    const Vector<FloatPoint>* zeroLengthLineCaps = m_renderSVGShape.zeroLengthLineCaps();
    if (!zeroLengthLineCaps || zeroLengthLineCaps->isEmpty())
        return;

    Path* usePath;
    AffineTransform nonScalingTransform;

    if (m_renderSVGShape.hasNonScalingStroke())
        nonScalingTransform = m_renderSVGShape.nonScalingStrokeTransform();

    GraphicsContextStateSaver stateSaver(*context, true);
    useStrokeStyleToFill(context);
    for (size_t i = 0; i < zeroLengthLineCaps->size(); ++i) {
        usePath = zeroLengthLinecapPath((*zeroLengthLineCaps)[i]);
        if (m_renderSVGShape.hasNonScalingStroke())
            usePath = m_renderSVGShape.nonScalingStrokePath(usePath, nonScalingTransform);
        context->fillPath(*usePath);
    }
}