diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java index b5eb13cc62a..11537f334d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java @@ -47,7 +47,7 @@ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH } private static AutoScaleMethod autoScaleMethod = AutoScaleMethod.NEAREST; private static String autoScaleValue; - private static boolean useCairoAutoScale = true; + private static final boolean USE_CAIRO_AUTOSCALE = SWT.getPlatform().equals("gtk"); /** * System property that controls the autoScale functionality. @@ -484,7 +484,7 @@ public static Rectangle scaleUp(Drawable drawable, Rectangle rect, int zoom) { * @return float scaling factor */ private static float getScalingFactor(int zoom) { - if (useCairoAutoScale) { + if (USE_CAIRO_AUTOSCALE) { return 1; } if (zoom <= 0) { @@ -631,10 +631,6 @@ private static boolean sholdUseSmoothScaling() { }; } -public static void setUseCairoAutoScale (boolean cairoAutoScale) { - useCairoAutoScale = cairoAutoScale; -} - public static int getZoomForAutoscaleProperty (int nativeDeviceZoom) { return getZoomForAutoscaleProperty(nativeDeviceZoom, autoScaleValue); } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java index 10e4a731743..aa19d2c843f 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java @@ -16,6 +16,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; +import static org.junit.Assume.assumeFalse; import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Point; @@ -37,14 +38,13 @@ public class DPIUtilTests { @Before public void setup() { + assumeFalse("Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled", SwtTestUtil.isLinux); deviceZoom = DPIUtil.getDeviceZoom(); DPIUtil.setDeviceZoom(200); - DPIUtil.setUseCairoAutoScale(false); } @After public void tearDown() { - DPIUtil.setUseCairoAutoScale(true); DPIUtil.setDeviceZoom(deviceZoom); }