diff options
4 files changed, 13 insertions, 9 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 047c94b58..23898ba8c 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -845,7 +845,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing sendReshape = false; // clear reshape flag final Graphics2D g2d = (Graphics2D)graphics; - printAWTTiles.setupGraphics2DAndClipBounds(g2d); + printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight()); try { final TileRenderer tileRenderer = printAWTTiles.renderer; if( DEBUG ) { diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index c97d1e24f..84e3c39b4 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -620,7 +620,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing handleReshape = false; // ditto final Graphics2D g2d = (Graphics2D)graphics; - printAWTTiles.setupGraphics2DAndClipBounds(g2d); + printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight()); try { final TileRenderer tileRenderer = printAWTTiles.renderer; if( DEBUG ) { diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index 9aa6f3395..d316a6523 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -119,15 +119,17 @@ public class AWTTilePainter { * and {@link TileRenderer#setTileOffset(int, int) tile offset} according the * the {@link Graphics2D#getClipBounds() graphics clip bounds}. * </p> - * @param g2d + * @param g2d Graphics2D instance used for transform and clipping + * @param width width of the AWT component in case clipping is null + * @param height height of the AWT component in case clipping is null */ - public void setupGraphics2DAndClipBounds(Graphics2D g2d) { + public void setupGraphics2DAndClipBounds(Graphics2D g2d, int width, int height) { this.g2d = g2d; saveAT = g2d.getTransform(); g2d.scale(scaleMatX, scaleMatY); final Rectangle gClipOrig = g2d.getClipBounds(); - final Rectangle gClip = new Rectangle(gClipOrig); + final Rectangle gClip = null == gClipOrig ? new Rectangle(0, 0, width, height) : new Rectangle(gClipOrig); if( 0 > gClip.x ) { gClip.width += gClip.x; gClip.x = 0; @@ -237,9 +239,11 @@ public class AWTTilePainter { System.err.println("XXX tile-post.X clip "+oClip+" -> "+g2d.getClip()); g2d.setColor(Color.BLACK); g2d.drawRect(pX, pYf, tWidth, tHeight); - final Rectangle r = oClip.getBounds(); - g2d.setColor(Color.YELLOW); - g2d.drawRect(r.x, r.y, r.width, r.height); + if( null != oClip ) { + final Rectangle r = oClip.getBounds(); + g2d.setColor(Color.YELLOW); + g2d.drawRect(r.x, r.y, r.width, r.height); + } System.err.println("XXX tile-post.X "+renderer); System.err.println("XXX tile-post.X dst-img "+dstImage.getWidth()+"x"+dstImage.getHeight()+" -> "+pX+"/"+pYf); } diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 02bc17c79..87ec5e9c1 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -584,7 +584,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } final Graphics2D g2d = (Graphics2D)graphics; - printAWTTiles.setupGraphics2DAndClipBounds(g2d); + printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight()); try { final TileRenderer tileRenderer = printAWTTiles.renderer; if( DEBUG ) { |