Browse Source

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.
7.0
Kliment 3 years ago
committed by Seth Hillbrand
parent
commit
68eac74458
  1. 4
      pcbnew/import_gfx/graphics_importer_buffer.cpp
  2. 2
      pcbnew/import_gfx/graphics_importer_buffer.h

4
pcbnew/import_gfx/graphics_importer_buffer.cpp

@ -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;

2
pcbnew/import_gfx/graphics_importer_buffer.h

@ -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;

Loading…
Cancel
Save