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/newt/classes/com | |
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/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 11 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 13 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index f5e4ff43f..48c7cd5bf 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -860,12 +860,19 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } final int w = getWidth(); final int h = getHeight(); + final boolean isNValid = newtChild.isNativeValid(); if(DEBUG) { - System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h); + System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h+", isNValid "+isNValid); } newtChild.setVisible(false); newtChild.setSize(w, h); - jawtWindow.setSurfaceScale(null, newtChild.getSurfaceScale(new int[2])); + final int[] reqSurfaceScale = new int[2]; + if( isNValid ) { + newtChild.getCurrentSurfaceScale(reqSurfaceScale); + } else { + newtChild.getRequestedSurfaceScale(reqSurfaceScale); + } + jawtWindow.setSurfaceScale(reqSurfaceScale); newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.addSurfaceUpdatedListener(jawtWindow); if( jawtWindow.isOffscreenLayerSurfaceEnabled() && diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index ae99b7465..25297917b 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -404,13 +404,18 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { - return window.setSurfaceScale(result, pixelScale); + public final void setSurfaceScale(final int[] pixelScale) { + window.setSurfaceScale(pixelScale); } @Override - public final int[] getSurfaceScale(final int[] result) { - return window.getSurfaceScale(result); + public final int[] getRequestedSurfaceScale(final int[] result) { + return window.getRequestedSurfaceScale(result); + } + + @Override + public final int[] getCurrentSurfaceScale(final int[] result) { + return window.getCurrentSurfaceScale(result); } @Override |