Fixing transparency on scaled variant of cursor with source and mask#2562
Merged
Conversation
Contributor
c1ee9dd to
f38c4e2
Compare
Contributor
|
Tested the changes. The modification switches the cursor to use blurry scaling instead of smooth scaling, as smooth scaling does not account for the mask when displaying the cursor. This results in a better appearance for cursors with masks compared to the master branch (for example, at 150% zoom in the master branch, the mask is not visible, whereas with this change, the mask is applied). The scaled version is still not perfect, so the deprecation PR is reasonable. I am approving this change, as the code works correctly and provides a reasonable fix for the soon-to-be-deprecated constructor. |
arunjose696
approved these changes
Oct 7, 2025
When creating a custom cursor using source and mask ImageData, the transparency mask does not scale correctly when applying DPIUtil.autoScaleImageData() in a multi-monitor setup with different DPI settings. With this change we use scaleTo method to scale the data.
f38c4e2 to
e424717
Compare
fedejeanne
approved these changes
Oct 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When creating a custom cursor using source and mask ImageData, the transparency mask does not scale correctly when applying DPIUtil.autoScaleImageData() in a multi-monitor setup with different DPI settings. With this change we use scaleTo method to scale the data.
How to test
Run the
Snippet386with following VM argumentsOn 100% monitor zoom, choose the
Cursor(Device, ImageData, ImageData, int, int)option from the dropdownYou will see the dotted square (a transparent pixel after each solid pixel)
Move the shell to another monitor with different zoom e.g. 150%
Previously you would lose the transparency completely when it was scaled with
DPIUtil.scaleImageDataComparison of mask data before and after scaling with and without this PR
Before
After:
P.S: With this change we will not get smooth scaling for the cursor created with source and mask data. That's why we will deprecate the Cursor(Device, ImageData, ImageData, int, int) constructor in another PR, see vi-eclipse/Eclipse-Platform#462. Instead, we will recommend using: Cursor(Device device, ImageDataProvider imageDataProvider, int hotspotX, int hotspotY) as this provides better results with multi-monitor DPI scaling.