[win32] Fix pointer size scaling precision for custom cursors #2556
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The value in the registry for CursorBaseSize is not always divisible by 32, so integer division was causing loss of precision in pointer scaling. This commit changes getPointerSizeScaleFactor() to return a float using floating-point division, and ensures all usages of this method in Cursor.java handle the scale as a float. The float is then cast to int only when calling DPIUtil.scaleImageData, which only accepts integer zoom values. This preserves as much precision as possible and avoids rounding errors in pointer scaling for accessibility settings.
Description
Recently I commited: 6e4241d, where we read the cursor size value from accessibility setting of windows. I assumed that each value is multiple of 32 which was wrong.
Here for the cursor size 4 is 80

and my method will return 2 (i assumed it should return 4). Changing it to float will return us 2.4 which is more precise when trying to scale up the size.