diff options
author | Sven Gothel <sgothel@jausoft.com> | 2014-10-01 00:36:09 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2014-10-01 00:36:09 +0200 |
commit | ce969bd565b0a6e72632630c88c4135d0410bf0f (patch) | |
tree | b42927da921cc41ce8828a7fe74e3a4b57f07a61 /src/jogl/classes/javax/media/opengl | |
parent | 4813455dc413fb37da28ed4845fb6f22c65629f4 (diff) |
Bug 1081: Fix GLJPanel Regression: Honor pre-init reshape-size at initializeBackendImpl()
Commit 84f367a73c5b16dcebfd877e82e1c2cb90ae74ce removed utilization of reshape-size
in case panel-size is valid, even if a reshape event happened in between:
- addNotify
- paintComponent
initializeBackendImpl() includes now uses reshape-size IFF handleReshape is set.
Before it was using reshape-size only if panel-size was invalid.
TestAWT03GLJPanelRecreate01 covers this issue.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 126513ec7..01e13e545 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -78,6 +78,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; import javax.media.opengl.GLFBODrawable; +import javax.media.opengl.GLOffscreenAutoDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLRunnable; import javax.media.opengl.GLSharedContextSetter; @@ -540,12 +541,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing _lock.lock(); try { if( !isInitialized ) { - handleReshape = false; initializeBackendImpl(); } if (!isInitialized || printActive) { - return; + return; } // NOTE: must do this when the context is not current as it may @@ -554,13 +554,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // current if( !printActive ) { if ( handleReshape ) { - handleReshape = false; - sendReshape = handleReshape(); + handleReshape = false; + sendReshape = handleReshape(); } if( isShowing ) { - updater.setGraphics(g); - backend.doPaintComponent(g); + updater.setGraphics(g); + backend.doPaintComponent(g); } } } finally { @@ -1295,23 +1295,24 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean initializeBackendImpl() { synchronized(initSync) { if( !isInitialized ) { - if ( 0 >= panelWidth || 0 >= panelHeight ) { - // See whether we have a non-zero size yet and can go ahead with - // initialization - if (0 >= reshapeWidth || 0 >= reshapeHeight ) { - return false; - } - + if( handleReshape ) { + panelWidth = reshapeWidth; + panelHeight = reshapeHeight; + handleReshape = false; if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " + + System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend.1: " + panelWidth+"x"+panelHeight+" @ scale "+getPixelScaleStr() + " -> " + reshapeWidth+"x"+reshapeHeight+" @ scale "+getPixelScaleStr()); } - // Pull down reshapeWidth and reshapeHeight into panelWidth and - // panelHeight eagerly in order to complete initialization, and - // force a reshape later - panelWidth = reshapeWidth; - panelHeight = reshapeHeight; + } else { + if (DEBUG) { + System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend.0: " + + panelWidth+"x"+panelHeight+" @ scale "+getPixelScaleStr()); + } + } + + if ( 0 >= panelWidth || 0 >= panelHeight ) { + return false; } if ( null == backend ) { |