pcbnew: Fix strokeWidth truncation to integer mm in SVG polygons import

The polygon conversion algorithm mistakenly stored the stroke width of
filled polygons in an integer variable. As a result, all stroke widths
were rounded down to the next smaller integer mm size. This commit changes
the types in the relevant functions and variables from int to double.
This commit is contained in:
Kliment 2023-01-31 17:12:54 +01:00 committed by Seth Hillbrand
parent 327956ae27
commit 68eac74458
2 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ void GRAPHICS_IMPORTER_BUFFER::ImportTo( GRAPHICS_IMPORTER& aImporter )
static void convertPolygon( std::list<std::unique_ptr<IMPORTED_SHAPE>>& aShapes,
std::vector<IMPORTED_POLYGON*>& aPaths,
GRAPHICS_IMPORTER::POLY_FILL_RULE aFillRule,
int aWidth )
double aWidth )
{
double minX = std::numeric_limits<double>::max();
double minY = minX;
@ -173,7 +173,7 @@ static void convertPolygon( std::list<std::unique_ptr<IMPORTED_SHAPE>>& aShapes,
void GRAPHICS_IMPORTER_BUFFER::PostprocessNestedPolygons()
{
int curShapeIdx = -1;
int lastWidth = 1;
double lastWidth = 0;
std::list<std::unique_ptr<IMPORTED_SHAPE>> newShapes;
std::vector<IMPORTED_POLYGON*> polypaths;

View File

@ -188,7 +188,7 @@ public:
std::vector<VECTOR2D>& Vertices() { return m_vertices; }
int GetWidth() const { return m_width; }
double GetWidth() const { return m_width; }
private:
std::vector<VECTOR2D> m_vertices;