diff options
author | Sven Gothel <[email protected]> | 2013-09-28 01:48:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-28 01:48:45 +0200 |
commit | c943c8cfc39df64ec6682722e86a54c538d3497b (patch) | |
tree | 05aee4d35019ea28b67e89df6be76f7f3f396250 /src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | |
parent | a2a057406ff5d21499860e8fef6ba88f07d9bf95 (diff) |
Fix AWT Printing: Use delegated GLDrawable's size for tile-size instead of AWT-GLAD's size, since the latter uses AWT's component size.
.. the AWT component size could have been modified after setupPrinting(..).
The AWT-GLAD getWidth() and getHeight() is implemented by AWT's component
and hence may not reflect the actual GLDrawable size while printing.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt/GLJPanel.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index e52317041..c639da367 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -557,13 +557,15 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, DEFAULT_PRINT_TILE_SIZE, DEFAULT_PRINT_TILE_SIZE, null); GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD); } + final GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); printAWTTiles.setIsGLOriented(printGLAD.isGLOriented()); - printAWTTiles.renderer.setTileSize(printGLAD.getWidth(), printGLAD.getHeight(), 0); + printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0); printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); - System.err.println("AWT print.setup "+printGLAD); + System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD); + System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable); } } }; |