Fix Direct2D graphics context after wxPenInfo changes
At least in wxMSW wxPen::GetStipple() returns a non-null (but invalid) bitmap even when pen style is not wxPENSTYLE_STIPPLE, so don't test for this bitmap when creating a wxGraphicsPen from a wxPen but for the style directly. This avoids using this invalid bitmap later in D2D code, where it resulted in assert failures. Also add a similar style test before calling wxPen::GetDashes() for consistency, even if it doesn't seem to be strictly necessary. See https://github.com/wxWidgets/wxWidgets/pull/553 Closes #17958.
This commit is contained in:
@@ -836,12 +836,18 @@ wxGraphicsPen wxGraphicsContext::CreatePen(const wxPen& pen) const
|
||||
.Cap(pen.GetCap())
|
||||
;
|
||||
|
||||
if ( info.GetStyle() == wxPENSTYLE_USER_DASH )
|
||||
{
|
||||
wxDash *dashes;
|
||||
if ( int nb_dashes = pen.GetDashes(&dashes) )
|
||||
info.Dashes(nb_dashes, dashes);
|
||||
}
|
||||
|
||||
if ( info.GetStyle() == wxPENSTYLE_STIPPLE )
|
||||
{
|
||||
if ( wxBitmap* const stipple = pen.GetStipple() )
|
||||
info.Stipple(*stipple);
|
||||
}
|
||||
|
||||
return DoCreatePen(info);
|
||||
}
|
||||
|
Reference in New Issue
Block a user