diff options
17 files changed, 113 insertions, 82 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 08a460392..3c79ebba6 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -361,9 +361,9 @@ function testawtswt() { # HiDPI # #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* +#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* +testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT $* # 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; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index d235a2a29..1cc8fdb01 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -277,16 +277,18 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * </p> */ @Override - public int[] setSurfaceScale(final int[] result, final int[] pixelScale) { + public void setSurfaceScale(final int[] pixelScale) { SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); - if( null != result ) { - System.arraycopy(reqPixelScale, 0, result, 0, 2); - } + } + + @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; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java b/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java index f6101034b..de6ba51d7 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java @@ -30,7 +30,7 @@ package javax.media.nativewindow; /** * Adding mutable surface pixel scale property to implementing class, usually to a {@link NativeSurface} implementation, - * see {@link #setSurfaceScale(int[], int[])}. + * see {@link #setSurfaceScale(int[])}. */ public interface ScalableSurface { /** Setting surface-pixel-scale of {@value}, results in same pixel- and window-units. */ @@ -39,8 +39,7 @@ public interface ScalableSurface { public static final int AUTOMAX_PIXELSCALE = 0; /** - * Request a pixel scale in x- and y-direction for the associated {@link NativeSurface} - * and return the validated requested value, see below. + * Request a pixel scale in x- and y-direction for the associated {@link NativeSurface}. * <p> * Default pixel scale request for both directions is {@link #AUTOMAX_PIXELSCALE}. * </p> @@ -51,17 +50,24 @@ public interface ScalableSurface { * <p> * The <i>requested</i> pixel scale will be validated against platform limits before native scale-setup, * i.e. clipped to {@link #IDENTITY_PIXELSCALE} if not supported or clipped to the platform maximum. + * It can be queried via {@link #getRequestedSurfaceScale(int[])}. * </p> * <p> * The actual <i>realized</i> pixel scale values of the {@link NativeSurface} - * can be queried via {@link #getSurfaceScale(int[])} or + * can be queried via {@link #getCurrentSurfaceScale(int[])} or * computed via <code>surface.{@link NativeSurface#convertToPixelUnits(int[]) convertToPixelUnits}(new int[] { 1, 1 })</code> * </p> - * @param result int[2] storage for the result, maybe null - * @param pixelScale <i>requested</i> surface pixel scale int[2] values for x- and y-direction. - * @return the passed storage containing the validated requested pixelSize for chaining, if storage is not null + * @param pixelScale <i>requested</i> surface pixel scale int[2] values for x- and y-direction. */ - public int[] setSurfaceScale(final int[] result, final int[] pixelScale); + public void setSurfaceScale(final int[] pixelScale); + + /** + * Returns the requested pixel scale of the associated {@link NativeSurface}. + * + * @param result int[2] storage for the result + * @return the passed storage containing the requested pixelSize for chaining + */ + int[] getRequestedSurfaceScale(final int[] result); /** * Returns the current pixel scale of the associated {@link NativeSurface}. @@ -69,6 +75,6 @@ public interface ScalableSurface { * @param result int[2] storage for the result * @return the passed storage containing the current pixelSize for chaining */ - public int[] getSurfaceScale(final int[] result); + public int[] getCurrentSurfaceScale(final int[] result); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java index 4586812e1..22e67ecff 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java @@ -95,7 +95,7 @@ public class SurfaceScaleUtils { * Validate the given requested pixelScale value pair, i.e. clip it to the * limits of {@link ScalableSurface#AUTOMAX_PIXELSCALE} and {@link #getPlatformMaxPixelScale(int[])} * <p> - * To be used by {@link ScalableSurface#setSurfaceScale(int[], int[])} implementations. + * To be used by {@link ScalableSurface#setSurfaceScale(int[])} implementations. * </p> * * @param result int[2] storage for result diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index 96862cbd6..8f9379130 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -104,7 +104,7 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface /** * {@inheritDoc} * <p> - * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[], int[]) given pixelScale} directly. + * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[]) given pixelScale} directly. * </p> */ @Override @@ -117,7 +117,7 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface /** * {@inheritDoc} * <p> - * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[], int[]) given pixelScale} directly. + * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[]) given pixelScale} directly. * </p> */ @Override @@ -147,17 +147,19 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface * </p> */ @Override - public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { + public final void setSurfaceScale(final int[] pixelScale) { hasPixelScale[0] = pixelScale[0]; hasPixelScale[1] = pixelScale[1]; - if( null != result ) { - System.arraycopy(hasPixelScale, 0, result, 0, 2); - } + } + + @Override + public final int[] getRequestedSurfaceScale(final int[] result) { + System.arraycopy(hasPixelScale, 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; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 695fdac88..3728bfb59 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -114,8 +114,8 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - public int[] setSurfaceScale(final int[] result, final int[] pixelScale) { - super.setSurfaceScale(result, pixelScale); + public void setSurfaceScale(final int[] pixelScale) { + super.setSurfaceScale(pixelScale); if( 0 != getWindowHandle() ) { // locked at least once ! final int hadPixelScaleX = getPixelScaleX(); updatePixelScale(); @@ -132,7 +132,6 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { }); } } - return result; } @Override 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 diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index d68a1dfd4..0df105ff0 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1968,16 +1968,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public int[] setSurfaceScale(final int[] result, final int[] pixelScale) { + public void setSurfaceScale(final int[] pixelScale) { SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getSimpleName() : null); - if( null != result ) { - System.arraycopy(reqPixelScale, 0, result, 0, 2); - } + } + + @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; } diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java index e3c4e3b87..540d9b7e8 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java @@ -146,9 +146,9 @@ public class AWTCanvas extends Canvas { { jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig); // trigger initialization cycle - jawtWindow.setSurfaceScale(null, upstreamScale.getReqPixelScale() ); + jawtWindow.setSurfaceScale(upstreamScale.getReqPixelScale() ); jawtWindow.lockSurface(); - upstreamScale.setHasPixelScale(jawtWindow.getSurfaceScale(new int[2])); + upstreamScale.setHasPixelScale(jawtWindow.getCurrentSurfaceScale(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 07d31acfd..498556630 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -135,11 +135,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - public final int[] setSurfaceScale(final int[] result, final int[] pixelScale) { + public final void setSurfaceScale(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() ) { @@ -147,8 +144,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl final NativeWindow pWin = getParent(); if( pWin instanceof ScalableSurface ) { final ScalableSurface sSurf = (ScalableSurface)pWin; - sSurf.setSurfaceScale(result, reqPixelScale); - final int[] pPixelScale = sSurf.getSurfaceScale(new int[2]); + sSurf.setSurfaceScale(reqPixelScale); + final int[] pPixelScale = sSurf.getCurrentSurfaceScale(new int[2]); updatePixelScale(true /* sendEvent */, true /* defer */, pPixelScale[0]); // HiDPI: uniformPixelScale } else { // just notify updated pixelScale if offscreen @@ -175,7 +172,6 @@ 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 diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index 374c06514..6fb972bb5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -170,7 +170,8 @@ public class TestGearsES2AWT extends UITestCase { final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); setSize(resizeBy, frame, false, glCanvas, new Dimension(width, height)); - final int[] valReqSurfacePixelScale = glCanvas.setSurfaceScale(new int[2], reqSurfacePixelScale); + glCanvas.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new int[2]); frame.setLocation(xpos, ypos); switch( frameLayout) { @@ -253,7 +254,7 @@ public class TestGearsES2AWT extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glCanvas.getSurfaceScale(new int[2]); + final int[] hadSurfacePixelScale = glCanvas.getCurrentSurfaceScale(new int[2]); final int[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @@ -261,9 +262,10 @@ public class TestGearsES2AWT extends UITestCase { reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); - final int[] valReqSurfacePixelScale = glCanvas.setSurfaceScale(new int[2], reqSurfacePixelScale); + glCanvas.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new int[2]); final int[] hasSurfacePixelScale0 = glCanvas.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glCanvas.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new int[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ @@ -287,7 +289,7 @@ public class TestGearsES2AWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true)); final int[] hasSurfacePixelScale0 = glCanvas.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glCanvas.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new int[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java index 244cd8c04..551b27c3e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java @@ -124,7 +124,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { glJPanel.setMinimumSize(wsize); glJPanel.setPreferredSize(wsize); glJPanel.setSize(wsize); - final int[] valReqSurfacePixelScale = glJPanel.setSurfaceScale(new int[2], reqSurfacePixelScale); + glJPanel.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new int[2]); if( caps.isBitmap() || caps.getGLProfile().isGL2() ) { final Gears gears = new Gears(swapInterval); gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); @@ -170,7 +171,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel, true)); final int[] hasSurfacePixelScale0 = glJPanel.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glJPanel.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new int[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); @@ -194,7 +195,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glJPanel.getSurfaceScale(new int[2]); + final int[] hadSurfacePixelScale = glJPanel.getCurrentSurfaceScale(new int[2]); final int[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @@ -202,9 +203,10 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); - final int[] valReqSurfacePixelScale = glJPanel.setSurfaceScale(new int[2], reqSurfacePixelScale); + glJPanel.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new int[2]); final int[] hasSurfacePixelScale0 = glJPanel.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glJPanel.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new int[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index 458536d0f..3e78360f5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -130,7 +130,8 @@ public class TestGearsES2NEWT extends UITestCase { Screen screen = NewtFactory.createScreen(dpy, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); - final int[] valReqSurfacePixelScale = glWindow.setSurfaceScale(new int[2], reqSurfacePixelScale); + glWindow.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); glWindow.setSize(wsize.getWidth(), wsize.getHeight()); if(null != wpos) { glWindow.setPosition(wpos.getX(), wpos.getY()); @@ -347,7 +348,7 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glWindow.getSurfaceScale(new int[2]); + final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); final int[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @@ -355,9 +356,10 @@ public class TestGearsES2NEWT extends UITestCase { reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); - final int[] valReqSurfacePixelScale = glWindow.setSurfaceScale(new int[2], reqSurfacePixelScale); + glWindow.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ @@ -437,7 +439,7 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java index 22c1bc4d6..694efeaf4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java @@ -191,7 +191,8 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { Screen screen = NewtFactory.createScreen(dpy, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); - final int[] valReqSurfacePixelScale = glWindow.setSurfaceScale(new int[2], reqSurfacePixelScale); + glWindow.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); if ( shallUseOffscreenFBOLayer ) { @@ -306,7 +307,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glWindow.getSurfaceScale(new int[2]); + final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); final int[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @@ -314,9 +315,10 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); - final int[] valReqSurfacePixelScale = glWindow.setSurfaceScale(new int[2], reqSurfacePixelScale); + glWindow.setSurfaceScale(reqSurfacePixelScale); + final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ @@ -356,7 +358,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getSurfaceScale(new int[2]); + final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); |