Scintilla / Feature Requests / #1432 D2D support per-monitor rendering parameters
- ️Sat Nov 12 2022
As previously discussed at [feature-requests:#1427], defaultRenderingParams
and customClearTypeRenderingParams
created inside LoadD2DOnce()
are steal after Windows settings change or when the window moved to a different monitor. [bugs:#2305] may be related.
CreateMonitorRenderingParams()
can be used to fix the problem, there is sample code at https://docs.microsoft.com/en-us/windows/win32/DirectWrite/how-to-add-support-for-multiple-monitors
I find three ways to implement this:
1. move both parameters local to SurfaceD2D::SetFontQuality()
by storing HWND or HMONITOR in Init()
method. This change makes the method 100x slow and increased total paint time due to CreateMonitorRenderingParams()
(which is slower than current used CreateRenderingParams()
). The slow might be the reason they were created once, this is also not efficient as both parameters are recreated each time the window gets paint.
2. add void *defaultRenderingParams
and void *customRenderingParams
into SurfaceMode
and EditModel
, then create them in Message::SetTechnology
, WM_SETTINGCHANGE
and WM_WINDOWPOSCHANGED
.
3. Change cbWndExtra
to 3*sizeof(LONG_PTR)
for all three window classes and store the two rendering parameters at index sizeof(LONG_PTR)
and 2*sizeof(LONG_PTR)
.