Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH }
* <li>"nearest": nearest-neighbor interpolation, may look jagged</li>
* <li>"smooth": smooth edges, may look blurry</li>
* </ul>
* The current default is to use "nearest", except on
* GTK when the deviceZoom is not an integer multiple of 100%.
* The smooth strategy currently doesn't work on Win32 and Cocoa, see
* <a href="https://bugs.eclipse.org/493455">bug 493455</a>.
* The current default is to use "smooth" on GTK when deviceZoom is an integer
* multiple of 100% and on Windows if monitor-specific scaling is enabled, and
* "nearest" otherwise..
*/
private static final String SWT_AUTOSCALE_METHOD = "swt.autoScale.method";

Expand Down Expand Up @@ -605,14 +604,22 @@ public static void setDeviceZoom (int nativeDeviceZoom) {
DPIUtil.deviceZoom = deviceZoom;
System.setProperty("org.eclipse.swt.internal.deviceZoom", Integer.toString(deviceZoom));
if (deviceZoom != 100 && autoScaleMethodSetting == AutoScaleMethod.AUTO) {
if (deviceZoom / 100 * 100 == deviceZoom || !"gtk".equals(SWT.getPlatform())) {
autoScaleMethod = AutoScaleMethod.NEAREST;
} else {
if (sholdUseSmoothScaling()) {
autoScaleMethod = AutoScaleMethod.SMOOTH;
} else {
autoScaleMethod = AutoScaleMethod.NEAREST;
}
}
}

private static boolean sholdUseSmoothScaling() {
return switch (SWT.getPlatform()) {
case "gtk" -> deviceZoom / 100 * 100 != deviceZoom;
case "win32" -> isMonitorSpecificScalingActive();
default -> false;
};
}

public static void setUseCairoAutoScale (boolean cairoAutoScale) {
useCairoAutoScale = cairoAutoScale;
}
Expand Down
Loading