Improve creating wxGCDC from an existing wxGraphicsContext

Avoid creating a default wxGraphicsContext unnecessarily, only to
immediately delete it and replace it with the provided one.

This was at best unnecessary and at worst resulted in a crash if the
default context couldn't be created, as happened on a headless system
(where wxImage-based wxGraphicsContext can still be created
successfully).
This commit is contained in:
Vadim Zeitlin
2018-12-06 03:40:49 +01:00
parent 54e9150157
commit 507e331eb1
2 changed files with 11 additions and 2 deletions

View File

@@ -60,6 +60,10 @@ public:
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
#endif
// Ctor using an existing graphics context given to wxGCDC ctor.
wxGCDCImpl(wxDC *owner, wxGraphicsContext* context);
wxGCDCImpl( wxDC *owner );
virtual ~wxGCDCImpl();