-
Notifications
You must be signed in to change notification settings - Fork 177
[win32] Fix inconsistency when an Image with GC is drawn on a GC #2387
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
[win32] Fix inconsistency when an Image with GC is drawn on a GC #2387
Conversation
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
283a67c
to
b55ff03
Compare
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
b55ff03
to
e462bce
Compare
@fedejeanne The image is created few lines above and it will be disposed immediately after it anyway, but I don't see a change this can be disposed before. |
710097a
to
fa9747f
Compare
fa9747f
to
b9f096c
Compare
61097cd
to
d77cbb7
Compare
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look fine and I see no regressions.
One nit comment: you need to add this to your commit message @akoch-yatta
Fixes https://github.com/eclipse-platform/eclipse.platform.swt/issues/2311
This commit adapts the logic when a bitmap or icon is drawn with the GC in the windows implementation. As of now, the autoscale zoom was used to identify the image handle to use. If the image is itself drawn with a ImageGCDrawer, information about the original native zoom was lost, which led to inconsistencies in fonts depending on the auto scale mode. This commit fowards the native zoom in this case to enable the Image to initialize the GC accordingly. fixes eclipse-platform#2385 fixes eclipse-platform#2311
d77cbb7
to
b0b70ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested the proposed change with several different setups including combinations of
- two monitors (175% and 100%), each of them once used as primary
- monitor-specific scaling enabled/disabled
swt.autoScale
set to a fixed value (150) vs. not custom specified
and particularly with StyledText (incl. LineNumberRuler) and GEF diagrams.
I did not find any regressions with respect to existing behavior (and with respect to 2025-06) but found the two mentioned issues to be successfully resolved:
ftr: this also contributes to eclipse-platform/eclipse.platform.ui#3061 |
This PR adapts the logic when a bitmap or icon is drawn with the GC in the windows implementation. As of now, the autoscale zoom was used to identify the image handle to use. If the image is itself drawn with a ImageGCDrawer, information about the original native zoom was lost, which led to inconsistencies in fonts depending on the auto scale mode. This PR forwards the native zoom in this case to enable the Image to initialize the GC accordingly. This was e.g. an issue with auto scale mode integer200 as described in #2385.