Clamp egregiously large numbers when plotting.
This keeps some plot file viewers (such as Acrobat) from choking. Fixes https://gitlab.com/kicad/code/kicad/issues/4408
This commit is contained in:
parent
f5bbf24047
commit
c7da63151c
|
@ -95,6 +95,12 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
|
||||||
{
|
{
|
||||||
wxPoint pos = aCoordinate - plotOffset;
|
wxPoint pos = aCoordinate - plotOffset;
|
||||||
|
|
||||||
|
// Don't allow overflows; they can cause rendering failures in some file viewers
|
||||||
|
// (such as Acrobat)
|
||||||
|
int clampSize = MAX_PAGE_SIZE_MILS * m_IUsPerDecimil * 10 / 2;
|
||||||
|
pos.x = std::max( -clampSize, std::min( pos.x, clampSize ) );
|
||||||
|
pos.y = std::max( -clampSize, std::min( pos.y, clampSize ) );
|
||||||
|
|
||||||
double x = pos.x * plotScale;
|
double x = pos.x * plotScale;
|
||||||
double y = ( paperSize.y - pos.y * plotScale );
|
double y = ( paperSize.y - pos.y * plotScale );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue