Commit e9c618b6 authored by jean-pierre charras's avatar jean-pierre charras

gr_basic: fix incorrect clipping of thick lines (due to changes in code, the...

gr_basic: fix incorrect clipping of thick lines (due to changes in code, the thickness was not taken in account to calculate the clip box size)
parent bf44999a
......@@ -43,7 +43,7 @@ after calling this conversion function, the comma is changed in point.
(Happens after reading a parameter stored in a wxConfig structure, if this
parameter is a double)
Workaround:
Use a version > 2.9.2
Use a version > 2.9.1
Currently ( 2011, april 12 ) the 2.9.2 is not yet finalized
(and can be found only on the wxWidgets snv server)
......
......@@ -326,18 +326,9 @@ static void WinClipAndDrawLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int
if( ClipBox )
{
xcliplo = ClipBox->GetX();
ycliplo = ClipBox->GetY();
xcliphi = ClipBox->GetRight();
ycliphi = ClipBox->GetBottom();
xcliplo -= width;
ycliplo -= width;
xcliphi += width;
ycliphi += width;
if( clipLine( ClipBox, x1, y1, x2, y2 ) )
EDA_RECT clipbox(*ClipBox);
clipbox.Inflate(width/2);
if( clipLine( &clipbox, x1, y1, x2, y2 ) )
return;
}
......@@ -663,18 +654,10 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
if( ClipBox )
{
xcliplo = ClipBox->GetX();
ycliplo = ClipBox->GetY();
xcliphi = ClipBox->GetRight();
ycliphi = ClipBox->GetHeight();
EDA_RECT clipbox(*ClipBox);
clipbox.Inflate(width/2);
xcliplo -= width;
ycliplo -= width;
xcliphi += width;
ycliphi += width;
if( clipLine( ClipBox, x1, y1, x2, y2 ) )
if( clipLine( &clipbox, x1, y1, x2, y2 ) )
return;
}
......@@ -1345,12 +1328,19 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
points[4] = points[0];
GRSetColorPen( aDC, aColor, aWidth, aStyle );
GRSetBrush( aDC, BLACK );
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5); // polygon approach is more accurate
if( aClipBox )
{
EDA_RECT clipbox(*aClipBox);
clipbox.Inflate(aWidth);
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
}
else
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
}
void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int Color, int BgColor )
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
int aWidth, int aColor, int aBgColor )
{
wxPoint points[5];
......@@ -1359,9 +1349,16 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
points[2] = wxPoint(x2, y2);
points[3] = wxPoint(x2, y1);
points[4] = points[0];
GRSetBrush( DC, BgColor, FILLED );
GRSetColorPen( DC, BgColor, width );
ClipAndDrawFilledPoly(ClipBox, DC, points, 5); // polygon approach is more accurate
GRSetBrush( aDC, aBgColor, FILLED );
GRSetColorPen( aDC, aBgColor, aWidth );
if( aClipBox && (aWidth > 0) )
{
EDA_RECT clipbox(*aClipBox);
clipbox.Inflate(aWidth);
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
}
else
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment