summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-01-16 07:33:33 +0100
committerSven Gothel <[email protected]>2020-01-16 07:33:33 +0100
commitf63b94cccc71cf154a7a6d3359ceface3a683229 (patch)
tree76946bca9cf811ace8a99d8359400f2992d28852 /src/newt/classes
parent78609202731252f0024e6330cc94c52b05c1d146 (diff)
Bug 1422: NewtCanvasSWT: Handle case of !OSX && DPIUtil.getScalingFactor() > 1
NewtCanvasSWT.SWTNativeWindow's surfaceSize in pixel units shall only return scaled-up windowUnits using SWTAccessor.deviceZoomScaleUp(..) for !OSX and potentially auto scaled-up pixelUnits to passthrough (OSX). See detailed API doc to NewtCanvasSWT.newtScaleUp(..)
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index 3bcf4fdab..ae740bfaa 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -204,13 +204,23 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
}
}
/**
+ * Return scaled-up value {@code scaleUp} using {@link SWTAccessor#deviceZoomScaleUp(int)}
+ * for all non-native DPI autoscale platforms, currently !{@link SWTAccessor#isOSX}.
+ * <p>
+ * Return passthrough value {@code passthrough} unchanged
+ * for all native DPI autoscale platforms, currently {@link SWTAccessor#isOSX}.
+ * </p>
+ * <p>
* See {@link #setNewtChildSize(Rectangle)}
+ * </p>
+ * @param scaleUp value to be used for non-native DPI autoscale platforms for upscale
+ * @param passthrough value to be used for native DPI autoscale platforms for passthrough
*/
- private final int newtScaleUp(final int v) {
+ private final int newtScaleUp(final int scaleUp, final int passthrough) {
if( !SWTAccessor.isOSX ) {
- return SWTAccessor.deviceZoomScaleUp(v);
+ return SWTAccessor.deviceZoomScaleUp(scaleUp);
} else {
- return v;
+ return passthrough;
}
}
private final Listener swtListener = new Listener () {
@@ -656,12 +666,12 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
@Override
public int getWidth() {
- return newtScaleUp(clientAreaWindow.width);
+ return newtScaleUp(clientAreaWindow.width, clientAreaWindow.width);
}
@Override
public int getHeight() {
- return newtScaleUp(clientAreaWindow.height);
+ return newtScaleUp(clientAreaWindow.height, clientAreaWindow.height);
}
@Override
@@ -680,12 +690,12 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
@Override
public int getSurfaceWidth() {
- return newtScaleUp(clientAreaPixels.width);
+ return newtScaleUp(clientAreaWindow.width, clientAreaPixels.width);
}
@Override
public int getSurfaceHeight() {
- return newtScaleUp(clientAreaPixels.height);
+ return newtScaleUp(clientAreaWindow.height, clientAreaPixels.height);
}
@Override