-
Notifications
You must be signed in to change notification settings - Fork 162
MenuItem Image Half Scaling to make sure there's no adverse effect #1872
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
MenuItem Image Half Scaling to make sure there's no adverse effect #1872
Conversation
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.
Changes look fine to me and solves the issue.
I'm just not sure about the behavior with monitor-specific scaling not active. With this PR the image size is updated in all cases, so on a 150% primary monitor:
old state
new state
This is obviously a difference before and after. I personally prefer the better sizing, but the scaling leads to slight blurryness.
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
Outdated
Show resolved
Hide resolved
I would be in favor of keeping the existing behavior as is. |
Sounds okay to me to shift that logic to DPIUtil |
1d54936
to
644469f
Compare
Made the changes as requested. |
644469f
to
8c1409a
Compare
@@ -631,7 +631,19 @@ public static boolean useCairoAutoScale() { | |||
return useCairoAutoScale; | |||
} | |||
|
|||
public static int getZoomForMenuItemImage(int nativeDeviceZoom) { | |||
String autoScaleValueForMenuItemImage = DPIUtil.autoScaleValue; | |||
if(autoScaleValueForMenuItemImage.equals("quarter") || autoScaleValueForMenuItemImage.equals("exact")) { |
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.
Since this can be specified by the user, you should either use equalsIgnoreCase(...)
or transform it using toLowerCase()
like it is done in other places
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.
8c1409a
to
1ffa8a7
Compare
This commit contributes to fixing the logic for scaling ImageData with Smooth scaling strategy. The logic of DPIUtil::autoScaleImageData is replicated in the Image class and modified to have properly defined current and target zoom. The previous implementation scales the bounds of image up and down several times which can lead to rounding error in case of scaling factor being a fractional value. With this implementation, the obtained imageData has no rounding error after ruling out those scale ups and downs and hence improves the menu item icons. contributes to eclipse-platform#62 and eclipse-platform#127
1ffa8a7
to
af9dd04
Compare
This commit contributes to enforcing half scaling on the MenuItem Image. On Win32, the OS is responsible for painting the Image of a MenuItem and it expects images to be in standard sizes i.e. 16px, 24 px, 32 px, etc. If the images are not provided within these sizes, Windows tries to rescale them, leading to unexpected sizes and masking. Since, half scaling yields the images in standard sizes, MenuItems are scaled accordingly.
Bug Description
How to test
contributes to
#62 and #127