diff options
author | Harvey Harrison <[email protected]> | 2013-10-22 22:23:53 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-10-22 22:23:53 -0700 |
commit | 7fd9174afe73ae2a61af9a6d101afb7f21bb608b (patch) | |
tree | e3a181496d170e101357fc7a977e00c4e3eb0875 /src | |
parent | cf0d18c7b82801f41f6fe30f5d09b6a0a9546893 (diff) |
jogl: save on class size in the Debug pipelines
Using a format String and arg list produces smaller class files for the Debug classes
as many of the format strings are identical and shared.
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index 1d34ccfd7..a84869756 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -932,7 +932,7 @@ public class BuildComposablePipeline { } output.format(" return %s.glGetError();%n", getDownstreamObjectName()); output.println(" }"); - + output.println(" private void writeGLError(int err, String caller)"); output.println(" {"); output.println(" StringBuilder buf = new StringBuilder(Thread.currentThread()+"); @@ -1022,22 +1022,33 @@ public class BuildComposablePipeline { output.println(" int err = checkGLError();"); output.println(" if (err != GL_NO_ERROR) {"); - output.println(" String txt = \"" + m.getName() + "(\" +"); + + StringBuilder fmtsb = new StringBuilder(); + StringBuilder argsb = new StringBuilder(); + + fmtsb.append(" String txt = String.format(\"%s("); + argsb.append(" \"").append(m.getName()).append("\""); Class<?>[] params = m.getParameterTypes(); - for (int i = 0; params != null && i < params.length; i++) { - output.print(" \"<" + params[i].getName() + ">"); + for (int i = 0; i < params.length; i++) { + if (i > 0) { + fmtsb.append(", "); + } + fmtsb.append("<").append(params[i].getName()).append(">"); if (params[i].isArray()) { - output.print("\" +"); + //nothing } else if (params[i].equals(int.class)) { - output.print(" 0x\"+Integer.toHexString(arg" + i + ").toUpperCase() +"); + fmtsb.append(" 0x%X"); + argsb.append(", arg").append(i); } else { - output.print(" \"+arg" + i + " +"); - } - if (i < params.length - 1) { - output.println(" \", \" +"); + fmtsb.append(" %s"); + argsb.append(", arg").append(i); } } - output.println(" \")\";"); + fmtsb.append(")\","); + argsb.append(");"); + + output.println(fmtsb.toString()); + output.println(argsb.toString()); // calls to glGetError() are only allowed outside of glBegin/glEnd pairs output.println(" writeGLError( err, txt );"); output.println(" }"); |