-
Notifications
You must be signed in to change notification settings - Fork 187
[Win32] Correct zoom level used for image of decorations/shell #2037 #2466
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] Correct zoom level used for image of decorations/shell #2037 #2466
Conversation
…e-platform#2037 When setting the images for a decorations instance (in particular for a shell) or when updating them upon a zoom change, the two images best fitting to sizes required by the OS in their 100% version are calculated. Then, however, a zoomed version of the image is used based on the auto-scaled zoom of the decorations object. This zoom is, however, completely unrelated to what is required, as the auto-scaled zoom was not taken into account for identifying the best fitting image before. In the best case, a zoomed version of the image exactly fitting to the size required by the OS would be generated. This would be possible via auto-scaling the image (or in case of SVGs rendering it at the desired size), but this would also lead to bad results if a simple auto-scaling mode was used. Thus, the best possible solution is to use the 100% version of the image, as its size does best fit to the required sizes as conforming to the calculation done before. Contributes to eclipse-platform#2037
ShahzaibIbrahim
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 changes looks reasonable as creating 100% zoom image initially is what we usually do with Images as well and it resolves the double scaling problem i.e. If you pre-scale an image with the shell’s auto-zoom before SWT picks one, you’re effectively giving SWT an already scaled image. Then SWT may again resize it to fit the OS size request → leading to blurry, distorted, or oversized icons.
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.
LGTM. Merging.
Just one final question, for my understanding: I noticed you only adapted the usages in Decorations and not in other places (for example, Display.createIcon(...) is also called in TrayItem and TaskItem). Why aren't the same changes needed in those consumers too?
This change is not about the usage of |
|
Thank you for the clarification.
If I understand the issue correctly, it should also manifest in the tray area of the OS, which means that the usages in I'm not sure about |
Again: why should that be the case? There is no calculation in |
|
I just assumed that the code being so similar in both classes, the issue might manifest itself in the tray. But I read between the lines that this is not the case :-) Thank you. |
|
fwiw: there is nothing in between the lines. I just don't understand where the code is similar in both cases, as it's actually completely different. Maybe I miss something. |
I meant this pattern of checking for a type (a I saw the pattern in 3 places: TrayItem
eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java Lines 458 to 466 in 1094ebd
TaskItem
eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskItem.java Lines 474 to 482 in 1094ebd
Decorations (adapted in this PR)
Lines 889 to 897 in 1094ebd
Lines 901 to 909 in 1094ebd
|
|
So you just refer to code duplication and propose to extract that pattern to a common utilty method? But what's the relation to the change in this PR then? |
|
Nope, I just wanted to raise the question to see if the problem arises in those other 2 places too. |
|
Sorry, I still don't know which problem you refer you. What's the change you may expect at those other places? |
|
I guess we can close this discussion as there does not seem to be a concrete issue description or fix proposal? |
When setting the images for a decorations instance (in particular for a shell) or when updating them upon a zoom change, the two images best fitting to sizes required by the OS in their 100% version are calculated. Then, however, a zoomed version of the image is used based on the auto-scaled zoom of the decorations object. This zoom is, however, completely unrelated to what is required, as the auto-scaled zoom was not taken into account for identifying the best fitting image before.
In the best case, a zoomed version of the image exactly fitting to the size required by the OS would be generated. This would be possible via auto-scaling the image (or in case of SVGs rendering it at the desired size), but this would also lead to bad results if a simple auto-scaling mode was used. Thus, the best possible solution is to use the 100% version of the image, as its size does best fit to the required sizes as conforming to the calculation done before.
Contributes to #2037