aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-02-10 13:08:51 +1100
committerNeil <nyamatongwe@gmail.com>2025-02-10 13:08:51 +1100
commitf2e9767e7aa2f3e012f46bf1c5f8b41872051bf0 (patch)
tree761e794feeba4a1ab80ef4b9d2710b79206e0d70 /win32
parent883a12357e66c08d9519671b278fd19cb5009570 (diff)
downloadscintilla-mirror-f2e9767e7aa2f3e012f46bf1c5f8b41872051bf0.tar.gz
Use ID2D1HwndRenderTarget::Resize when handling WM_SIZE to avoid larger state
invalidation which may be more costly to restore.
Diffstat (limited to 'win32')
-rw-r--r--win32/ScintillaWin.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 2d0441fdd..b0eaf979d 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -1581,8 +1581,21 @@ PRectangle ScintillaWin::GetClientRectangle() const {
void ScintillaWin::SizeWindow() {
#if defined(USE_D2D)
+ HRESULT hrResize = E_FAIL;
+
+ if (((technology == Technology::DirectWrite) || (technology == Technology::DirectWriteRetain)) && targets.pHwndRT) {
+ // May be able to just resize the HWND render target
+ const int scaleFactor = GetFirstIntegralMultipleDeviceScaleFactor();
+ const D2D1_SIZE_U pixelSize = ::GetSizeUFromRect(GetClientRect(MainHWND()), scaleFactor);
+ hrResize = targets.pHwndRT->Resize(pixelSize);
+ if (FAILED(hrResize)) {
+ Platform::DebugPrintf("Failed to Resize ID2D1HwndRenderTarget 0x%lx\n", hrResize);
+ }
+ }
if (paintState == PaintState::notPainting) {
- DropRenderTarget();
+ if (FAILED(hrResize)) {
+ DropRenderTarget();
+ }
} else {
targets.valid = false;
}