[Webkit-unassigned] [Bug 265914] Simplify SVGPathBlender::blendArcToSegment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 5 16:23:12 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=265914

--- Comment #1 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
FloatPoint SVGPathBlender::blendAnimatedFloatPointSameCoordinates(const FloatPoint& fromPoint, const FloatPoint& toPoint, float progress)
{
    if (m_addTypesCount) {
        FloatPoint repeatedToPoint = toPoint;
        repeatedToPoint.scale(m_addTypesCount);
        return fromPoint + repeatedToPoint;
    }
    return blendFloatPoint(fromPoint, toPoint, progress);
}

and:

FloatPoint SVGPathBlender::blendAnimatedFloatPoint(const FloatPoint& fromPoint, const FloatPoint& toPoint, float progress)
{
    if (m_fromMode == m_toMode)
        return blendAnimatedFloatPointSameCoordinates(fromPoint, toPoint, progress);
    // Transform toPoint to the coordinate mode of fromPoint
    FloatPoint animatedPoint = toPoint;

___

bool SVGPathBlender::blendArcToSegment(float progress)
{
    auto result = pullFromSources(m_fromSource, m_toSource, &SVGPathSource::parseArcToSegment);
    if (!result)
        return false;
    if (!m_consumer)
        return true;
    auto [from, to] = *result;
    ASSERT(!m_addTypesCount || m_fromMode == m_toMode);
    FloatPoint blendedRadii = blendAnimatedFloatPointSameCoordinates(FloatPoint(from.rx, from.ry), FloatPoint(to.rx, to.ry), progress);
    float blendedAngle = blendAnimatedFloatPointSameCoordinates(FloatPoint(from.angle, 0), FloatPoint(to.angle, 0), progress).x();
    bool blendedLargeArc;
    bool blendedSweep;
    if (m_addTypesCount) {
        blendedLargeArc = from.largeArc || to.largeArc;
        blendedSweep = from.sweep || to.sweep;
    } else {
        blendedLargeArc = m_isInFirstHalfOfAnimation ? from.largeArc : to.largeArc;
        blendedSweep = m_isInFirstHalfOfAnimation ? from.sweep : to.sweep;
    }
    m_consumer->arcTo(
        blendedRadii.x(), blendedRadii.y(), blendedAngle, blendedLargeArc, blendedSweep,
        blendAnimatedFloatPoint(from.targetPoint, to.targetPoint, progress),
        m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode);
    m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? from.targetPoint : m_fromCurrentPoint + from.targetPoint;
    m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? to.targetPoint : m_toCurrentPoint + to.targetPoint;
    return true;

___

This compiles.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231206/a6a29c83/attachment-0001.htm>


More information about the webkit-unassigned mailing list