hi Team, While going through Blink's commits, I came across following simplification commit: Blink Commit: https://chromium.googlesource.com/chromium/blink/+/a2034c0f6210c1e9f5897340a37e29873575ed2e WebKit Source: https://searchfox.org/wubkat/rev/1a7afa1ea1ff078e0856c604cc572aa47d35f2eb/Source/WebCore/svg/SVGPathParser.cpp#197 etc. Locally following compiles: static FloatPoint blendPoints(const FloatPoint& p1, const FloatPoint& p2) { const float oneOverThree = 1 / 3.f; return FloatPoint((p1.x() + 2 * p2.x()) * oneOverThree, (p1.y() + 2 * p2.y()) * oneOverThree); } and static FloatPoint reflectedPoint(const FloatPoint& reflectIn, const FloatPoint& pointToReflect) { return FloatPoint(2 * reflectIn.x() - pointToReflect.x(), 2 * reflectIn.y() - pointToReflect.y()); } and then following modified: bool SVGPathParser::parseCurveToQuadraticSmoothSegment() { auto result = m_source.parseCurveToQuadraticSmoothSegment(); if (!result) return false; if (m_lastCommand != SVGPathSegType::CurveToQuadraticAbs && m_lastCommand != SVGPathSegType::CurveToQuadraticRel && m_lastCommand != SVGPathSegType::CurveToQuadraticSmoothAbs && m_lastCommand != SVGPathSegType::CurveToQuadraticSmoothRel) m_controlPoint = m_currentPoint; if (m_pathParsingMode == NormalizedParsing) { if (m_mode == RelativeCoordinates) { result->targetPoint += m_currentPoint; } m_controlPoint = reflectedPoint(m_currentPoint, m_controlPoint); FloatPoint point1 = blendPoints(m_currentPoint, m_controlPoint); FloatPoint point2 = blendPoints(result->targetPoint, m_controlPoint); m_consumer.curveToCubic(point1, point2, result->targetPoint, AbsoluteCoordinates); m_currentPoint = result->targetPoint; } else m_consumer.curveToQuadraticSmooth(result->targetPoint, m_mode); and bool SVGPathParser::parseCurveToQuadraticSegment() { auto result = m_source.parseCurveToQuadraticSegment(); if (!result) return false; if (m_pathParsingMode == NormalizedParsing) { m_controlPoint = result->point1; if (m_mode == RelativeCoordinates) { m_controlPoint += m_currentPoint; result->targetPoint += m_currentPoint; } result->point1 = blendPoints(m_currentPoint, m_controlPoint); FloatPoint point2 = blendPoints(result->targetPoint, m_controlPoint); m_consumer.curveToCubic(result->point1, point2, result->targetPoint, AbsoluteCoordinates); m_currentPoint = result->targetPoint; } else m_consumer.curveToQuadratic(result->point1, result->targetPoint, m_mode); return true; } ___ Just wanted to raise and ask for input, if it is worth merging. Thanks!
<rdar://problem/119578490>