Skip to content

Commit 7dcf570

Browse files
committed
Use AutoScaleMethod "smooth" by default for fractional scaling
Currently, AutoScaleMethod "nearest" is used by default, leading to jagged image scaling results. The method "Ssooth" is only used on GTK with a fractional scaling value not being a multiple of 100. The reason for not using "smooth" scaling on all platform was a bug regarding icon transparency that has long been resolved. With this change, AutoScaleMethod "smooth" is used by default in fractional scaling scenarios (i.e., with deviceZoom not being an integer multiple of 100) and when using monitor-specific scaling on Windows. To still use "nearest" in these scenarios, it can be activated via system property.
1 parent c493ae8 commit 7dcf570

File tree

1 file changed

+4
-5
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal

1 file changed

+4
-5
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH }
7979
* <li>"nearest": nearest-neighbor interpolation, may look jagged</li>
8080
* <li>"smooth": smooth edges, may look blurry</li>
8181
* </ul>
82-
* The current default is to use "nearest", except on
83-
* GTK when the deviceZoom is not an integer multiple of 100%.
84-
* The smooth strategy currently doesn't work on Win32 and Cocoa, see
85-
* <a href="https://bugs.eclipse.org/493455">bug 493455</a>.
82+
* The current default is to use "nearest" on Cocoa or when deviceZoom is an
83+
* integer multiple of 100% and if monitor-specific scaling on Windows is not
84+
* used, and "smooth" otherwise.
8685
*/
8786
private static final String SWT_AUTOSCALE_METHOD = "swt.autoScale.method";
8887

@@ -605,7 +604,7 @@ public static void setDeviceZoom (int nativeDeviceZoom) {
605604
DPIUtil.deviceZoom = deviceZoom;
606605
System.setProperty("org.eclipse.swt.internal.deviceZoom", Integer.toString(deviceZoom));
607606
if (deviceZoom != 100 && autoScaleMethodSetting == AutoScaleMethod.AUTO) {
608-
if (deviceZoom / 100 * 100 == deviceZoom || !"gtk".equals(SWT.getPlatform())) {
607+
if ((deviceZoom / 100 * 100 == deviceZoom && !isMonitorSpecificScalingActive()) || "cocoa".equals(SWT.getPlatform())) {
609608
autoScaleMethod = AutoScaleMethod.NEAREST;
610609
} else {
611610
autoScaleMethod = AutoScaleMethod.SMOOTH;

0 commit comments

Comments
 (0)