Loading common/gr_basic.cpp +17 −77 Original line number Original line Diff line number Diff line Loading @@ -1336,92 +1336,32 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, int aColor, wxPenStyle aStyle ) int aWidth, int aColor, wxPenStyle aStyle ) { { if( x1 > x2 ) EXCHG( x1, x2 ); if( y1 > y2 ) EXCHG( y1, y2 ); if( aClipBox ) { int xmin = aClipBox->GetX(); int ymin = aClipBox->GetY(); int xmax = aClipBox->GetRight(); int ymax = aClipBox->GetBottom(); if( x1 > xmax ) return; if( x2 < xmin ) return; if( y1 > ymax ) return; if( y2 < ymin ) return; } wxPoint points[5]; points[0] = wxPoint(x1, y1); points[1] = wxPoint(x1, y2); points[2] = wxPoint(x2, y2); points[3] = wxPoint(x2, y1); points[4] = points[0]; GRSetColorPen( aDC, aColor, aWidth, aStyle ); GRSetColorPen( aDC, aColor, aWidth, aStyle ); if( ( x1 == x2 ) || ( y1 == y2 ) ) aDC->DrawLine( x1, y1, x2, y2 ); else { GRSetBrush( aDC, BLACK ); GRSetBrush( aDC, BLACK ); aDC->DrawRectangle( x1, y1, x2 - x1, y2 - y1 ); ClipAndDrawFilledPoly(aClipBox, aDC, points, 5); // polygon approach is more accurate } } } void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color, int BgColor ) int width, int Color, int BgColor ) { { if( x1 > x2 ) EXCHG( x1, x2 ); if( y1 > y2 ) EXCHG( y1, y2 ); if( ClipBox ) { int xmin = ClipBox->GetX(); int ymin = ClipBox->GetY(); int xmax = ClipBox->GetRight(); int ymax = ClipBox->GetBottom(); if( x1 > xmax ) return; if( x2 < xmin ) return; if( y1 > ymax ) return; if( y2 < ymin ) return; // Clipping coordinates if( x1 < xmin ) x1 = xmin - 1; if( y1 < ymin ) y1 = ymin - 1; if( x2 > xmax ) wxPoint points[5]; x2 = xmax + 1; points[0] = wxPoint(x1, y1); points[1] = wxPoint(x1, y2); if( y2 > ymax ) points[2] = wxPoint(x2, y2); y2 = ymax + 1; points[3] = wxPoint(x2, y1); } points[4] = points[0]; GRSetColorPen( DC, Color, width ); if( ( x1 == x2 ) || ( y1 == y2 ) ) DC->DrawLine( x1, y1, x2, y2 ); else { GRSetBrush( DC, BgColor, FILLED ); GRSetBrush( DC, BgColor, FILLED ); DC->DrawRectangle( x1, y1, x2 - x1, y2 - y1 ); GRSetColorPen( DC, BgColor, width ); } ClipAndDrawFilledPoly(ClipBox, DC, points, 5); // polygon approach is more accurate } } Loading Loading
common/gr_basic.cpp +17 −77 Original line number Original line Diff line number Diff line Loading @@ -1336,92 +1336,32 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, int aColor, wxPenStyle aStyle ) int aWidth, int aColor, wxPenStyle aStyle ) { { if( x1 > x2 ) EXCHG( x1, x2 ); if( y1 > y2 ) EXCHG( y1, y2 ); if( aClipBox ) { int xmin = aClipBox->GetX(); int ymin = aClipBox->GetY(); int xmax = aClipBox->GetRight(); int ymax = aClipBox->GetBottom(); if( x1 > xmax ) return; if( x2 < xmin ) return; if( y1 > ymax ) return; if( y2 < ymin ) return; } wxPoint points[5]; points[0] = wxPoint(x1, y1); points[1] = wxPoint(x1, y2); points[2] = wxPoint(x2, y2); points[3] = wxPoint(x2, y1); points[4] = points[0]; GRSetColorPen( aDC, aColor, aWidth, aStyle ); GRSetColorPen( aDC, aColor, aWidth, aStyle ); if( ( x1 == x2 ) || ( y1 == y2 ) ) aDC->DrawLine( x1, y1, x2, y2 ); else { GRSetBrush( aDC, BLACK ); GRSetBrush( aDC, BLACK ); aDC->DrawRectangle( x1, y1, x2 - x1, y2 - y1 ); ClipAndDrawFilledPoly(aClipBox, aDC, points, 5); // polygon approach is more accurate } } } void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color, int BgColor ) int width, int Color, int BgColor ) { { if( x1 > x2 ) EXCHG( x1, x2 ); if( y1 > y2 ) EXCHG( y1, y2 ); if( ClipBox ) { int xmin = ClipBox->GetX(); int ymin = ClipBox->GetY(); int xmax = ClipBox->GetRight(); int ymax = ClipBox->GetBottom(); if( x1 > xmax ) return; if( x2 < xmin ) return; if( y1 > ymax ) return; if( y2 < ymin ) return; // Clipping coordinates if( x1 < xmin ) x1 = xmin - 1; if( y1 < ymin ) y1 = ymin - 1; if( x2 > xmax ) wxPoint points[5]; x2 = xmax + 1; points[0] = wxPoint(x1, y1); points[1] = wxPoint(x1, y2); if( y2 > ymax ) points[2] = wxPoint(x2, y2); y2 = ymax + 1; points[3] = wxPoint(x2, y1); } points[4] = points[0]; GRSetColorPen( DC, Color, width ); if( ( x1 == x2 ) || ( y1 == y2 ) ) DC->DrawLine( x1, y1, x2, y2 ); else { GRSetBrush( DC, BgColor, FILLED ); GRSetBrush( DC, BgColor, FILLED ); DC->DrawRectangle( x1, y1, x2 - x1, y2 - y1 ); GRSetColorPen( DC, BgColor, width ); } ClipAndDrawFilledPoly(ClipBox, DC, points, 5); // polygon approach is more accurate } } Loading