From 48855ebe4009fb282bb11b0311e5b265ebfe3c18 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Sat, 4 Nov 2023 17:09:16 +0300 Subject: [PATCH] Graphics import: support open polygons. --- common/import_gfx/graphics_importer_buffer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/import_gfx/graphics_importer_buffer.cpp b/common/import_gfx/graphics_importer_buffer.cpp index 7a6ac21134..17eeb1d15f 100644 --- a/common/import_gfx/graphics_importer_buffer.cpp +++ b/common/import_gfx/graphics_importer_buffer.cpp @@ -144,10 +144,17 @@ static void convertPolygon( std::list>& aShapes, upscaledW = ( origW == 0.0f ? 0.0 : origW * convert_scale / origH ); } - std::vector upscaledPaths; + std::vector openPaths; + std::vector upscaledPaths; for( IMPORTED_POLYGON* path : aPaths ) { + if( path->Vertices().size() < 3 ) + { + openPaths.push_back( path ); + continue; + } + SHAPE_LINE_CHAIN lc; for( VECTOR2D& v : path->Vertices() ) @@ -178,6 +185,9 @@ static void convertPolygon( std::list>& aShapes, aShapes.push_back( std::make_unique( pts, aStroke, aFilled, aFillColor ) ); } + + for( IMPORTED_POLYGON* openPath : openPaths ) + aShapes.push_back( std::make_unique( *openPath ) ); }