aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authorMarkus Nißl <unknown>2023-06-22 22:31:07 +1000
committerMarkus Nißl <unknown>2023-06-22 22:31:07 +1000
commit0ffbc41582dd7fe85093a7ea3f21459890eab03d (patch)
tree0f235206dee37a7a063d3ae3c70c5cddb2b916c3 /win32/ScintillaWin.cxx
parent5ad83ff87df54c085be87cde61215b3ee32a2e1a (diff)
downloadscintilla-mirror-0ffbc41582dd7fe85093a7ea3f21459890eab03d.tar.gz
Bug [#2382]. Fix reverse arrow cursor when scaled.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx16
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 {};