From 2634ce35031be322cb355e4d6055aace6a2c0619 Mon Sep 17 00:00:00 2001
From: Sven Gothel
+ * end of tiling is never reached w/ {@link RandomRileRenderer},
+ * i.e. method always returns false.
+ *
+ * Implementation {@link #reset()} internal states.
+ *
- * Method resets internal state and {@link #TR_ROWS} {@link #TR_COLUMNS} count. + * Implementation {@link #reset()} internal states. *
* * @param width The image-clipping.width @@ -178,7 +191,7 @@ public class TileRenderer extends TileRendererBase { imageClippingDim.setWidth(width); imageClippingDim.setHeight(height); } - setup(); + reset(); } /** @@ -210,7 +223,7 @@ public class TileRenderer extends TileRendererBase { * effective size of the tile depends on the border size, ie ( * width - 2*border ) * ( height - 2 * border ) *- * Method resets internal state and {@link #TR_ROWS} {@link #TR_COLUMNS} count. + * Implementation {@link #reset()} internal states. *
* * @param width @@ -236,7 +249,7 @@ public class TileRenderer extends TileRendererBase { tileSize.setHeight( height ); tileSizeNB.setWidth( width - 2 * border ); tileSizeNB.setHeight( height - 2 * border ); - setup(); + reset(); } /** @@ -251,32 +264,43 @@ public class TileRenderer extends TileRendererBase { } /** - * Sets up the number of rows and columns needed + * {@inheritDoc} + * + * Reset internal states of {@link TileRenderer} are: + *true
if all tiles have been rendered or {@link #setup()}
- * has not been called, otherwise false
.
- */
- public final boolean eot() { return 0 > currentTile; }
-
@Override
public final int getParam(int pname) {
switch (pname) {
@@ -341,16 +365,41 @@ public class TileRenderer extends TileRendererBase {
return 0 < imageSize.getWidth() && 0 < imageSize.getHeight();
}
+ /**
+ * {@inheritDoc}
+ *
+ * + * end of tiling is reached w/ {@link TileRenderer}, if at least one of the following is true: + *
+ * end of tiling criteria is implementation specific and may never be reached. + *
+ *+ * User needs to {@link #reset()} tiling after reaching end of tiling + * before calling {@link #beginTile(GL)} again. + *
+ */ + public abstract boolean eot(); + + /** + * Method resets implementation's internal state to start of tiling + * as required for {@link #beginTile(GL)} if {@link #eot() end of tiling} has been reached. + *+ * Implementation is a nop where {@link #eot() end of tiling} is never reached. + *
+ */ + public abstract void reset(); + /** * Begins rendering a tile. *@@ -351,10 +373,19 @@ public abstract class TileRendererBase { *
* User has to comply with the GL profile requirement. *
+ *+ * If {@link #eot() end of tiling} has been reached, + * user needs to {@link #reset()} tiling before calling this method. + *
* * @param gl The gl context - * @throws IllegalStateException if image-size has not been set + * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} is undefined, + * an {@link #isSetup() implementation related setup} has not be performed + * or {@ link #eot()} has been reached. See implementing classes. * @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used butgl
instance is < {@link GL2ES3}
+ * @see #isSetup()
+ * @see #eot()
+ * @see #reset()
*/
public abstract void beginTile(GL gl) throws IllegalStateException, GLException;
@@ -594,6 +625,12 @@ public abstract class TileRendererBase {
}
return;
}
+ if( eot() ) {
+ if( DEBUG ) {
+ System.err.println("TileRenderer.glel.display: EOT: "+TileRendererBase.this);
+ }
+ return;
+ }
final GL gl = drawable.getGL();
beginTile(gl);
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index f86a6a347..20dd802fb 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -837,20 +837,26 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
final Graphics2D g2d = (Graphics2D)graphics;
try {
printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
- try {
- final TileRenderer tileRenderer = printAWTTiles.renderer;
- if( DEBUG ) {
- System.err.println("AWT print.0: "+tileRenderer);
- }
- do {
- if( printGLAD != GLCanvas.this ) {
- tileRenderer.display();
- } else {
- Threading.invoke(true, displayOnEDTAction, getTreeLock());
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ if( printGLAD != GLCanvas.this ) {
+ tileRenderer.display();
+ } else {
+ Threading.invoke(true, displayOnEDTAction, getTreeLock());
+ }
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
}
- } while ( !tileRenderer.eot() );
- } finally {
- printAWTTiles.resetGraphics2D();
+ } finally {
+ tileRenderer.reset();
+ printAWTTiles.resetGraphics2D();
+ }
}
} catch (NoninvertibleTransformException nte) {
System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index fb39143b4..673f22aff 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -646,17 +646,26 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
final Graphics2D g2d = (Graphics2D)graphics;
try {
printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
- try {
- final TileRenderer tileRenderer = printAWTTiles.renderer;
- do {
- if( printGLAD != GLJPanel.this ) {
- tileRenderer.display();
- } else {
- backend.doPlainPaint();
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ if( printGLAD != GLJPanel.this ) {
+ tileRenderer.display();
+ } else {
+ backend.doPlainPaint();
+ }
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
}
- } while ( !tileRenderer.eot() );
- } finally {
- printAWTTiles.resetGraphics2D();
+ } finally {
+ tileRenderer.reset();
+ printAWTTiles.resetGraphics2D();
+ }
}
} catch (NoninvertibleTransformException nte) {
System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
--
cgit v1.2.3