From 31de97a2c636d9be49bfecd88cc2e6756ff356a7 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 28 May 2022 20:12:07 +0200 Subject: [PATCH] Use correct wxBitmap size for STC Create the wxBitmap in the expected physical size to fix rendering artifacts. CreateWithDIPSize cannot be used because when it scales the DIP size, it could be off-by-one. Remove obsolete mdc->GetImpl()->SetWindow(), this is not needed anymore because the DPI is now determined from the associated bitmap content scale factor, and not from the wxWindow. See #22450 --- src/stc/PlatWX.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 182f28e842..61d3551bdf 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -293,13 +293,12 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface, WindowID w 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; - bitmap = new wxBitmap(); - bitmap->CreateWithDIPSize(width, height,(GETWIN(winid))->GetDPIScaleFactor()); + bitmap = new wxBitmap(GETWIN(winid)->ToPhys(wxSize(width, height))); + bitmap->SetScaleFactor(GETWIN(winid)->GetDPIScaleFactor()); mdc->SelectObject(*bitmap); }