-
Notifications
You must be signed in to change notification settings - Fork 175
Revise the Cursor class to support scaling #2271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise the Cursor class to support scaling #2271
Conversation
Test Results 539 files - 6 539 suites - 6 32m 7s ⏱️ + 2m 7s For more details on these errors, see this check. Results for commit 20486f3. ± Comparison against base commit 51fed8e. This pull request removes 37 and adds 1 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
0bc17ed
to
ff21b33
Compare
Out of curiosity: Is there a benefit to using the |
If cursors are initialized with a single ImageData and later requested at a different zoom level, that image data is auto-scaled using DPUtil. This just scales up the original ImageData, which makes the cursor appear blurry at different zoom levels (e.g., when moving the cursor from one monitor to another). If Image is used this scaling can be non blurry. |
I think this does not really answers the question why not using |
We discussed using |
7388863
to
d75cf86
Compare
I've updated the PR to make the constructor accept an The only minor downside I can think is that cursors won't be scaled on GTK or macOS, since these platforms would set the cursor at 100% zoom and wouldnt update them later. However, I believe this is acceptable, as it matches the current behavior. |
d75cf86
to
0edd410
Compare
bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
Outdated
Show resolved
Hide resolved
....swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
Outdated
Show resolved
Hide resolved
89a5957
to
ed5de34
Compare
Have all CI checks passing. |
....swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
Show resolved
Hide resolved
ed5de34
to
1a6f69a
Compare
Previously, cursors were initialized with a single ImageData, which caused issues on systems with varying zoom levels, for example, cursors were not scaled at all on Linux, or were blurrily auto-scaled on Windows. This commit introduces a new constructor for the Cursor class that accepts an ImageDataProvider object instead of ImageData. This allows the code instantiating the cursor to pass an imageDataProvider capable of providing appropriately scaled image data based on the current zoom level.
1a6f69a
to
20486f3
Compare
Failing test is unrelated #2098 |
Previously, cursors were initialized with a single ImageData, which caused issues on systems with varying zoom levels, for example, cursors were not scaled at all on Linux, or were blurrily auto-scaled on Windows.
This commit introduces a new constructor for the Cursor class that accepts an Image object instead of ImageData. This allows the code instantiating the cursor to pass an image capable of providing appropriately scaled image data based on the current zoom level.