From 71773d40ab61993979207dbbd37e5a8824e28c9b Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 7 Jun 2020 19:14:05 +0200 Subject: [PATCH] Avoid ugly casts to wxMemoryDC --- src/stc/PlatWX.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 2adfead2a6..ce4e7e2bff 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -293,11 +293,11 @@ void SurfaceImpl::Init(SurfaceID hdc_, WindowID) { void SurfaceImpl::InitPixMap(int width, int height, Surface *surface, WindowID winid) { Release(); - if (surface) - hdc = new wxMemoryDC(static_cast(surface)->hdc); - else - hdc = new wxMemoryDC(); - ((wxMemoryDC*)hdc)->GetImpl()->SetWindow(GETWIN(winid)); + wxMemoryDC* mdc = surface + ? new wxMemoryDC(static_cast(surface)->hdc) + : new wxMemoryDC(); + mdc->GetImpl()->SetWindow(GETWIN(winid)); + hdc = mdc; hdcOwned = true; if (width < 1) width = 1; if (height < 1) height = 1; @@ -307,7 +307,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface, WindowID w bitmap = new wxBitmap(); bitmap->CreateScaled(width, height,wxBITMAP_SCREEN_DEPTH,(GETWIN(winid))->GetContentScaleFactor()); #endif - ((wxMemoryDC*)hdc)->SelectObject(*bitmap); + mdc->SelectObject(*bitmap); }