aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-08 15:57:53 +0200
committerSven Gothel <[email protected]>2014-06-08 15:57:53 +0200
commit3fb76fcef1e6dd552ec0f677af67baf3186a1434 (patch)
tree00ff910246e857cf53d56f58f79e1c38896b912d /src/newt/classes/jogamp
parent2571ed0b5ef14155d204540d38b564a7d4cd47b6 (diff)
Bug 741 HiDPI: Simplify ScalableSurface [set|get]SurfaceScale(..) spec, which also fixed JAWTWindow getSurfaceScale() issue on Windows
Let setSurfaceScale(..) return the validated requested values and getSurfaceScale(..) always the current values. This removes complication and solves a bug w/ JAWTWindow on Windows, where we used 'drawable' as an indicator for 'previous locked' state. The latter is not true since on Windows 'drawable' is set to null in unlock, getWindowHandle() should be taken instead.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java8
3 files changed, 13 insertions, 5 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index f02b9740d..d68a1dfd4 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1968,13 +1968,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public void setSurfaceScale(final int[] pixelScale) {
+ public int[] setSurfaceScale(final int[] result, final int[] pixelScale) {
SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getSimpleName() : null);
+ if( null != result ) {
+ System.arraycopy(reqPixelScale, 0, result, 0, 2);
+ }
+ return result;
}
@Override
public final int[] getSurfaceScale(final int[] result) {
- System.arraycopy(isNativeValid() ? hasPixelScale : reqPixelScale, 0, result, 0, 2);
+ System.arraycopy(hasPixelScale, 0, result, 0, 2);
return result;
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index d01a2f21f..e3c4e3b87 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -146,7 +146,7 @@ public class AWTCanvas extends Canvas {
{
jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
// trigger initialization cycle
- jawtWindow.setSurfaceScale( upstreamScale.getReqPixelScale() );
+ jawtWindow.setSurfaceScale(null, upstreamScale.getReqPixelScale() );
jawtWindow.lockSurface();
upstreamScale.setHasPixelScale(jawtWindow.getSurfaceScale(new int[2]));
jawtWindow.unlockSurface();
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 0fa4739a3..07d31acfd 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -135,8 +135,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) {
+ public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) {
SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null);
+ if( null != result ) {
+ System.arraycopy(reqPixelScale, 0, result, 0, 2);
+ }
final int[] resPixelScale;
if( isNativeValid() ) {
@@ -144,7 +147,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final NativeWindow pWin = getParent();
if( pWin instanceof ScalableSurface ) {
final ScalableSurface sSurf = (ScalableSurface)pWin;
- sSurf.setSurfaceScale(reqPixelScale);
+ sSurf.setSurfaceScale(result, reqPixelScale);
final int[] pPixelScale = sSurf.getSurfaceScale(new int[2]);
updatePixelScale(true /* sendEvent */, true /* defer */, pPixelScale[0]); // HiDPI: uniformPixelScale
} else {
@@ -172,6 +175,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
reqPixelScale[0]+"x"+reqPixelScale[1]+" (validated) -> "+
resPixelScale[0]+"x"+resPixelScale[1]+" (result) - realized "+isNativeValid());
}
+ return result;
}
@Override