aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-03-20 10:34:10 +1100
committerNeil <nyamatongwe@gmail.com>2025-03-20 10:34:10 +1100
commitb1823dea90391e67d4a5ee96a4a997230035fe58 (patch)
tree735de10d8b36dbab95e609833992bdc139107c6c /win32/PlatWin.cxx
parent443df5997d71ad8af6b7456eba124e6909118480 (diff)
downloadscintilla-mirror-b1823dea90391e67d4a5ee96a4a997230035fe58.tar.gz
Standardize render target initialization.
Use symbolic names for DPI instead of inline value 96.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 9cd792e09..6a4f9d146 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1770,7 +1770,7 @@ void SurfaceD2D::SetDeviceScaleFactor(const ID2D1RenderTarget *const pD2D1Render
FLOAT dpiX = 0.f;
FLOAT dpiY = 0.f;
pD2D1RenderTarget->GetDpi(&dpiX, &dpiY);
- deviceScaleFactor = static_cast<int>(dpiX / 96.f);
+ deviceScaleFactor = static_cast<int>(dpiX / dpiDefault);
}
int SurfaceD2D::PixelDivisions() {
@@ -3012,16 +3012,9 @@ public:
return false;
}
- D2D1_RENDER_TARGET_PROPERTIES drtp {};
- drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
- drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
- drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
- drtp.dpiX = 96.f;
- drtp.dpiY = 96.f;
- drtp.pixelFormat = D2D1::PixelFormat(
- DXGI_FORMAT_B8G8R8A8_UNORM,
- D2D1_ALPHA_MODE_PREMULTIPLIED
- );
+ const D2D1_RENDER_TARGET_PROPERTIES drtp = D2D1::RenderTargetProperties(
+ D2D1_RENDER_TARGET_TYPE_DEFAULT,
+ { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED });
DCRenderTarget pTarget;
HRESULT hr = CreateDCRenderTarget(&drtp, pTarget);