diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 95bb79825..964b3ee3c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -364,7 +364,10 @@ class ScintillaWin : static ATOM scintillaClassAtom; static ATOM callClassAtom; - int deviceScaleFactor = 1; + float deviceScaleFactor = 1.f; + int GetFirstIntegralMultipleDeviceScaleFactor() const noexcept { + return static_cast<int>(std::ceil(deviceScaleFactor)); + } #if defined(USE_D2D) ID2D1RenderTarget *pRenderTarget; @@ -723,14 +726,15 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) { } } else { - drtp.dpiX = 96.f * deviceScaleFactor; - drtp.dpiY = 96.f * deviceScaleFactor; + const int integralDeviceScaleFactor = GetFirstIntegralMultipleDeviceScaleFactor(); + drtp.dpiX = 96.f * integralDeviceScaleFactor; + drtp.dpiY = 96.f * integralDeviceScaleFactor; drtp.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN); D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp {}; dhrtp.hwnd = hw; - dhrtp.pixelSize = ::GetSizeUFromRect(rc, deviceScaleFactor); + dhrtp.pixelSize = ::GetSizeUFromRect(rc, integralDeviceScaleFactor); dhrtp.presentOptions = (technology == Technology::DirectWriteRetain) ? D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE; @@ -775,7 +779,7 @@ void ScintillaWin::DisplayCursor(Window::Cursor c) { c = static_cast<Window::Cursor>(cursorMode); } if (c == Window::Cursor::reverseArrow) { - ::SetCursor(reverseArrowCursor.Load(dpi)); + ::SetCursor(reverseArrowCursor.Load(static_cast<UINT>(dpi * deviceScaleFactor))); } else { wMain.SetCursor(c); } @@ -3649,7 +3653,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc( surfaceWindow->Init(ps.hdc, hWnd); } else { #if defined(USE_D2D) - const int scaleFactor = sciThis->deviceScaleFactor; + const int scaleFactor = sciThis->GetFirstIntegralMultipleDeviceScaleFactor(); // Create a Direct2D render target. D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp {}; |