diff options
author | Sven Gothel <[email protected]> | 2013-09-17 16:09:10 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-17 16:09:10 +0200 |
commit | 988da6f30322176b8301d17709f5461c35a01e19 (patch) | |
tree | 061df1ebe9e31cc1d29d7937f7f85c5c5cb671da /src/newt | |
parent | 4e1d3170667d6692c484b8366d578ab830408175 (diff) |
AWT Printing: Move init-test of setupPrint(..) to AWT-EDT Runnable ; GLJPanel: Attempt to initialize if not done yet (similar to GLCanvas)
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index a2d4eb7f0..64e9bb0f6 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -467,30 +467,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto @Override public void setupPrint(double scaleMatX, double scaleMatY, int numSamples) { - if( !validateComponent(true) ) { - if(DEBUG) { - System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet"); - } - return; // not yet available .. - } - if( !isVisible() ) { - if(DEBUG) { - System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible"); - } - return; // not yet available .. - } - final GLAutoDrawable glad = getGLAD(); - if( null == glad ) { - if( DEBUG ) { - System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild); - } - return; - } printActive = true; - printNumSamples = AWTTilePainter.getNumSamples(numSamples, glad.getChosenGLCapabilities()); - if( DEBUG ) { - System.err.println("AWT print.setup: canvasSize "+getWidth()+"x"+getWidth()+", scaleMat "+scaleMatX+" x "+scaleMatY+", numSamples "+numSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); - } + printNumSamples = numSamples; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, DEBUG); @@ -499,12 +477,38 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto private final Runnable setupPrintOnEDT = new Runnable() { @Override public void run() { + if( !validateComponent(true) ) { + if(DEBUG) { + System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet"); + } + printActive = false; + return; // not yet available .. + } + if( !isVisible() ) { + if(DEBUG) { + System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible"); + } + printActive = false; + return; // not yet available .. + } final GLAutoDrawable glad = getGLAD(); + if( null == glad ) { + if( DEBUG ) { + System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild); + } + printActive = false; + return; + } printAnimator = glad.getAnimator(); if( null != printAnimator ) { printAnimator.remove(glad); } final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable(); + final int reqNumSamples = printNumSamples; + printNumSamples = AWTTilePainter.getNumSamples(reqNumSamples, caps); + if( DEBUG ) { + System.err.println("AWT print.setup: canvasSize "+getWidth()+"x"+getWidth()+", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+", numSamples "+reqNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); + } if( caps.getSampleBuffers() ) { // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX printGLAD = glad; |