Skip to content
Merged
Show file tree
Hide file tree
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 @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
Loading