From ac1901608c62ae1c5b82bccc3b2a70193031d5f0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 29 Sep 2013 10:25:32 +0200 Subject: GLJPanel/Printing: Perform backend.reshape immediatly after printing if resized; Add unit test for resize while printing. Perform immediatly reshape at releasePrint on AWT-EDT: - sendReshape = handleReshape(); // reshapeSize -> panelSize, backend reshape w/ GL reshape --- .../classes/javax/media/opengl/awt/GLJPanel.java | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 589cffeb5..84d085f76 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -489,12 +489,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing public void reshape(int x, int y, int width, int height) { super.reshape(x, y, width, height); - if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.reshape: " +reshapeWidth+"x"+reshapeHeight + " -> " + width+"x"+height); + if( DEBUG ) { + System.err.println(getThreadName()+": GLJPanel.reshape resize"+(printActive?"WithinPrint":"")+" [ panel "+ + panelWidth+"x"+panelHeight + + ", reshape: " +reshapeWidth+"x"+reshapeHeight + + "] -> "+(printActive?"skipped":"") + width+"x"+height); } if( !printActive ) { - // reshapeX = x; - // reshapeY = y; reshapeWidth = width; reshapeHeight = height; handleReshape = true; @@ -586,7 +587,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public void run() { if( DEBUG ) { - System.err.println("AWT print.release "+printAWTTiles); + System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0 "+printAWTTiles); } printAWTTiles.dispose(); printAWTTiles= null; @@ -603,13 +604,18 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // trigger reshape, i.e. gl-viewport and -listener - this component might got resized! final int awtWidth = GLJPanel.this.getWidth(); final int awtHeight= GLJPanel.this.getHeight(); - if( panelWidth != awtWidth || panelHeight != awtHeight ) { + final GLDrawable drawable = GLJPanel.this.getDelegatedDrawable(); + if( awtWidth != panelWidth || awtHeight != panelHeight || + drawable.getWidth() != panelWidth || drawable.getHeight() != panelHeight ) { + // -> !( awtSize == panelSize == drawableSize ) if ( DEBUG ) { - System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: reshape " +panelWidth+"x"+panelHeight + " -> " + awtWidth+"x"+awtHeight); - } + System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: resizeWithinPrint panel " +panelWidth+"x"+panelHeight + + ", draw "+drawable.getWidth()+"x"+drawable.getHeight()+ + " -> " + awtWidth+"x"+awtHeight); + } reshapeWidth = awtWidth; reshapeHeight = awtHeight; - handleReshape = true; // complete resize, sendReshape will be set later + sendReshape = handleReshape(); // reshapeSize -> panelSize, backend reshape w/ GL reshape } else { sendReshape = true; // only GL reshape } -- cgit v1.2.3