diff options
author | Sven Gothel <[email protected]> | 2013-09-06 16:42:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-06 16:42:25 +0200 |
commit | 44346b334ab47838f6a770a02f02036aa640f18c (patch) | |
tree | 5a317738d8dcab57e58e6afebd86fcaf0cba8a19 /src/jogl | |
parent | 6ef3c22ac6d633f8c0b903b34d5e3d7736f3a040 (diff) |
TileRenderer*: Add more detailed 'toString()' - override for TileRenderer
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java | 7 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java | 21 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 93ac32281..695e2d93d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -120,6 +120,13 @@ public class TileRenderer extends TileRendererBase { private int offsetX; private int offsetY; + @Override + protected StringBuilder tileDetails(StringBuilder sb) { + sb.append("# "+currentTile+": ["+currentColumn+"]["+currentRow+"] / "+columns+"x"+rows+", ") + .append("rowOrder "+rowOrder+", offset/size "+offsetX+"/"+offsetY+" "+tileSize.getWidth()+"x"+tileSize.getHeight()+" brd "+tileBorder+", "); + return super.tileDetails(sb); + } + /** * Creates a new TileRenderer object */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java index 4127b16e5..5baa1e4a5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java @@ -122,12 +122,25 @@ public abstract class TileRendererBase { protected GLEventListener glEventListenerPre = null; protected GLEventListener glEventListenerPost = null; - public String toString() { + private final String hashStr(Object o) { + final int h = null != o ? o.hashCode() : 0; + return "0x"+Integer.toHexString(h); + } + protected StringBuilder tileDetails(StringBuilder sb) { + return sb.append("cur "+currentTileXPos+"/"+currentTileYPos+" "+currentTileWidth+"x"+currentTileHeight+", buffer "+hashStr(tileBuffer)); + } + public StringBuilder toString(StringBuilder sb) { final int gladListenerCount = null != listeners ? listeners.length : 0; + sb.append("tile["); + tileDetails(sb); + sb.append("], image[size "+imageSize+", buffer "+hashStr(imageBuffer)+"], glad["+ + gladListenerCount+" listener, pre "+(null!=glEventListenerPre)+", post "+(null!=glEventListenerPost)+"]"); + return sb; + } + public String toString() { + StringBuilder sb = new StringBuilder(); return getClass().getSimpleName()+ - "[tile["+currentTileXPos+"/"+currentTileYPos+" "+currentTileWidth+"x"+currentTileHeight+", buffer "+tileBuffer+"], "+ - ", image[size "+imageSize+", buffer "+imageBuffer+"], glad["+ - gladListenerCount+" listener, pre "+(null!=glEventListenerPre)+", post "+(null!=glEventListenerPost)+"]]"; + "["+toString(sb).toString()+"]"; } protected TileRendererBase() { |