( a DC->SetPen() was deleted by mistake)
This commit is contained in:
jean-pierre charras 2023-02-25 19:06:32 +01:00
parent 49a9fe38a0
commit bbfc5c272e
1 changed files with 13 additions and 16 deletions

View File

@ -95,31 +95,28 @@ void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width, wxPenStyle style
// wxWidgets will enforce a minimum pen width when printing, so we have to make the pen
// transparent when we don't want the object stroked.
if( width == 0 )
{
color = COLOR4D::UNSPECIFIED;
style = wxPENSTYLE_TRANSPARENT;
}
const wxPen& curr_pen = DC->GetPen();
if( !curr_pen.IsOk() || curr_pen.GetColour() != color.ToColour()
|| curr_pen.GetWidth() != width || curr_pen.GetStyle() != style )
{
if( width == 0 )
// COLOR4D::UNSPECIFIED (i.e. opacity = 0) does not work on all platforms
// So ensure the pen is transparent
DC->SetPen( *wxTRANSPARENT_PEN );
else
wxPen pen;
pen.SetColour( color.ToColour() );
if( style == wxPENSTYLE_DOT )
{
wxPen pen;
pen.SetColour( color.ToColour() );
if( style == wxPENSTYLE_DOT )
{
style = wxPENSTYLE_USER_DASH;
pen.SetDashes( 2, dots );
}
pen.SetWidth( width );
pen.SetStyle( style );
style = wxPENSTYLE_USER_DASH;
pen.SetDashes( 2, dots );
}
pen.SetWidth( width );
pen.SetStyle( style );
DC->SetPen( pen );
}
else
{