diff options
author | Sven Gothel <[email protected]> | 2014-06-08 15:57:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-08 15:57:53 +0200 |
commit | 3fb76fcef1e6dd552ec0f677af67baf3186a1434 (patch) | |
tree | 00ff910246e857cf53d56f58f79e1c38896b912d /src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | |
parent | 2571ed0b5ef14155d204540d38b564a7d4cd47b6 (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/jogl/classes/javax/media/opengl/awt/GLJPanel.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 18de5a791..2f3cead4f 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -559,13 +559,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private final void updateWrappedSurfaceScale(final GLDrawable d) { final NativeSurface s = d.getNativeSurface(); if( s instanceof WrappedSurface ) { - ((WrappedSurface)s).setSurfaceScale( hasPixelScale ); + ((WrappedSurface)s).setSurfaceScale(null, hasPixelScale); } } @Override - public final void setSurfaceScale(final int[] pixelScale) { // HiDPI support + public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { // HiDPI support SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); + if( null != result ) { + System.arraycopy(reqPixelScale, 0, result, 0, 2); + } final Backend b = backend; if ( isInitialized && null != b ) { final int[] pixelScaleInt; @@ -582,11 +585,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing display(); } } + return result; } @Override public final int[] getSurfaceScale(final int[] result) { - System.arraycopy(isInitialized ? hasPixelScale : reqPixelScale, 0, result, 0, 2); + System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } |