Skip to content

Commit d39363c

Browse files
HeikoKlarefedejeanne
authored andcommitted
[Win32] Correct zoom level used for image of decorations/shell #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 #2037
1 parent b0559a2 commit d39363c

File tree

1 file changed

+6
-6
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+6
-6
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -888,23 +888,23 @@ private void setImages (Image image, Image [] images) {
888888
if (smallIcon != null) {
889889
switch (smallIcon.type) {
890890
case SWT.BITMAP:
891-
smallImage = Display.createIcon (smallIcon, getZoom());
892-
hSmallIcon = Image.win32_getHandle(smallImage, getZoom());
891+
smallImage = Display.createIcon (smallIcon, 100);
892+
hSmallIcon = Image.win32_getHandle(smallImage, 100);
893893
break;
894894
case SWT.ICON:
895-
hSmallIcon = Image.win32_getHandle(smallIcon, getZoom());
895+
hSmallIcon = Image.win32_getHandle(smallIcon, 100);
896896
break;
897897
}
898898
}
899899
OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hSmallIcon);
900900
if (largeIcon != null) {
901901
switch (largeIcon.type) {
902902
case SWT.BITMAP:
903-
largeImage = Display.createIcon (largeIcon, getZoom());
904-
hLargeIcon = Image.win32_getHandle(largeImage, getZoom());
903+
largeImage = Display.createIcon (largeIcon, 100);
904+
hLargeIcon = Image.win32_getHandle(largeImage, 100);
905905
break;
906906
case SWT.ICON:
907-
hLargeIcon = Image.win32_getHandle(largeIcon, getZoom());
907+
hLargeIcon = Image.win32_getHandle(largeIcon, 100);
908908
break;
909909
}
910910
}

0 commit comments

Comments
 (0)