diff options
author | Sven Gothel <[email protected]> | 2014-10-01 00:36:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-01 00:50:28 +0200 |
commit | 4bc2d19c4afb749a8088bf371f77a38fe7df0054 (patch) | |
tree | 699b7c7254280658d8b08eb96ef35781406e31d2 /src/jogl/classes/javax | |
parent | f18d1b00e98c982ed90b55218ba28e0e223c8453 (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')
-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 5e78a5df8..0cf9f30ef 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; @@ -546,12 +547,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 @@ -560,13 +560,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 { @@ -1301,23 +1301,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 ) { |