aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java19
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java10
2 files changed, 16 insertions, 13 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index bdd12dfea..e95491f6b 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -663,12 +663,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) {
+ public final int[] setSurfaceScale(final int[] result, 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(reqPixelScale);
+ ns.setSurfaceScale(result, reqPixelScale);
final int hadPixelScaleX = hasPixelScale[0];
final int hadPixelScaleY = hasPixelScale[1];
ns.getSurfaceScale(hasPixelScale);
@@ -678,24 +681,20 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
}
+ return result;
}
@Override
public final int[] getSurfaceScale(final int[] result) {
- final ScalableSurface ns = jawtWindow;
- if( null != ns ) {
- return ns.getSurfaceScale(result);
- } else {
- System.arraycopy(reqPixelScale, 0, result, 0, 2);
- return result;
- }
+ System.arraycopy(hasPixelScale, 0, result, 0, 2);
+ return result;
}
private void createJAWTDrawableAndContext() {
if ( !Beans.isDesignTime() ) {
jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
- jawtWindow.setSurfaceScale(reqPixelScale);
+ jawtWindow.setSurfaceScale(null, reqPixelScale);
jawtWindow.lockSurface();
try {
drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow);
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;
}