-
Notifications
You must be signed in to change notification settings - Fork 186
Fix image handle creation to use correct native zoom #2755
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
Fix image handle creation to use correct native zoom #2755
Conversation
HeikoKlare
left a comment
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 change looks totally reasonable. But I wonder which change introduced the broken behavior. @arunjose696 did you trace back the issue to the causing commit?
When taking a look at the history, I also found this change: https://github.com/eclipse-platform/eclipse.platform.swt/pull/2570/files
There we introduced that ImageGcDrawerWrapper#getImageData() delegates to ImageGcDrawerWrapper#loadImageData() only considering the targetZoom but not the nativeZoom passed to the method. It does not seem to directly be related to this issue, was it's similar in the sense that native zoom seems to not properly be considered.
The regression was introduced in eclipse-platform/eclipse.platform.swt#2526. before that PR, in the data.gdipGraphics != 0 case, the image handle was created without the native zoom. However, upon reviewing the logic, it still makes sense to create the image handle with the correct native zoom for both cases. |
I think you meant ImageGcDrawerWrapper#newImageData() instead of ImageGcDrawerWrapper#getImageData(). As a cleanup, we could simplify this by changing the signature of newImageData() to accept just a single zoom instead of a zoom context. |
Thank you for the detailed explanation. I took a look at the causing change and with that the proposed change totally makes sense. I propose that we test this change with the autoscale disablement mechanism as the different zooms of GC are highly relevant there (i.e., best test with GEF), just for the sake of being sure that we do not break anything there.
Yes, I meant the |
HeikoKlare
left a comment
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 also tested the change now and it properly fixes the issue and I did not find anything that breaks. As already mentioned before, the change is sound anyway.
With respect to autoscale-disabled use cases, I also did not find any issues either and since every involved zoom value should be 100 then anyway, it should not lead to any behavioral changes there at all.
@akoch-yatta would like to have your opinion and whether you see any risk that we may have missed before merging
In some cases where an image handle is passed to drawImage, the handle was created with nativeZoom passed as Gc::getZoom(), this would cause the font sizes to be wrong when drawing text with an imageGCDrawer. This change ensures that the image handle is created with the correct nativeZoom from GC.
68100bb to
9b0df54
Compare
|
I gave it a short test and it looks good to me as well. Conceptually it makes sense anyway |
In some cases where an image handle is passed to drawImage, the handle was created with nativeZoom set to Gc::getZoom(). This caused incorrect font sizes when drawing text with an imageGCDrawer.
This change ensures that the image handle is created with the correct nativeZoom value from the GC, fixing the font size issue.
Steps to reproduce
Open a runtime workspace at 175% primary monitor zoom with monitor-specific scaling disabled. The line number ruler will have text cut off without this change