While GDI scaling works with the first integral multiple of the device scale factor, the cursor has to be requested with the correct scale factor (i.e. with 1.5 instead of 2 in case of 150 % scaling). In commit [85fe64] the device scale factor of ScintillaWin is stored as a float instead of an int. Existing references then use GetFirstIntegralMultipleDeviceScaleFactor() instead.
In commit [d5cdd6]reversArrowCursor.Load() is passed the correct dpi (dpi * deviceScaleFactor, ScintillaWin.cxx, line 735 ).
In PlatWin.cxx, LoadReversArrowCursor() now first features a local helper class CursorHelper which performs RAII and incorporates existing code to flip the bitmap.
The remainder of the function has the following changes:
Instead of using LoadCursor() that accepts no size, the cursor is loaded via LoadImage() and the desired width and height.
For step 1 to work correctly, the DPI awareness of the thread has to be changed to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2.
If the returned cursor does not match the requested width and height, the cursor is copied as before.
If a bitmap could be retrieved, the new cursor is created from the flipped bitmap (reverseArrowCursor = cursorHelper.CreateFlippedCursor()).
The DPI awareness of the thread is reset to its original value.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Explanation of the patch:
While GDI scaling works with the first integral multiple of the device scale factor, the cursor has to be requested with the correct scale factor (i.e. with 1.5 instead of 2 in case of 150 % scaling). In commit [85fe64] the device scale factor of
ScintillaWinis stored as afloatinstead of anint. Existing references then useGetFirstIntegralMultipleDeviceScaleFactor()instead.In commit [d5cdd6]
reversArrowCursor.Load()is passed the correct dpi (dpi * deviceScaleFactor, ScintillaWin.cxx, line 735 ).In PlatWin.cxx,
LoadReversArrowCursor()now first features a local helper classCursorHelperwhich performs RAII and incorporates existing code to flip the bitmap.The remainder of the function has the following changes:
LoadCursor()that accepts no size, the cursor is loaded viaLoadImage()and the desired width and height.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2.reverseArrowCursor = cursorHelper.CreateFlippedCursor()).Committed as [7267f2].
Related
Commit: [7267f2]
Committed as [7267f2].
Related
Commit: [7267f2]