7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 18:31:40 +00:00

SVG import: avoid duplicating points in line chains

Every new section duplicated the start/end points.

This saves half the points when importing. They're skipped later
before they end up as real items, but it's confusing to trace
through (and theoretically inefficent, but it'll be tiny).
This commit is contained in:
John Beard 2024-12-31 21:55:52 +08:00
parent 10485848b8
commit 3bd3b8073e

View File

@ -306,7 +306,9 @@ void SVG_IMPORT_PLUGIN::DrawCubicBezierCurve( const float* aPoints,
auto end = getBezierPoint( aPoints, 1.0f );
auto segmentationThreshold = calculateBezierSegmentationThreshold( aPoints );
aGeneratedPoints.push_back( start );
if( aGeneratedPoints.size() == 0 || aGeneratedPoints.back() != start )
aGeneratedPoints.push_back( start );
segmentBezierCurve( start, end, 0.0f, 0.5f, aPoints, segmentationThreshold, aGeneratedPoints );
aGeneratedPoints.push_back( end );
}