From 44346b334ab47838f6a770a02f02036aa640f18c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 Sep 2013 16:42:25 +0200 Subject: TileRenderer*: Add more detailed 'toString()' - override for TileRenderer --- .../com/jogamp/opengl/util/TileRenderer.java | 7 +++++++ .../com/jogamp/opengl/util/TileRendererBase.java | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src') 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() { -- cgit v1.2.3