diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-02-11 19:14:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-11 19:14:23 +0100 |
| commit | 5a25641317dd570757f33181e45393a74019dc30 (patch) | |
| tree | f2fcd465287fb6a5e5a3cbc390b7362aabbb6942 /src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | |
| parent | 740c56ce15935628ac6d613e582454c48adb978e (diff) | |
Very controlled GDIplus startup and shutdown #635 (#679)
Fall back to GDI if GDIplus is not available
Diffstat (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index 188bd1d2d..7897dce53 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -53,10 +53,22 @@ int Fl_GDIplus_Graphics_Driver::antialias() { #if USE_GDIPLUS -ULONG_PTR Fl_GDIplus_Graphics_Driver::gdiplusToken = 0; +int Fl_GDIplus_Graphics_Driver::gdiplus_state_ = Fl_GDIplus_Graphics_Driver::STATE_CLOSED; +ULONG_PTR Fl_GDIplus_Graphics_Driver::gdiplus_token_ = 0; void Fl_GDIplus_Graphics_Driver::shutdown() { - Gdiplus::GdiplusShutdown(Fl_GDIplus_Graphics_Driver::gdiplusToken); + if (gdiplus_state_ == STATE_OPEN) { + gdiplus_state_ = STATE_SHUTDOWN; + Gdiplus::GdiplusShutdown(Fl_GDIplus_Graphics_Driver::gdiplus_token_); + gdiplus_token_ = 0; + gdiplus_state_ = STATE_CLOSED; + } else if (gdiplus_state_ == STATE_CLOSED) { +// Fl::warning("Fl_GDIplus_Graphics_Driver::shutdown() called, but driver is closed."); + } else if (gdiplus_state_ == STATE_SHUTDOWN) { +// Fl::warning("Fl_GDIplus_Graphics_Driver::shutdown() called recursively."); + } else if (gdiplus_state_ == STATE_STARTUP) { +// Fl::warning("Fl_GDIplus_Graphics_Driver::shutdown() called while driver is starting up."); + } } #endif |
