diff options
author | Sven Gothel <[email protected]> | 2014-06-08 18:04:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-08 18:04:51 +0200 |
commit | 58153310faa4089417037e67e06c0812908cecd2 (patch) | |
tree | bdb8aa75de6d2ec5ef9b351f0d0fc67fa18096ba /src/jogl/classes/javax | |
parent | 3fb76fcef1e6dd552ec0f677af67baf3186a1434 (diff) |
Bug 741 HiDPI: Simplify ScalableSurface (2): Add request pixelScale API entry, fixed NewtCanvasAWT use-case
We require the requested pixelScale in NewtCanvasAWT if the NEWT window (child)
is not yet realized, so the JAWTWindow can receive the request,
since realized/current pixelScale is still 1.
Remove return value (requested pixel scale):
- public int[] setSurfaceScale(final int[] result, final int[] pixelScale);
+ public void setSurfaceScale(final int[] pixelScale);
Add API hook to query requested pixel scale:
+ int[] getRequestedSurfaceScale(final int[] result);
Unique name for get[Current]*:
- public int[] getSurfaceScale(final int[] result);
+ public int[] getCurrentSurfaceScale(final int[] result);
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 20 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 14 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index e95491f6b..12db86475 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -663,29 +663,31 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { + public final void setSurfaceScale(final int[] pixelScale) { SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); - if( null != result ) { - System.arraycopy(reqPixelScale, 0, result, 0, 2); - } if( isRealized() ) { final ScalableSurface ns = jawtWindow; if( null != ns ) { - ns.setSurfaceScale(result, reqPixelScale); + ns.setSurfaceScale(reqPixelScale); final int hadPixelScaleX = hasPixelScale[0]; final int hadPixelScaleY = hasPixelScale[1]; - ns.getSurfaceScale(hasPixelScale); + ns.getCurrentSurfaceScale(hasPixelScale); if( hadPixelScaleX != hasPixelScale[0] || hadPixelScaleY != hasPixelScale[1] ) { reshapeImpl(getWidth(), getHeight()); display(); } } } + } + + @Override + public final int[] getRequestedSurfaceScale(final int[] result) { + System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getSurfaceScale(final int[] result) { + public final int[] getCurrentSurfaceScale(final int[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @@ -694,12 +696,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if ( !Beans.isDesignTime() ) { jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig); jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); - jawtWindow.setSurfaceScale(null, reqPixelScale); + jawtWindow.setSurfaceScale(reqPixelScale); jawtWindow.lockSurface(); try { drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow); createContextImpl(drawable); - jawtWindow.getSurfaceScale(hasPixelScale); + jawtWindow.getCurrentSurfaceScale(hasPixelScale); } finally { jawtWindow.unlockSurface(); } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 2f3cead4f..223badfb6 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -559,16 +559,13 @@ 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(null, hasPixelScale); + ((WrappedSurface)s).setSurfaceScale(hasPixelScale); } } @Override - public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { // HiDPI support + public final void setSurfaceScale(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; @@ -585,11 +582,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing display(); } } + } + + @Override + public final int[] getRequestedSurfaceScale(final int[] result) { + System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getSurfaceScale(final int[] result) { + public final int[] getCurrentSurfaceScale(final int[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } |