diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
70 files changed, 2620 insertions, 2610 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java index d0de3b3a0..496fb88c0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java @@ -54,16 +54,16 @@ import javax.media.opengl.GLAutoDrawable; class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // For efficient rendering of Swing components, in particular when // they overlap one another - private List<JComponent> lightweights = new ArrayList<JComponent>(); - private Map<RepaintManager,RepaintManager> repaintManagers = new IdentityHashMap<RepaintManager,RepaintManager>(); - private Map<JComponent,Rectangle> dirtyRegions = new IdentityHashMap<JComponent,Rectangle>(); + private final List<JComponent> lightweights = new ArrayList<JComponent>(); + private final Map<RepaintManager,RepaintManager> repaintManagers = new IdentityHashMap<RepaintManager,RepaintManager>(); + private final Map<JComponent,Rectangle> dirtyRegions = new IdentityHashMap<JComponent,Rectangle>(); @Override - public void display(ArrayList<GLAutoDrawable> drawables, - boolean ignoreExceptions, - boolean printExceptions) { + public void display(final ArrayList<GLAutoDrawable> drawables, + final boolean ignoreExceptions, + final boolean printExceptions) { for (int i=0; i<drawables.size(); i++) { - GLAutoDrawable drawable = drawables.get(i); + final GLAutoDrawable drawable = drawables.get(i); if (drawable instanceof JComponent) { // Lightweight components need a more efficient drawing // scheme than simply forcing repainting of each one in @@ -73,7 +73,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { } else { try { drawable.display(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { if (ignoreExceptions) { if (printExceptions) { e.printStackTrace(); @@ -88,7 +88,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { if (lightweights.size() > 0) { try { SwingUtilities.invokeAndWait(drawWithRepaintManagerRunnable); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } lightweights.clear(); @@ -97,10 +97,10 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // Uses RepaintManager APIs to implement more efficient redrawing of // the Swing widgets we're animating - private Runnable drawWithRepaintManagerRunnable = new Runnable() { + private final Runnable drawWithRepaintManagerRunnable = new Runnable() { @Override public void run() { - for (Iterator<JComponent> iter = lightweights.iterator(); iter.hasNext(); ) { + for (final Iterator<JComponent> iter = lightweights.iterator(); iter.hasNext(); ) { JComponent comp = iter.next(); RepaintManager rm = RepaintManager.currentManager(comp); rm.markCompletelyDirty(comp); @@ -117,13 +117,13 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // Walk up the hierarchy trying to find a non-optimizable // ancestor - Rectangle visible = comp.getVisibleRect(); + final Rectangle visible = comp.getVisibleRect(); int x = visible.x; int y = visible.y; while (comp != null) { x += comp.getX(); y += comp.getY(); - Component c = comp.getParent(); + final Component c = comp.getParent(); if ((c == null) || (!(c instanceof JComponent))) { comp = null; } else { @@ -132,7 +132,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { rm = RepaintManager.currentManager(comp); repaintManagers.put(rm, rm); // Need to dirty this region - Rectangle dirty = (Rectangle) dirtyRegions.get(comp); + Rectangle dirty = dirtyRegions.get(comp); if (dirty == null) { dirty = new Rectangle(x, y, visible.width, visible.height); dirtyRegions.put(comp, dirty); @@ -150,15 +150,15 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { } // Dirty any needed regions on non-optimizable components - for (Iterator<JComponent> iter = dirtyRegions.keySet().iterator(); iter.hasNext(); ) { - JComponent comp = iter.next(); - Rectangle rect = dirtyRegions.get(comp); - RepaintManager rm = RepaintManager.currentManager(comp); + for (final Iterator<JComponent> iter = dirtyRegions.keySet().iterator(); iter.hasNext(); ) { + final JComponent comp = iter.next(); + final Rectangle rect = dirtyRegions.get(comp); + final RepaintManager rm = RepaintManager.currentManager(comp); rm.addDirtyRegion(comp, rect.x, rect.y, rect.width, rect.height); } // Draw all dirty regions - for (Iterator<RepaintManager> iter = repaintManagers.keySet().iterator(); iter.hasNext(); ) { + for (final Iterator<RepaintManager> iter = repaintManagers.keySet().iterator(); iter.hasNext(); ) { iter.next().paintDirtyRegions(); } dirtyRegions.clear(); @@ -167,7 +167,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { }; @Override - public boolean blockUntilDone(Thread thread) { + public boolean blockUntilDone(final Thread thread) { return Thread.currentThread() != thread && !EventQueue.isDispatchThread(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 31938612a..ae09d81a4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -78,7 +78,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator w/ an associated ThreadGroup. */ - public Animator(ThreadGroup tg) { + public Animator(final ThreadGroup tg) { super(); setThreadGroup(tg); if(DEBUG) { @@ -89,7 +89,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator for a particular drawable. */ - public Animator(GLAutoDrawable drawable) { + public Animator(final GLAutoDrawable drawable) { super(); add(drawable); if(DEBUG) { @@ -100,7 +100,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator w/ an associated ThreadGroup for a particular drawable. */ - public Animator(ThreadGroup tg, GLAutoDrawable drawable) { + public Animator(final ThreadGroup tg, final GLAutoDrawable drawable) { super(); setThreadGroup(tg); add(drawable); @@ -110,7 +110,7 @@ public class Animator extends AnimatorBase { } @Override - protected final String getBaseName(String prefix) { + protected final String getBaseName(final String prefix) { return prefix + "Animator" ; } @@ -120,7 +120,7 @@ public class Animator extends AnimatorBase { * animation loop which prevents the CPU from getting swamped. * This method may not have an effect on subclasses. */ - public final synchronized void setRunAsFastAsPossible(boolean runFast) { + public final synchronized void setRunAsFastAsPossible(final boolean runFast) { runAsFastAsPossible = runFast; } @@ -151,7 +151,7 @@ public class Animator extends AnimatorBase { if( drawablesEmpty ) { pauseIssued = true; } - boolean wasPaused = pauseIssued; + final boolean wasPaused = pauseIssued; if (DEBUG) { System.err.println("Animator pause on " + animThread.getName() + ": " + toString()); } @@ -164,7 +164,7 @@ public class Animator extends AnimatorBase { Animator.this.notifyAll(); try { Animator.this.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } if (wasPaused) { // resume from pause -> reset counter @@ -192,7 +192,7 @@ public class Animator extends AnimatorBase { Thread.yield(); } } - } catch( ThreadDeath td) { + } catch( final ThreadDeath td) { if(DEBUG) { System.err.println("Animator caught: "+td.getClass().getName()+": "+td.getMessage()); td.printStackTrace(); @@ -232,7 +232,7 @@ public class Animator extends AnimatorBase { * @param tg the {@link ThreadGroup} * @throws GLException if the animator has already been started */ - public final synchronized void setThreadGroup(ThreadGroup tg) throws GLException { + public final synchronized void setThreadGroup(final ThreadGroup tg) throws GLException { if ( isStarted() ) { throw new GLException("Animator already started."); } @@ -248,7 +248,7 @@ public class Animator extends AnimatorBase { runnable = new MainLoop(); } fpsCounter.resetFPSCounter(); - String threadName = getThreadName()+"-"+baseName; + final String threadName = getThreadName()+"-"+baseName; Thread thread; if(null==threadGroup) { thread = new Thread(runnable, threadName); diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index 39643744a..68a48381e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -92,7 +92,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { Class<?> clazz; try { clazz = Class.forName("com.jogamp.opengl.util.AWTAnimatorImpl"); - } catch (Exception e) { + } catch (final Exception e) { clazz = null; } awtAnimatorImplClazz = clazz; @@ -112,7 +112,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { drawablesEmpty = true; } - private static final boolean useAWTAnimatorImpl(int modeBits) { + private static final boolean useAWTAnimatorImpl(final int modeBits) { return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz; } @@ -126,13 +126,13 @@ public abstract class AnimatorBase implements GLAnimatorControl { * * @throws GLException if Animator is {@link #isStarted()} */ - protected final synchronized void initImpl(boolean force) { + protected final synchronized void initImpl(final boolean force) { if( force || null == impl ) { if( useAWTAnimatorImpl( modeBits ) ) { try { impl = (AnimatorImpl) awtAnimatorImplClazz.newInstance(); baseName = getBaseName("AWT"); - } catch (Exception e) { e.printStackTrace(); } + } catch (final Exception e) { e.printStackTrace(); } } if( null == impl ) { impl = new DefaultAnimatorImpl(); @@ -154,7 +154,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD */ - public final synchronized void setModeBits(boolean enable, int bitValues) throws GLException { + public final synchronized void setModeBits(final boolean enable, final int bitValues) throws GLException { final int _oldModeBits = modeBits; if(enable) { modeBits |= bitValues; @@ -225,7 +225,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } } - boolean paused = pause(); + final boolean paused = pause(); drawables.remove(drawable); drawablesEmpty = drawables.size() == 0; drawable.setAnimator(null); @@ -267,7 +267,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @see #isExclusiveContextEnabled() */ // @Override - public final synchronized Thread setExclusiveContext(Thread t) { + public final synchronized Thread setExclusiveContext(final Thread t) { final boolean enable = null != t; final Thread old = userExclusiveContextThread; if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae @@ -299,7 +299,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @see #isExclusiveContextEnabled() */ // @Override - public final boolean setExclusiveContext(boolean enable) { + public final boolean setExclusiveContext(final boolean enable) { final boolean propagateState; final boolean oldExclusiveContext; final Thread _exclusiveContextThread; @@ -324,7 +324,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { while( 0<counter && isAnimating() && !validateDrawablesExclCtxState(dECT) ) { try { Thread.sleep(20); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } counter--; } if(resumed) { @@ -379,7 +379,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * to allow propagation of releasing the exclusive thread. * </p> */ - protected final synchronized void setDrawablesExclCtxState(boolean enable) { + protected final synchronized void setDrawablesExclCtxState(final boolean enable) { if(DEBUG) { System.err.println("AnimatorBase.setExclusiveContextImpl exlusive "+exclusiveContext+": Enable "+enable+" for "+this+" - "+Thread.currentThread()); // Thread.dumpStack(); @@ -388,12 +388,12 @@ public abstract class AnimatorBase implements GLAnimatorControl { for (int i=0; i<drawables.size(); i++) { try { drawables.get(i).setExclusiveContextThread( enable ? ect : null ); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { e.printStackTrace(); } } } - protected final boolean validateDrawablesExclCtxState(Thread expected) { + protected final boolean validateDrawablesExclCtxState(final Thread expected) { for (int i=0; i<drawables.size(); i++) { if( expected != drawables.get(i).getExclusiveContextThread() ) { return false; @@ -418,7 +418,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } @Override - public final void setUpdateFPSFrames(int frames, PrintStream out) { + public final void setUpdateFPSFrames(final int frames, final PrintStream out) { fpsCounter.setUpdateFPSFrames(frames, out); } @@ -470,7 +470,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { /** Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables. By default this flag is set to false, causing any exception thrown to halt the Animator. */ - public final void setIgnoreExceptions(boolean ignoreExceptions) { + public final void setIgnoreExceptions(final boolean ignoreExceptions) { this.ignoreExceptions = ignoreExceptions; } @@ -478,7 +478,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { this Animator (see {@link #setIgnoreExceptions}), to print the exceptions' stack traces for diagnostic information. Defaults to false. */ - public final void setPrintExceptions(boolean printExceptions) { + public final void setPrintExceptions(final boolean printExceptions) { this.printExceptions = printExceptions; } @@ -495,7 +495,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * if > <code>0</code>, method will wait for the given <code>pollPeriod</code> in milliseconds. * @return <code>true</code> if {@link Condition#eval() waitCondition.eval()} returned <code>false</code>, otherwise <code>false</code>. */ - protected final synchronized boolean finishLifecycleAction(Condition waitCondition, long pollPeriod) { + protected final synchronized boolean finishLifecycleAction(final Condition waitCondition, long pollPeriod) { /** * It's hard to tell whether the thread which changes the lifecycle has * dependencies on the Animator's internal thread. Currently we @@ -519,7 +519,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { notifyAll(); try { wait(pollPeriod); - } catch (InterruptedException ie) { } + } catch (final InterruptedException ie) { } remaining -= System.currentTimeMillis() - t1 ; nok = waitCondition.eval(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java index a9c6e6456..7fa4011f8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java @@ -42,14 +42,14 @@ import javax.media.opengl.GLAutoDrawable; class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl { @Override - public void display(ArrayList<GLAutoDrawable> drawables, - boolean ignoreExceptions, - boolean printExceptions) { + public void display(final ArrayList<GLAutoDrawable> drawables, + final boolean ignoreExceptions, + final boolean printExceptions) { for (int i=0; i<drawables.size(); i++) { - GLAutoDrawable drawable = drawables.get(i); + final GLAutoDrawable drawable = drawables.get(i); try { drawable.display(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { if (ignoreExceptions) { if (printExceptions) { e.printStackTrace(); @@ -62,7 +62,7 @@ class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl { } @Override - public boolean blockUntilDone(Thread thread) { + public boolean blockUntilDone(final Thread thread) { return Thread.currentThread() != thread; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 5bd803500..de99ae70d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -65,13 +65,13 @@ public class FPSAnimator extends AnimatorBase { private volatile boolean shouldStop; // MainTask trigger @Override - protected String getBaseName(String prefix) { + protected String getBaseName(final String prefix) { return "FPS" + prefix + "Animator" ; } /** Creates an FPSAnimator with a given target frames-per-second value. Equivalent to <code>FPSAnimator(null, fps)</code>. */ - public FPSAnimator(int fps) { + public FPSAnimator(final int fps) { this(null, fps); } @@ -79,21 +79,21 @@ public class FPSAnimator extends AnimatorBase { value and a flag indicating whether to use fixed-rate scheduling. Equivalent to <code>FPSAnimator(null, fps, scheduleAtFixedRate)</code>. */ - public FPSAnimator(int fps, boolean scheduleAtFixedRate) { + public FPSAnimator(final int fps, final boolean scheduleAtFixedRate) { this(null, fps, scheduleAtFixedRate); } /** Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate. Equivalent to <code>FPSAnimator(null, fps, false)</code>. */ - public FPSAnimator(GLAutoDrawable drawable, int fps) { + public FPSAnimator(final GLAutoDrawable drawable, final int fps) { this(drawable, fps, false); } /** Creates an FPSAnimator with a given target frames-per-second value, an initial drawable to animate, and a flag indicating whether to use fixed-rate scheduling. */ - public FPSAnimator(GLAutoDrawable drawable, int fps, boolean scheduleAtFixedRate) { + public FPSAnimator(final GLAutoDrawable drawable, final int fps, final boolean scheduleAtFixedRate) { super(); this.fps = fps; if (drawable != null) { @@ -106,7 +106,7 @@ public class FPSAnimator extends AnimatorBase { * @param fps * @throws GLException if the animator has already been started */ - public final synchronized void setFPS(int fps) throws GLException { + public final synchronized void setFPS(final int fps) throws GLException { if ( isStarted() ) { throw new GLException("Animator already started."); } @@ -122,7 +122,7 @@ public class FPSAnimator extends AnimatorBase { public MainTask() { } - public void start(Timer timer) { + public void start(final Timer timer) { fpsCounter.resetFPSCounter(); shouldRun = true; shouldStop = false; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index a58eb82cd..1a9ec2782 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -69,11 +69,11 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount) + public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int initialElementCount) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); adc.init(null, index, comps, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, 0, 0, false); return adc; } @@ -99,12 +99,12 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, - Buffer buffer) + public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); adc.init(null, index, comps, dataType, normalized, stride, buffer, comps*comps, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, 0, 0, false); return adc; } @@ -118,12 +118,12 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param normalized Whether the data shall be normalized * @param initialElementCount */ - public static GLArrayDataClient createGLSL(String name, int comps, - int dataType, boolean normalized, int initialElementCount) + public static GLArrayDataClient createGLSL(final String name, final int comps, + final int dataType, final boolean normalized, final int initialElementCount) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); adc.init(name, -1, comps, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, 0, 0, true); return adc; } @@ -138,18 +138,18 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param stride * @param buffer the user define data */ - public static GLArrayDataClient createGLSL(String name, int comps, - int dataType, boolean normalized, int stride, Buffer buffer) + public static GLArrayDataClient createGLSL(final String name, final int comps, + final int dataType, final boolean normalized, final int stride, final Buffer buffer) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); adc.init(name, -1, comps, dataType, normalized, stride, buffer, comps*comps, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, 0, 0, true); return adc; } @Override - public void associate(Object obj, boolean enable) { + public void associate(final Object obj, final boolean enable) { if(obj instanceof ShaderState) { if(enable) { shaderState = (ShaderState)obj; @@ -177,30 +177,30 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData // @Override - public final void setVBOWritten(boolean written) { + public final void setVBOWritten(final boolean written) { bufferWritten = ( 0 == mappedElementCount ) ? written : true; } @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { reset(gl); super.destroy(gl); } @Override - public void reset(GL gl) { + public void reset(final GL gl) { enableBuffer(gl, false); reset(); } @Override - public void seal(GL gl, boolean seal) { + public void seal(final GL gl, final boolean seal) { seal(seal); enableBuffer(gl, seal); } @Override - public void enableBuffer(GL gl, boolean enable) { + public void enableBuffer(final GL gl, final boolean enable) { if( enableBufferAlways || bufferEnabled != enable ) { if(enable) { checkSeal(true); @@ -213,7 +213,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public boolean bindBuffer(GL gl, boolean bind) { + public boolean bindBuffer(final GL gl, final boolean bind) { if(bind) { checkSeal(true); // init/generate VBO name if not done yet @@ -223,7 +223,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void setEnableAlways(boolean always) { + public void setEnableAlways(final boolean always) { enableBufferAlways = always; } @@ -242,7 +242,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void seal(boolean seal) + public void seal(final boolean seal) { if( sealed == seal ) return; sealed = seal; @@ -281,7 +281,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * The arguments remaining elements must be a multiple of this arrays element stride. */ @Override - public void put(Buffer v) { + public void put(final Buffer v) { if ( sealed ) return; /** FIXME: isn't true for interleaved arrays ! if(0!=(v.remaining() % strideL)) { @@ -292,33 +292,33 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void putb(byte v) { + public void putb(final byte v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.putb(buffer, v); } @Override - public void puts(short v) { + public void puts(final short v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.puts(buffer, v); } @Override - public void puti(int v) { + public void puti(final int v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.puti(buffer, v); } @Override - public void putx(int v) { + public void putx(final int v) { puti(v); } @Override - public void putf(float v) { + public void putf(final float v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.putf(buffer, v); @@ -349,7 +349,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData // non public matters - protected final boolean growBufferIfNecessary(int spareComponents) { + protected final boolean growBufferIfNecessary(final int spareComponents) { if( buffer==null || buffer.remaining()<spareComponents ) { if( 0 != mappedElementCount ) { throw new GLException("Mapped buffer can't grow. Insufficient storage size: Needed "+spareComponents+" components, "+ @@ -411,7 +411,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } } - protected final void checkSeal(boolean test) throws GLException { + protected final void checkSeal(final boolean test) throws GLException { if(!alive) { throw new GLException("Invalid state: "+this); } @@ -424,9 +424,9 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } } - protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, - int initialElementCount, int mappedElementCount, boolean isVertexAttribute, - GLArrayHandler handler, int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL) + protected void init(final String name, final int index, final int comps, final int dataType, final boolean normalized, final int stride, final Buffer data, + final int initialElementCount, final int mappedElementCount, final boolean isVertexAttribute, + final GLArrayHandler handler, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget, final boolean usesGLSL) throws GLException { super.init(name, index, comps, dataType, normalized, stride, data, mappedElementCount, @@ -450,7 +450,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData private boolean isValidated = false; - protected void init_vbo(GL gl) { + protected void init_vbo(final GL gl) { if(!isValidated ) { isValidated = true; validate(gl.getGLProfile(), true); @@ -468,7 +468,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * All other values are simply copied. * </p> */ - public GLArrayDataClient(GLArrayDataClient src) { + public GLArrayDataClient(final GLArrayDataClient src) { super(src); this.isValidated = src.isValidated; this.sealed = src.sealed; @@ -481,7 +481,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData try { final Constructor<? extends GLArrayHandler> ctor = clazz.getConstructor(GLArrayDataEditable.class); this.glArrayHandler = ctor.newInstance(this); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException("Could not ctor "+clazz.getName()+"("+this.getClass().getName()+")", e); } } else { diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index 833f1ccda..51c55e326 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -81,12 +81,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataServer createFixed(int index, int compsPerElement, int dataType, boolean normalized, int stride, - Buffer buffer, int vboUsage) + public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); ads.init(null, index, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -113,12 +113,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataServer createFixed(int index, int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); ads.init(null, index, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -134,12 +134,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSL(String name, int compsPerElement, - int dataType, boolean normalized, int initialElementCount, int vboUsage) + public static GLArrayDataServer createGLSL(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int initialElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -155,12 +155,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLMapped(String name, int compsPerElement, - int dataType, boolean normalized, int mappedElementCount, int vboUsage) + public static GLArrayDataServer createGLSLMapped(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int mappedElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, 0, null, 0 /* initialElementCount */, mappedElementCount, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); ads.seal(true); @@ -178,13 +178,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer the user define data * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSL(String name, int compsPerElement, - int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createGLSL(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -203,12 +203,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. * {@link GL#glGenBuffers(int, int[], int) */ - public static GLArrayDataServer createData(int compsPerElement, int dataType, int stride, - Buffer buffer, int vboUsage, int vboTarget) + public static GLArrayDataServer createData(final int compsPerElement, final int dataType, final int stride, + final Buffer buffer, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -225,12 +225,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. */ - public static GLArrayDataServer createData(int compsPerElement, int dataType, int initialElementCount, - int vboUsage, int vboTarget) + public static GLArrayDataServer createData(final int compsPerElement, final int dataType, final int initialElementCount, + final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -249,12 +249,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. */ - public static GLArrayDataServer createDataMapped(int compsPerElement, int dataType, int mappedElementCount, - int vboUsage, int vboTarget) + public static GLArrayDataServer createDataMapped(final int compsPerElement, final int dataType, final int mappedElementCount, + final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -271,12 +271,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount The initial number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createFixedInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, false, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -293,12 +293,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount The total number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, - int vboUsage) + public static GLArrayDataServer createFixedInterleavedMapped(final int compsPerElement, final int dataType, final boolean normalized, final int mappedElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, false, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); ads.seal(true); @@ -317,12 +317,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer The user define data of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createFixedInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -342,7 +342,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param comps This interleaved array segment's component count per element * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public GLArrayData addFixedSubArray(int index, int comps, int vboTarget) { + public GLArrayData addFixedSubArray(final int index, final int comps, final int vboTarget) { if(interleavedOffset >= getComponentCount() * getComponentSizeInBytes()) { final int iOffC = interleavedOffset / getComponentSizeInBytes(); throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); @@ -382,12 +382,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount The initial number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -404,11 +404,11 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount The total number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage) + public static GLArrayDataServer createGLSLInterleavedMapped(final int compsPerElement, final int dataType, final boolean normalized, final int mappedElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); ads.seal(true); @@ -427,12 +427,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer The user define data of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -451,7 +451,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param comps This interleaved array segment's component count per element * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public GLArrayData addGLSLSubArray(String name, int comps, int vboTarget) { + public GLArrayData addGLSLSubArray(final String name, final int comps, final int vboTarget) { if(interleavedOffset >= getComponentCount() * getComponentSizeInBytes()) { final int iOffC = interleavedOffset / getComponentSizeInBytes(); throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); @@ -480,7 +480,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ad; } - public final void setInterleavedOffset(int interleavedOffset) { + public final void setInterleavedOffset(final int interleavedOffset) { this.interleavedOffset = interleavedOffset; } @@ -497,11 +497,11 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE // @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { // super.destroy(gl): // - GLArrayDataClient.destroy(gl): disables & clears client-side buffer // - GLArrayDataWrapper.destroy(gl) (clears all values 'vboName' ..) - int _vboName = vboName; + final int _vboName = vboName; super.destroy(gl); if(_vboName!=0) { final int[] tmp = new int[] { _vboName } ; @@ -520,12 +520,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * Only possible if buffer is defined. */ @Override - public void setVBOEnabled(boolean vboUsage) { + public void setVBOEnabled(final boolean vboUsage) { checkSeal(false); super.setVBOEnabled(vboUsage); } - public GLBufferStorage mapStorage(GL gl, int access) { + public GLBufferStorage mapStorage(final GL gl, final int access) { if( null != this.getBuffer() ) { throw new IllegalStateException("user buffer not null"); } @@ -542,7 +542,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE rewind(); return storage; } - public GLBufferStorage mapStorage(GL gl, long offset, long length, int access) { + public GLBufferStorage mapStorage(final GL gl, final long offset, final long length, final int access) { if( null != this.getBuffer() ) { throw new IllegalStateException("user buffer not null"); } @@ -559,7 +559,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE rewind(); return storage; } - private final void setMappedBuffer(GLBufferStorage storage) { + private final void setMappedBuffer(final GLBufferStorage storage) { mappedStorage = storage; final ByteBuffer bb = storage.getMappedBuffer(); if(componentClazz==ByteBuffer.class) { @@ -575,7 +575,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } } - public void unmapStorage(GL gl) { + public void unmapStorage(final GL gl) { if( null == mappedStorage ) { throw new IllegalStateException("not mapped"); } @@ -621,10 +621,10 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE // @Override - protected void init(String name, int index, int comps, int dataType, boolean normalized, - int stride, Buffer data, int initialElementCount, int mappedElementCount, - boolean isVertexAttribute, - GLArrayHandler glArrayHandler, int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL) + protected void init(final String name, final int index, final int comps, final int dataType, final boolean normalized, + final int stride, final Buffer data, final int initialElementCount, final int mappedElementCount, + final boolean isVertexAttribute, + final GLArrayHandler glArrayHandler, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget, final boolean usesGLSL) throws GLException { super.init(name, index, comps, dataType, normalized, stride, data, initialElementCount, mappedElementCount, isVertexAttribute, @@ -634,10 +634,10 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } @Override - protected void init_vbo(GL gl) { + protected void init_vbo(final GL gl) { super.init_vbo(gl); if(vboEnabled && vboName==0) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; if(0 < interleavedOffset) { @@ -657,7 +657,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * All other values are simply copied. * </p> */ - public GLArrayDataServer(GLArrayDataServer src) { + public GLArrayDataServer(final GLArrayDataServer src) { super(src); this.interleavedOffset = src.interleavedOffset; this.mappedStorage = src.mappedStorage; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index f617fed73..867bc00ac 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -66,11 +66,11 @@ public class GLArrayDataWrapper implements GLArrayData { * * @throws GLException */ - public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, - Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(null, index, comps, dataType, normalized, stride, buffer, 0 /* mappedElementCount */, false, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -93,11 +93,11 @@ public class GLArrayDataWrapper implements GLArrayData { * * @throws GLException */ - public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, - int mappedElementCount, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final int mappedElementCount, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(null, index, comps, dataType, normalized, stride, null, mappedElementCount, false, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -119,11 +119,11 @@ public class GLArrayDataWrapper implements GLArrayData { * @return the new create instance * @throws GLException */ - public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, - Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(name, -1, comps, dataType, normalized, stride, buffer, 0 /* mappedElementCount */, true, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -145,11 +145,11 @@ public class GLArrayDataWrapper implements GLArrayData { * @return the new create instance * @throws GLException */ - public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, - int mappedElementCount, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final int stride, + final int mappedElementCount, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(name, -1, comps, dataType, normalized, stride, null, mappedElementCount, true, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -163,7 +163,7 @@ public class GLArrayDataWrapper implements GLArrayData { * @param throwException whether to throw an exception if this instance has invalid parameter or not * @return true if this instance has invalid parameter, otherwise false */ - public final boolean validate(GLProfile glp, boolean throwException) { + public final boolean validate(final GLProfile glp, final boolean throwException) { if(!alive) { if(throwException) { throw new GLException("Instance !alive "+this); @@ -180,7 +180,7 @@ public class GLArrayDataWrapper implements GLArrayData { } @Override - public void associate(Object obj, boolean enable) { + public void associate(final Object obj, final boolean enable) { // nop } @@ -198,16 +198,16 @@ public class GLArrayDataWrapper implements GLArrayData { public final int getLocation() { return location; } @Override - public final int setLocation(int v) { location = v; return location; } + public final int setLocation(final int v) { location = v; return location; } @Override - public final int setLocation(GL2ES2 gl, int program) { + public final int setLocation(final GL2ES2 gl, final int program) { location = gl.glGetAttribLocation(program, name); return location; } @Override - public final int setLocation(GL2ES2 gl, int program, int location) { + public final int setLocation(final GL2ES2 gl, final int program, final int location) { this.location = location; gl.glBindAttribLocation(program, location, name); return location; @@ -275,7 +275,7 @@ public class GLArrayDataWrapper implements GLArrayData { public final Class<?> getBufferClass() { return componentClazz; } @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { buffer = null; vboName=0; vboEnabled=false; @@ -305,7 +305,7 @@ public class GLArrayDataWrapper implements GLArrayData { "]"; } - public static final Class<?> getBufferClass(int dataType) { + public static final Class<?> getBufferClass(final int dataType) { switch(dataType) { case GL.GL_BYTE: case GL.GL_UNSIGNED_BYTE: @@ -314,7 +314,7 @@ public class GLArrayDataWrapper implements GLArrayData { case GL.GL_UNSIGNED_SHORT: return ShortBuffer.class; case GL.GL_UNSIGNED_INT: - case GL2ES1.GL_FIXED: + case GL.GL_FIXED: case GL2ES2.GL_INT: return IntBuffer.class; case GL.GL_FLOAT: @@ -325,7 +325,7 @@ public class GLArrayDataWrapper implements GLArrayData { } @Override - public void setName(String newName) { + public void setName(final String newName) { location = -1; name = newName; } @@ -335,7 +335,7 @@ public class GLArrayDataWrapper implements GLArrayData { * Only possible if a VBO buffer name is defined. * @see #setVBOName(int) */ - public void setVBOEnabled(boolean vboEnabled) { + public void setVBOEnabled(final boolean vboEnabled) { this.vboEnabled=vboEnabled; } @@ -345,7 +345,7 @@ public class GLArrayDataWrapper implements GLArrayData { * * @see #setVBOEnabled(boolean) */ - public void setVBOName(int vboName) { + public void setVBOName(final int vboName) { this.vboName=vboName; setVBOEnabled(0!=vboName); } @@ -353,20 +353,20 @@ public class GLArrayDataWrapper implements GLArrayData { /** * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public void setVBOUsage(int vboUsage) { + public void setVBOUsage(final int vboUsage) { this.vboUsage = vboUsage; } /** * @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public void setVBOTarget(int vboTarget) { + public void setVBOTarget(final int vboTarget) { this.vboTarget = vboTarget; } - protected void init(String name, int index, int componentsPerElement, int componentType, - boolean normalized, int stride, Buffer data, int mappedElementCount, - boolean isVertexAttribute, int vboName, long vboOffset, int vboUsage, int vboTarget) + protected void init(final String name, final int index, final int componentsPerElement, final int componentType, + final boolean normalized, final int stride, final Buffer data, final int mappedElementCount, + final boolean isVertexAttribute, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { if( 0<mappedElementCount && null != data ) { @@ -452,7 +452,7 @@ public class GLArrayDataWrapper implements GLArrayData { * All other values are simply copied. * </p> */ - public GLArrayDataWrapper(GLArrayDataWrapper src) { + public GLArrayDataWrapper(final GLArrayDataWrapper src) { this.alive = src.alive; this.index = src.index; this.location = src.location; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index b9903ac6d..67dc08450 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -44,6 +44,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLES2; import javax.media.opengl.GLException; @@ -65,7 +66,7 @@ public class GLBuffers extends Buffers { * GL_UNSIGNED_INT, <br/> * GL_HILO16_NV <br/> */ - public static final boolean isSignedGLType(int glType) { + public static final boolean isSignedGLType(final int glType) { switch (glType) { // 29 case GL.GL_UNSIGNED_BYTE: case GL.GL_UNSIGNED_SHORT: @@ -85,7 +86,7 @@ public class GLBuffers extends Buffers { * GL_HALF_FLOAT_OES, <br/> * GL_DOUBLE <br/> */ - public static final boolean isGLTypeFixedPoint(int glType) { + public static final boolean isGLTypeFixedPoint(final int glType) { switch(glType) { case GL.GL_FLOAT: case GL.GL_HALF_FLOAT: @@ -123,7 +124,7 @@ public class GLBuffers extends Buffers { * * @return -1 if glType is unhandled, otherwise the actual value > 0 */ - public static final int sizeOfGLType(int glType) { + public static final int sizeOfGLType(final int glType) { switch (glType) { // 29 // case GL2.GL_BITMAP: case GL.GL_BYTE: @@ -136,9 +137,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -151,16 +152,16 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return SIZEOF_INT; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return SIZEOF_LONG; case GL.GL_FLOAT: @@ -197,7 +198,7 @@ public class GLBuffers extends Buffers { * * @return null if glType is unhandled, otherwise the new Buffer object */ - public static final Buffer newDirectGLBuffer(int glType, int numElements) { + public static final Buffer newDirectGLBuffer(final int glType, final int numElements) { switch (glType) { // 29 case GL.GL_BYTE: case GL.GL_UNSIGNED_BYTE: @@ -209,9 +210,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -224,22 +225,22 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return newDirectIntBuffer(numElements); - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return newDirectLongBuffer(numElements); case GL.GL_FLOAT: return newDirectFloatBuffer(numElements); - case GL2.GL_DOUBLE: + case GL2GL3.GL_DOUBLE: return newDirectDoubleBuffer(numElements); } return null; @@ -269,7 +270,7 @@ public class GLBuffers extends Buffers { * GL_FLOAT, GL_DOUBLE <br/> * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object */ - public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) { + public static final Buffer sliceGLBuffer(final ByteBuffer parent, final int bytePos, final int byteLen, final int glType) { if (parent == null || byteLen == 0) { return null; } @@ -292,9 +293,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -304,21 +305,21 @@ public class GLBuffers extends Buffers { break; case GL.GL_FIXED: - case GL2GL3.GL_INT: - case GL2ES2.GL_UNSIGNED_INT: + case GL2ES2.GL_INT: + case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: res = parent.slice().order(parent.order()).asIntBuffer(); // slice and duplicate may change byte order break; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: res = parent.slice().order(parent.order()).asLongBuffer(); // slice and duplicate may change byte order break; @@ -326,7 +327,7 @@ public class GLBuffers extends Buffers { res = parent.slice().order(parent.order()).asFloatBuffer(); // slice and duplicate may change byte order break; - case GL2.GL_DOUBLE: + case GL2GL3.GL_DOUBLE: res = parent.slice().order(parent.order()).asDoubleBuffer(); // slice and duplicate may change byte order break; } @@ -334,7 +335,7 @@ public class GLBuffers extends Buffers { return res; } - private static final int glGetInteger(GL gl, int pname, int[] tmp) { + private static final int glGetInteger(final GL gl, final int pname, final int[] tmp) { gl.glGetIntegerv(pname, tmp, 0); return tmp[0]; } @@ -359,9 +360,9 @@ public class GLBuffers extends Buffers { * @return required minimum size of the buffer in bytes * @throws GLException if alignment is invalid. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], - int bytesPerPixel, int width, int height, int depth, - boolean pack) { + public static final int sizeof(final GL gl, final int tmp[], + final int bytesPerPixel, int width, int height, int depth, + final boolean pack) { int rowLength = 0; int skipRows = 0; int skipPixels = 0; @@ -372,9 +373,9 @@ public class GLBuffers extends Buffers { if (pack) { alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); if(gl.isGL2GL3()) { - rowLength = glGetInteger(gl, GL2GL3.GL_PACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_PIXELS, tmp); + rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp); + skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp); + skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp); if (depth > 1) { imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); @@ -383,12 +384,12 @@ public class GLBuffers extends Buffers { } else { alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); if(gl.isGL2GL3 ()) { - rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_PIXELS, tmp); + rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp); + skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp); + skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp); if (depth > 1) { - imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp); - skipImages = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_IMAGES, tmp); + imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp); + skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp); } } } @@ -511,9 +512,9 @@ public class GLBuffers extends Buffers { * @return required minimum size of the buffer in bytes * @throws GLException if format, type or alignment is not handled. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], - int format, int type, int width, int height, int depth, - boolean pack) throws GLException { + public static final int sizeof(final GL gl, final int tmp[], + final int format, final int type, final int width, final int height, final int depth, + final boolean pack) throws GLException { if (width < 0) return 0; if (height < 0) return 0; if (depth < 0) return 0; @@ -578,14 +579,14 @@ public class GLBuffers extends Buffers { * @return required size of one pixel in bytes * @throws GLException if format or type alignment is not handled. Please contact the maintainer if this is our bug. */ - public static final int bytesPerPixel(int format, int type) throws GLException { + public static final int bytesPerPixel(final int format, final int type) throws GLException { int compSize = 0; int compCount = componentCount(format); switch (type) /* 30 */ { case GL2.GL_BITMAP: - if (GL2.GL_COLOR_INDEX == format || GL2GL3.GL_STENCIL_INDEX == format) { + if (GL2.GL_COLOR_INDEX == format || GL2ES2.GL_STENCIL_INDEX == format) { compSize = 1; } case GL.GL_BYTE: @@ -615,9 +616,9 @@ public class GLBuffers extends Buffers { break; case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -631,15 +632,15 @@ public class GLBuffers extends Buffers { break; case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: compSize = 4; compCount = 1; break; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: compSize = 8; compCount = 1; break; @@ -681,33 +682,33 @@ public class GLBuffers extends Buffers { * @return number of components required for the given OpenGL format * @throws GLException if format is not handled. Please contact the maintainer if this is our bug. */ - public static final int componentCount(int format) throws GLException { + public static final int componentCount(final int format) throws GLException { final int compCount; switch (format) /* 26 */ { case GL2.GL_COLOR_INDEX: - case GL2GL3.GL_STENCIL_INDEX: - case GL2GL3.GL_DEPTH_COMPONENT: - case GL2GL3.GL_DEPTH_STENCIL: - case GL2GL3.GL_RED: - case GL2GL3.GL_RED_INTEGER: - case GL2GL3.GL_GREEN: + case GL2ES2.GL_STENCIL_INDEX: + case GL2ES2.GL_DEPTH_COMPONENT: + case GL.GL_DEPTH_STENCIL: + case GL2ES2.GL_RED: + case GL2ES3.GL_RED_INTEGER: + case GL2ES3.GL_GREEN: case GL2GL3.GL_GREEN_INTEGER: - case GL2GL3.GL_BLUE: + case GL2ES3.GL_BLUE: case GL2GL3.GL_BLUE_INTEGER: case GL.GL_ALPHA: case GL.GL_LUMINANCE: compCount = 1; break; case GL.GL_LUMINANCE_ALPHA: - case GL2GL3.GL_RG: - case GL2GL3.GL_RG_INTEGER: + case GL2ES2.GL_RG: + case GL2ES3.GL_RG_INTEGER: case GL2.GL_HILO_NV: case GL2.GL_SIGNED_HILO_NV: compCount = 2; break; case GL.GL_RGB: - case GL2GL3.GL_RGB_INTEGER: + case GL2ES3.GL_RGB_INTEGER: case GL2GL3.GL_BGR: case GL2GL3.GL_BGR_INTEGER: compCount = 3; @@ -716,7 +717,7 @@ public class GLBuffers extends Buffers { compCount = 3; break; case GL.GL_RGBA: - case GL2GL3.GL_RGBA_INTEGER: + case GL2ES3.GL_RGBA_INTEGER: case GL.GL_BGRA: case GL2GL3.GL_BGRA_INTEGER: case GL2.GL_ABGR_EXT: @@ -748,9 +749,9 @@ public class GLBuffers extends Buffers { //---------------------------------------------------------------------- // Conversion routines // - public final static float[] getFloatArray(double[] source) { + public final static float[] getFloatArray(final double[] source) { int i = source.length; - float[] dest = new float[i--]; + final float[] dest = new float[i--]; while (i >= 0) { dest[i] = (float) source[i]; i--; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java index cf88e7bf6..c74284299 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java @@ -47,19 +47,19 @@ import jogamp.opengl.Debug; public class GLDrawableUtil { protected static final boolean DEBUG = Debug.debug("GLDrawable"); - public static final boolean isAnimatorStartedOnOtherThread(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorStartedOnOtherThread(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - public static final boolean isAnimatorStarted(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorStarted(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() : false ; } - public static final boolean isAnimatorAnimatingOnOtherThread(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorAnimatingOnOtherThread(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - public static final boolean isAnimatorAnimating(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorAnimating(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() : false ; } @@ -79,7 +79,7 @@ public class GLDrawableUtil { * @param listener * @param preserveInitState */ - public static final void moveGLEventListener(GLAutoDrawable src, GLAutoDrawable dest, GLEventListener listener, boolean preserveInitState) { + public static final void moveGLEventListener(final GLAutoDrawable src, final GLAutoDrawable dest, final GLEventListener listener, final boolean preserveInitState) { final boolean initialized = src.getGLEventListenerInitState(listener); src.removeGLEventListener(listener); dest.addGLEventListener(listener); @@ -105,7 +105,7 @@ public class GLDrawableUtil { * @param listener * @param preserveInitState */ - public static final void moveAllGLEventListener(GLAutoDrawable src, GLAutoDrawable dest, boolean preserveInitState) { + public static final void moveAllGLEventListener(final GLAutoDrawable src, final GLAutoDrawable dest, final boolean preserveInitState) { for(int count = src.getGLEventListenerCount(); 0<count; count--) { final GLEventListener listener = src.getGLEventListener(0); moveGLEventListener(src, dest, listener, preserveInitState); @@ -127,7 +127,7 @@ public class GLDrawableUtil { * @param b * @throws GLException if the {@link AbstractGraphicsDevice} are incompatible w/ each other. */ - public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) { + public static final void swapGLContextAndAllGLEventListener(final GLAutoDrawable a, final GLAutoDrawable b) { final GLEventListenerState gllsA = GLEventListenerState.moveFrom(a); final GLEventListenerState gllsB = GLEventListenerState.moveFrom(b); @@ -149,7 +149,7 @@ public class GLDrawableUtil { * @param src * @param dest */ - public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) { + public static final void swapGLContext(final GLAutoDrawable src, final GLAutoDrawable dest) { final GLAnimatorControl aAnim = src.getAnimator(); final GLAnimatorControl bAnim = dest.getAnimator(); final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index 223c23ebb..ec2991448 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java @@ -103,7 +103,7 @@ public class GLPixelBuffer { * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. * See {@link #getAllowRowStride()} and {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ - public DefaultGLPixelBufferProvider(boolean allowRowStride) { + public DefaultGLPixelBufferProvider(final boolean allowRowStride) { this.allowRowStride = allowRowStride; } @@ -111,7 +111,7 @@ public class GLPixelBuffer { public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(GL gl, int componentCount) { + public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { final GLContext ctx = gl.getContext(); final int dFormat, dType; @@ -121,14 +121,14 @@ public class GLPixelBuffer { dFormat = GL2ES2.GL_RED; } else { // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - dFormat = GL2ES2.GL_ALPHA; + dFormat = GL.GL_ALPHA; } dType = GL.GL_UNSIGNED_BYTE; } else if( 3 == componentCount ) { dFormat = GL.GL_RGB; dType = GL.GL_UNSIGNED_BYTE; } else if( 4 == componentCount ) { - int _dFormat = ctx.getDefaultPixelDataFormat(); + final int _dFormat = ctx.getDefaultPixelDataFormat(); final int dComps = GLBuffers.componentCount(_dFormat); if( dComps == componentCount ) { dFormat = _dFormat; @@ -150,11 +150,11 @@ public class GLPixelBuffer { * </p> */ @Override - public GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public GLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { if( minByteSize > 0 ) { return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); } else { - int[] tmp = { 0 }; + final int[] tmp = { 0 }; final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack); return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride()); } @@ -194,7 +194,7 @@ public class GLPixelBuffer { * @param dataFormat GL data format * @param dataType GL data type */ - public GLPixelAttributes(int dataFormat, int dataType) { + public GLPixelAttributes(final int dataFormat, final int dataType) { this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType); } /** @@ -203,7 +203,7 @@ public class GLPixelBuffer { * @param dataFormat GL data format * @param dataType GL data type */ - public GLPixelAttributes(int componentCount, int dataFormat, int dataType) { + public GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType) { this(componentCount, dataFormat, dataType, true); } @@ -211,7 +211,7 @@ public class GLPixelBuffer { * Returns the matching {@link GLPixelAttributes} for the given {@link PixelFormat} and {@link GLProfile} if exists, * otherwise returns <code>null</code>. */ - public static final GLPixelAttributes convert(PixelFormat pixFmt, GLProfile glp) { + public static final GLPixelAttributes convert(final PixelFormat pixFmt, final GLProfile glp) { int df = 0; // format int dt = GL.GL_UNSIGNED_BYTE; // data type switch(pixFmt) { @@ -221,7 +221,7 @@ public class GLPixelBuffer { df = GL2ES2.GL_RED; } else { // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - df = GL2ES2.GL_LUMINANCE; + df = GL.GL_LUMINANCE; } break; case BGR888: @@ -256,7 +256,7 @@ public class GLPixelBuffer { } return null; } - private GLPixelAttributes(int componentCount, int dataFormat, int dataType, boolean checkArgs) { + private GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType, final boolean checkArgs) { this.componentCount = componentCount; this.format = dataFormat; this.type = dataType; @@ -290,7 +290,7 @@ public class GLPixelBuffer { case GL.GL_RGBA: pixFmt = PixelFormat.RGBA8888; break; - case GL2.GL_BGR: + case GL2GL3.GL_BGR: pixFmt = PixelFormat.BGR888; break; case GL.GL_BGRA: @@ -383,7 +383,7 @@ public class GLPixelBuffer { * @param buffer the backing array * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. */ - public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer, boolean allowRowStride) { + public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final Buffer buffer, final boolean allowRowStride) { this.pixelAttributes = pixelAttributes; this.width = width; this.height = height; @@ -414,7 +414,7 @@ public class GLPixelBuffer { } /** Sets the byte position of the {@link #buffer}. */ - public Buffer position(int bytePos) { + public Buffer position(final int bytePos) { return buffer.position( bytePos / bufferElemSize ); } @@ -465,7 +465,7 @@ public class GLPixelBuffer { * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. * @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) */ - public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int newByteSize) { + public boolean requiresNewBuffer(final GL gl, final int newWidth, final int newHeight, int newByteSize) { if( !isValid() ) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java index 34b493586..52612d224 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java @@ -171,7 +171,7 @@ public class GLPixelStorageModes { */ public final void resetPack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec - gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, 4); // es2, es3, gl3 + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, 0); // es3, gl3 @@ -202,7 +202,7 @@ public class GLPixelStorageModes { gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT); } else { // ES1 or ES2 deals with pack/unpack alignment only - gl.glGetIntegerv(GL2ES2.GL_PACK_ALIGNMENT, cachePack, 0); + gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, cachePack, 0); if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES3.GL_PACK_ROW_LENGTH, cachePack, 1); gl.glGetIntegerv(GL2ES3.GL_PACK_SKIP_ROWS, cachePack, 2); @@ -222,7 +222,7 @@ public class GLPixelStorageModes { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { - gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, cachePack[0]); + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, cachePack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, cachePack[1]); gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, cachePack[2]); @@ -242,7 +242,7 @@ public class GLPixelStorageModes { */ public final void resetUnpack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec - gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, 4); // es2, es3, gl3 + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); // es3, gl3 @@ -273,7 +273,7 @@ public class GLPixelStorageModes { gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT); } else { // ES1 or ES2 deals with pack/unpack alignment only - gl.glGetIntegerv(GL2ES2.GL_UNPACK_ALIGNMENT, cacheUnpack, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, cacheUnpack, 0); if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack, 1); gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack, 2); @@ -293,7 +293,7 @@ public class GLPixelStorageModes { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { - gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, cacheUnpack[0]); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, cacheUnpack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack[1]); gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack[2]); diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index 680984cdb..abdb7c5f9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -62,11 +62,11 @@ public class GLReadBufferUtil { * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms! * @param write2Texture true if readPixel's TextureData shall be written to a 2d Texture */ - public GLReadBufferUtil(boolean alpha, boolean write2Texture) { + public GLReadBufferUtil(final boolean alpha, final boolean write2Texture) { this(GLPixelBuffer.defaultProviderNoRowStride, alpha, write2Texture); } - public GLReadBufferUtil(GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) { + public GLReadBufferUtil(final GLPixelBufferProvider pixelBufferProvider, final boolean alpha, final boolean write2Texture) { this.pixelBufferProvider = pixelBufferProvider; this.componentCount = alpha ? 4 : 3 ; this.alignment = alpha ? 4 : 1 ; @@ -110,11 +110,11 @@ public class GLReadBufferUtil { /** * Write the TextureData filled by {@link #readPixels(GLAutoDrawable, boolean)} to file */ - public void write(File dest) { + public void write(final File dest) { try { TextureIO.write(readTextureData, dest); rewindPixelBuffer(); - } catch (IOException ex) { + } catch (final IOException ex) { throw new RuntimeException("can not write to file: " + dest.getAbsolutePath(), ex); } } @@ -131,7 +131,7 @@ public class GLReadBufferUtil { * * @see #GLReadBufferUtil(boolean, boolean) */ - public boolean readPixels(GL gl, boolean mustFlipVertically) { + public boolean readPixels(final GL gl, final boolean mustFlipVertically) { return readPixels(gl, 0, 0, 0, 0, mustFlipVertically); } @@ -150,7 +150,7 @@ public class GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #GLReadBufferUtil(boolean, boolean) */ - public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically) { + public boolean readPixels(final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean mustFlipVertically) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { @@ -207,7 +207,7 @@ public class GLReadBufferUtil { readPixelBuffer.buffer, null /* Flusher */); newData = true; - } catch (Exception e) { + } catch (final Exception e) { readTextureData = null; readPixelBuffer = null; throw new RuntimeException("can not fetch offscreen texture", e); @@ -229,7 +229,7 @@ public class GLReadBufferUtil { readPixelBuffer.clear(); try { gl.glReadPixels(inX, inY, width, height, pixelAttribs.format, pixelAttribs.type, readPixelBuffer.buffer); - } catch(GLException gle) { res = false; gle.printStackTrace(); } + } catch(final GLException gle) { res = false; gle.printStackTrace(); } readPixelBuffer.position( readPixelSize ); readPixelBuffer.flip(); final int glerr1 = gl.glGetError(); @@ -256,7 +256,7 @@ public class GLReadBufferUtil { return res; } - public void dispose(GL gl) { + public void dispose(final GL gl) { if(null != readTexture) { readTexture.destroy(gl); readTextureData = null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java index 966781906..4e44c997a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java @@ -87,7 +87,7 @@ public class Gamma { * @throws IllegalArgumentException if any of the parameters were * out-of-bounds */ - public static boolean setDisplayGamma(GL gl, float gamma, float brightness, float contrast) throws IllegalArgumentException { + public static boolean setDisplayGamma(final GL gl, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { return GLDrawableFactoryImpl.getFactoryImpl(gl.getContext().getGLDrawable().getGLProfile()).setDisplayGamma(gamma, brightness, contrast); } @@ -101,7 +101,7 @@ public class Gamma { * exiting, calling it is recommended because of the inevitable * unspecified behavior during JVM teardown. */ - public static void resetDisplayGamma(GL gl) { + public static void resetDisplayGamma(final GL gl) { GLDrawableFactoryImpl.getFactoryImpl(gl.getContext().getGLDrawable().getGLProfile()).resetDisplayGamma(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 986f6d8d3..150e92c2e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -18,6 +18,7 @@ import jogamp.opengl.Debug; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.glsl.ShaderState; /** @@ -54,9 +55,9 @@ public class ImmModeSink { static { Debug.initSingleton(); - DEBUG_BEGIN_END = Debug.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true); - DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); - DEBUG_BUFFER = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true); + DEBUG_BEGIN_END = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true); + DEBUG_DRAW = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); + DEBUG_BUFFER = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true); } public static final int GL_QUADS = 0x0007; // Needs data manipulation on ES1/ES2 @@ -81,12 +82,12 @@ public class ImmModeSink { * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, * set to <code>0</code> for no VBO usage */ - public static ImmModeSink createFixed(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage) { + public static ImmModeSink createFixed(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, false, glBufferUsage, null, 0); @@ -114,12 +115,12 @@ public class ImmModeSink { * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage, ShaderState st) { + public static ImmModeSink createGLSL(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage, final ShaderState st) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, st, 0); @@ -147,18 +148,18 @@ public class ImmModeSink { * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage, int shaderProgram) { + public static ImmModeSink createGLSL(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage, final int shaderProgram) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, null, shaderProgram); } - public void destroy(GL gl) { + public void destroy(final GL gl) { destroyList(gl); vboSet.destroy(gl); @@ -168,16 +169,16 @@ public class ImmModeSink { reset(null); } - public void reset(GL gl) { + public void reset(final GL gl) { destroyList(gl); vboSet.reset(gl); } @Override public String toString() { - StringBuilder sb = new StringBuilder("ImmModeSink["); + final StringBuilder sb = new StringBuilder("ImmModeSink["); sb.append(",\n\tVBO list: "+vboSetList.size()+" ["); - for(Iterator<VBOSet> i=vboSetList.iterator(); i.hasNext() ; ) { + for(final Iterator<VBOSet> i=vboSetList.iterator(); i.hasNext() ; ) { sb.append("\n\t"); sb.append( i.next() ); } @@ -191,7 +192,7 @@ public class ImmModeSink { return sb.toString(); } - public void draw(GL gl, boolean disableBufferAfterDraw) { + public void draw(final GL gl, final boolean disableBufferAfterDraw) { if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw(disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this); } @@ -201,7 +202,7 @@ public class ImmModeSink { } } - public void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw) { + public void draw(final GL gl, final Buffer indices, final boolean disableBufferAfterDraw) { if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw(disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this); } @@ -228,19 +229,19 @@ public class ImmModeSink { vboSet.checkSeal(false); } - public final void glEnd(GL gl) { + public final void glEnd(final GL gl) { glEnd(gl, null, true); } - public void glEnd(GL gl, boolean immediateDraw) { + public void glEnd(final GL gl, final boolean immediateDraw) { glEnd(gl, null, immediateDraw); } - public final void glEnd(GL gl, Buffer indices) { + public final void glEnd(final GL gl, final Buffer indices) { glEnd(gl, indices, true); } - private void glEnd(GL gl, Buffer indices, boolean immediateDraw) { + private void glEnd(final GL gl, final Buffer indices, final boolean immediateDraw) { if(DEBUG_BEGIN_END) { System.err.println("ImmModeSink START glEnd(immediate: "+immediateDraw+")"); } @@ -259,117 +260,117 @@ public class ImmModeSink { } } - public void glVertexv(Buffer v) { + public void glVertexv(final Buffer v) { vboSet.glVertexv(v); } - public void glNormalv(Buffer v) { + public void glNormalv(final Buffer v) { vboSet.glNormalv(v); } - public void glColorv(Buffer v) { + public void glColorv(final Buffer v) { vboSet.glColorv(v); } - public void glTexCoordv(Buffer v) { + public void glTexCoordv(final Buffer v) { vboSet.glTexCoordv(v); } - public final void glVertex2f(float x, float y) { + public final void glVertex2f(final float x, final float y) { vboSet.glVertex2f(x,y); } - public final void glVertex3f(float x, float y, float z) { + public final void glVertex3f(final float x, final float y, final float z) { vboSet.glVertex3f(x,y,z); } - public final void glNormal3f(float x, float y, float z) { + public final void glNormal3f(final float x, final float y, final float z) { vboSet.glNormal3f(x,y,z); } - public final void glColor3f(float x, float y, float z) { + public final void glColor3f(final float x, final float y, final float z) { vboSet.glColor3f(x,y,z); } - public final void glColor4f(float x, float y, float z, float a) { + public final void glColor4f(final float x, final float y, final float z, final float a) { vboSet.glColor4f(x,y,z, a); } - public final void glTexCoord2f(float x, float y) { + public final void glTexCoord2f(final float x, final float y) { vboSet.glTexCoord2f(x,y); } - public final void glTexCoord3f(float x, float y, float z) { + public final void glTexCoord3f(final float x, final float y, final float z) { vboSet.glTexCoord3f(x,y,z); } - public final void glVertex2s(short x, short y) { + public final void glVertex2s(final short x, final short y) { vboSet.glVertex2s(x,y); } - public final void glVertex3s(short x, short y, short z) { + public final void glVertex3s(final short x, final short y, final short z) { vboSet.glVertex3s(x,y,z); } - public final void glNormal3s(short x, short y, short z) { + public final void glNormal3s(final short x, final short y, final short z) { vboSet.glNormal3s(x,y,z); } - public final void glColor3s(short x, short y, short z) { + public final void glColor3s(final short x, final short y, final short z) { vboSet.glColor3s(x,y,z); } - public final void glColor4s(short x, short y, short z, short a) { + public final void glColor4s(final short x, final short y, final short z, final short a) { vboSet.glColor4s(x,y,z,a); } - public final void glTexCoord2s(short x, short y) { + public final void glTexCoord2s(final short x, final short y) { vboSet.glTexCoord2s(x,y); } - public final void glTexCoord3s(short x, short y, short z) { + public final void glTexCoord3s(final short x, final short y, final short z) { vboSet.glTexCoord3s(x,y,z); } - public final void glVertex2b(byte x, byte y) { + public final void glVertex2b(final byte x, final byte y) { vboSet.glVertex2b(x,y); } - public final void glVertex3b(byte x, byte y, byte z) { + public final void glVertex3b(final byte x, final byte y, final byte z) { vboSet.glVertex3b(x,y,z); } - public final void glNormal3b(byte x, byte y, byte z) { + public final void glNormal3b(final byte x, final byte y, final byte z) { vboSet.glNormal3b(x,y,z); } - public final void glColor3b(byte x, byte y, byte z) { + public final void glColor3b(final byte x, final byte y, final byte z) { vboSet.glColor3b(x,y,z); } - public final void glColor3ub(byte x, byte y, byte z) { + public final void glColor3ub(final byte x, final byte y, final byte z) { vboSet.glColor3ub(x,y,z); } - public final void glColor4b(byte x, byte y, byte z, byte a) { + public final void glColor4b(final byte x, final byte y, final byte z, final byte a) { vboSet.glColor4b(x,y,z,a); } - public final void glColor4ub(byte x, byte y, byte z, byte a) { + public final void glColor4ub(final byte x, final byte y, final byte z, final byte a) { vboSet.glColor4ub(x,y,z,a); } - public final void glTexCoord2b(byte x, byte y) { + public final void glTexCoord2b(final byte x, final byte y) { vboSet.glTexCoord2b(x,y); } - public final void glTexCoord3b(byte x, byte y, byte z) { + public final void glTexCoord3b(final byte x, final byte y, final byte z) { vboSet.glTexCoord3b(x,y,z); } - protected ImmModeSink(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { + protected ImmModeSink(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final boolean useGLSL, final int glBufferUsage, final ShaderState st, final int shaderProgram) { vboSet = new VBOSet(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, st, shaderProgram); @@ -390,9 +391,9 @@ public class ImmModeSink { * @see #createFixed(int, int, int, int, int, int, int, int, int, int) * @see #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) */ - public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); } + public void setResizeElementCount(final int v) { vboSet.setResizeElementCount(v); } - private void destroyList(GL gl) { + private void destroyList(final GL gl) { for(int i=0; i<vboSetList.size(); i++) { vboSetList.get(i).destroy(gl); } @@ -403,12 +404,12 @@ public class ImmModeSink { private final ArrayList<VBOSet> vboSetList; protected static class VBOSet { - protected VBOSet (int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { + protected VBOSet (final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final boolean useGLSL, final int glBufferUsage, final ShaderState st, final int shaderProgram) { // final .. this.glBufferUsage=glBufferUsage; this.initialElementCount=initialElementCount; @@ -465,17 +466,17 @@ public class ImmModeSink { } protected int getResizeElementCount() { return resizeElementCount; } - protected void setResizeElementCount(int v) { resizeElementCount=v; } + protected void setResizeElementCount(final int v) { resizeElementCount=v; } protected boolean getUseVBO() { return useVBO; } - protected final VBOSet regenerate(GL gl) { + protected final VBOSet regenerate(final GL gl) { return new VBOSet(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, shaderState, shaderProgram); } - protected void checkSeal(boolean test) throws GLException { + protected void checkSeal(final boolean test) throws GLException { if(0==mode) { throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this); } @@ -490,7 +491,7 @@ public class ImmModeSink { private boolean usingShaderProgram = false; - protected void useShaderProgram(GL2ES2 gl, boolean force) { + protected void useShaderProgram(final GL2ES2 gl, final boolean force) { if( force || !usingShaderProgram ) { if(null != shaderState) { shaderState.useProgram(gl, true); @@ -501,7 +502,7 @@ public class ImmModeSink { } } - protected void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw, int i) + protected void draw(final GL gl, final Buffer indices, final boolean disableBufferAfterDraw, final int i) { enableBuffer(gl, true); @@ -544,17 +545,17 @@ public class ImmModeSink { if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x000000ff & b.get(idx0+j), 4); } } else if( GL.GL_UNSIGNED_SHORT == type ){ final ShortBuffer b = (ShortBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x0000ffff & b.get(idx0+j), 4); } } else { final IntBuffer b = (IntBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0xffffffff & b.get(idx0+j), 4); } } } else { @@ -573,24 +574,24 @@ public class ImmModeSink { } } - public void glVertexv(Buffer v) { + public void glVertexv(final Buffer v) { checkSeal(false); Buffers.put(vertexArray, v); } - public void glNormalv(Buffer v) { + public void glNormalv(final Buffer v) { checkSeal(false); Buffers.put(normalArray, v); } - public void glColorv(Buffer v) { + public void glColorv(final Buffer v) { checkSeal(false); Buffers.put(colorArray, v); } - public void glTexCoordv(Buffer v) { + public void glTexCoordv(final Buffer v) { checkSeal(false); Buffers.put(textCoordArray, v); } - public void glVertex2b(byte x, byte y) { + public void glVertex2b(final byte x, final byte y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -599,7 +600,7 @@ public class ImmModeSink { Buffers.putNb(vertexArray, vDataTypeSigned, y, true); countAndPadding(VERTEX, vComps-2); } - public void glVertex3b(byte x, byte y, byte z) { + public void glVertex3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -610,7 +611,7 @@ public class ImmModeSink { Buffers.putNb(vertexArray, vDataTypeSigned, z, true); countAndPadding(VERTEX, vComps-3); } - public void glVertex2s(short x, short y) { + public void glVertex2s(final short x, final short y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -619,7 +620,7 @@ public class ImmModeSink { Buffers.putNs(vertexArray, vDataTypeSigned, y, true); countAndPadding(VERTEX, vComps-2); } - public void glVertex3s(short x, short y, short z) { + public void glVertex3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -630,7 +631,7 @@ public class ImmModeSink { Buffers.putNs(vertexArray, vDataTypeSigned, z, true); countAndPadding(VERTEX, vComps-3); } - public void glVertex2f(float x, float y) { + public void glVertex2f(final float x, final float y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -639,7 +640,7 @@ public class ImmModeSink { Buffers.putNf(vertexArray, vDataTypeSigned, y); countAndPadding(VERTEX, vComps-2); } - public void glVertex3f(float x, float y, float z) { + public void glVertex3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -651,7 +652,7 @@ public class ImmModeSink { countAndPadding(VERTEX, vComps-3); } - public void glNormal3b(byte x, byte y, byte z) { + public void glNormal3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -662,7 +663,7 @@ public class ImmModeSink { Buffers.putNb(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } - public void glNormal3s(short x, short y, short z) { + public void glNormal3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -673,7 +674,7 @@ public class ImmModeSink { Buffers.putNs(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } - public void glNormal3f(float x, float y, float z) { + public void glNormal3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -685,7 +686,7 @@ public class ImmModeSink { countAndPadding(NORMAL, nComps-3); } - public void glColor3b(byte r, byte g, byte b) { + public void glColor3b(final byte r, final byte g, final byte b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -696,7 +697,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } - public void glColor3ub(byte r, byte g, byte b) { + public void glColor3ub(final byte r, final byte g, final byte b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -707,7 +708,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, b, false); countAndPadding(COLOR, cComps-3); } - public void glColor4b(byte r, byte g, byte b, byte a) { + public void glColor4b(final byte r, final byte g, final byte b, final byte a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -720,7 +721,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } - public void glColor4ub(byte r, byte g, byte b, byte a) { + public void glColor4ub(final byte r, final byte g, final byte b, final byte a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -733,7 +734,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, a, false); countAndPadding(COLOR, cComps-4); } - public void glColor3s(short r, short g, short b) { + public void glColor3s(final short r, final short g, final short b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -744,7 +745,7 @@ public class ImmModeSink { Buffers.putNs(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } - public void glColor4s(short r, short g, short b, short a) { + public void glColor4s(final short r, final short g, final short b, final short a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -757,7 +758,7 @@ public class ImmModeSink { Buffers.putNs(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } - public void glColor3f(float r, float g, float b) { + public void glColor3f(final float r, final float g, final float b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -768,7 +769,7 @@ public class ImmModeSink { Buffers.putNf(colorArray, cDataTypeSigned, b); countAndPadding(COLOR, cComps-3); } - public void glColor4f(float r, float g, float b, float a) { + public void glColor4f(final float r, final float g, final float b, final float a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -782,7 +783,7 @@ public class ImmModeSink { countAndPadding(COLOR, cComps-4); } - public void glTexCoord2b(byte x, byte y) { + public void glTexCoord2b(final byte x, final byte y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -791,7 +792,7 @@ public class ImmModeSink { Buffers.putNb(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3b(byte x, byte y, byte z) { + public void glTexCoord3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -802,7 +803,7 @@ public class ImmModeSink { Buffers.putNb(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } - public void glTexCoord2s(short x, short y) { + public void glTexCoord2s(final short x, final short y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -811,7 +812,7 @@ public class ImmModeSink { Buffers.putNs(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3s(short x, short y, short z) { + public void glTexCoord3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -822,7 +823,7 @@ public class ImmModeSink { Buffers.putNs(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } - public void glTexCoord2f(float x, float y) { + public void glTexCoord2f(final float x, final float y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -831,7 +832,7 @@ public class ImmModeSink { Buffers.putNf(textCoordArray, tDataTypeSigned, y); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3f(float x, float y, float z) { + public void glTexCoord3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -858,7 +859,7 @@ public class ImmModeSink { } } - public void setShaderProgram(int program) { + public void setShaderProgram(final int program) { if(null == shaderState && 0 == program) { throw new IllegalArgumentException("Not allowed to zero shader program if no ShaderState is set"); } @@ -871,7 +872,7 @@ public class ImmModeSink { * @return true if all locations for all used arrays are found (min 1 array), otherwise false. * Also sets 'glslLocationSet' to the return value! */ - private boolean resetGLSLArrayLocation(GL2ES2 gl) { + private boolean resetGLSLArrayLocation(final GL2ES2 gl) { int iA = 0; int iL = 0; @@ -903,7 +904,7 @@ public class ImmModeSink { return glslLocationSet; } - public void destroy(GL gl) { + public void destroy(final GL gl) { reset(gl); vCount=0; cCount=0; nCount=0; tCount=0; @@ -912,7 +913,7 @@ public class ImmModeSink { buffer=null; } - public void reset(GL gl) { + public void reset(final GL gl) { enableBuffer(gl, false); reset(); } @@ -935,16 +936,16 @@ public class ImmModeSink { this.tElems=0; } - public void seal(GL glObj, boolean seal) + public void seal(final GL glObj, final boolean seal) { seal(seal); if(sealedGL==seal) return; sealedGL = seal; - GL gl = glObj.getGL(); + final GL gl = glObj.getGL(); if(seal) { if(useVBO) { if(0 == vboName) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; } @@ -967,7 +968,7 @@ public class ImmModeSink { } } - public void seal(boolean seal) + public void seal(final boolean seal) { if(sealed==seal) return; sealed = seal; @@ -977,7 +978,7 @@ public class ImmModeSink { } } - public void enableBuffer(GL gl, boolean enable) { + public void enableBuffer(final GL gl, final boolean enable) { if( bufferEnabled != enable && vElems>0 ) { if(enable) { checkSeal(true); @@ -996,7 +997,7 @@ public class ImmModeSink { } } - private final void writeBuffer(GL gl) { + private final void writeBuffer(final GL gl) { final int vBytes = vElems * vCompsBytes; final int cBytes = cElems * cCompsBytes; final int nBytes = nElems * nCompsBytes; @@ -1021,8 +1022,8 @@ public class ImmModeSink { } } - private void enableBufferFixed(GL gl, boolean enable) { - GL2ES1 glf = gl.getGL2ES1(); + private void enableBufferFixed(final GL gl, final boolean enable) { + final GL2ES1 glf = gl.getGL2ES1(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1089,8 +1090,8 @@ public class ImmModeSink { } } - private void enableBufferGLSLShaderState(GL gl, boolean enable) { - GL2ES2 glsl = gl.getGL2ES2(); + private void enableBufferGLSLShaderState(final GL gl, final boolean enable) { + final GL2ES2 glsl = gl.getGL2ES2(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1157,8 +1158,8 @@ public class ImmModeSink { } } - private void enableBufferGLSLSimple(GL gl, boolean enable) { - GL2ES2 glsl = gl.getGL2ES2(); + private void enableBufferGLSLSimple(final GL gl, final boolean enable) { + final GL2ES2 glsl = gl.getGL2ES2(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1267,7 +1268,7 @@ public class ImmModeSink { return "[v "+vElems+"/"+vCount+", c "+cElems+"/"+cCount+", n "+nElems+"/"+nCount+", t "+tElems+"/"+tCount+"]"; } - protected boolean fitElementInBuffer(int type) { + protected boolean fitElementInBuffer(final int type) { final int addElems = 1; switch (type) { case VERTEX: @@ -1283,7 +1284,7 @@ public class ImmModeSink { } } - protected boolean reallocateBuffer(int addElems) { + protected boolean reallocateBuffer(final int addElems) { final int vAdd = addElems - ( vCount - vElems ); final int cAdd = addElems - ( cCount - cElems ); final int nAdd = addElems - ( nCount - nElems ); @@ -1381,7 +1382,7 @@ public class ImmModeSink { } /** grow buffer by initialElementCount if there is no space for one more element in the designated buffer */ - protected final boolean growBuffer(int type) { + protected final boolean growBuffer(final int type) { if( null !=buffer && !sealed ) { if( !fitElementInBuffer(type) ) { // save olde values .. @@ -1422,7 +1423,7 @@ public class ImmModeSink { * @param type * @param fill */ - private void countAndPadding(int type, int fill) { + private void countAndPadding(final int type, int fill) { if ( sealed ) return; final Buffer dest; diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 71d880a44..39608b116 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -41,8 +41,9 @@ import javax.media.opengl.GL; import javax.media.opengl.GLException; import javax.media.opengl.fixedfunc.GLMatrixFunc; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.nio.Buffers; -import com.jogamp.common.os.Platform; import com.jogamp.common.util.FloatStack; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.Quaternion; @@ -852,19 +853,19 @@ public final class PMVMatrix implements GLMatrixFunc { final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits ); sb.append("PMVMatrix[modified[P ").append(modP).append(", Mv ").append(modMv).append(", T ").append(modT); - sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq).append("]").append(Platform.NEWLINE); - sb.append(", Projection").append(Platform.NEWLINE); + sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq).append("]").append(PlatformPropsImpl.NEWLINE); + sb.append(", Projection").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixP); - sb.append(", Modelview").append(Platform.NEWLINE); + sb.append(", Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMv); - sb.append(", Texture").append(Platform.NEWLINE); + sb.append(", Texture").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixTex); if( 0 != ( requestMask & DIRTY_INVERSE_MODELVIEW ) ) { - sb.append(", Inverse Modelview").append(Platform.NEWLINE); + sb.append(", Inverse Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMvi); } if( 0 != ( requestMask & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) { - sb.append(", Inverse Transposed Modelview").append(Platform.NEWLINE); + sb.append(", Inverse Transposed Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMvit); } sb.append("]"); diff --git a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java index fd8f54152..64da547c2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java @@ -192,7 +192,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { return new PNGPixelRect(destFmt, new Dimension(width, height), destStrideInBytes, destIsGLOriented, destPixels, dpiX, dpiY); } - private static final int getPixelLUMToAny(PixelFormat dest_fmt, ByteBuffer d, int dOff, byte lum, byte alpha) { + private static final int getPixelLUMToAny(final PixelFormat dest_fmt, final ByteBuffer d, int dOff, final byte lum, final byte alpha) { switch(dest_fmt) { case LUMINANCE: d.put(dOff++, lum); diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index 0a3a9d513..3b65b0824 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java @@ -51,7 +51,7 @@ public class RandomTileRenderer extends TileRendererBase { } @Override - public final int getParam(int pname) { + public final int getParam(final int pname) { switch (pname) { case TR_IMAGE_WIDTH: return imageSize.getWidth(); @@ -75,7 +75,7 @@ public class RandomTileRenderer extends TileRendererBase { * * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0 */ - public void setTileRect(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException, IllegalArgumentException { + public void setTileRect(final int tX, final int tY, final int tWidth, final int tHeight) throws IllegalStateException, IllegalArgumentException { if( 0 > tX || 0 > tY ) { throw new IllegalArgumentException("Tile pos must be >= 0/0"); } @@ -120,7 +120,7 @@ public class RandomTileRenderer extends TileRendererBase { * {@link #setTileRect(int, int, int, int) tile-rect} has not been set. */ @Override - public final void beginTile(GL gl) throws IllegalStateException, GLException { + public final void beginTile(final GL gl) throws IllegalStateException, GLException { if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) { throw new IllegalStateException("Image size has not been set"); } @@ -143,7 +143,7 @@ public class RandomTileRenderer extends TileRendererBase { } @Override - public void endTile( GL gl ) throws IllegalStateException, GLException { + public void endTile( final GL gl ) throws IllegalStateException, GLException { if( !beginCalled ) { throw new IllegalStateException("beginTile(..) has not been called"); } @@ -229,7 +229,7 @@ public class RandomTileRenderer extends TileRendererBase { * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ - public void display(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException { + public void display(final int tX, final int tY, final int tWidth, final int tHeight) throws IllegalStateException { setTileRect(tX, tY, tWidth, tHeight); display(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java index 47d56bcb1..6e31c78a0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java @@ -70,18 +70,18 @@ public class TGAWriter { * @throws IOException if an I/O error occurred while writing the * file */ - public void open(File file, - int width, - int height, - boolean alpha) throws IOException { - RandomAccessFile out = new RandomAccessFile(file, "rw"); + public void open(final File file, + final int width, + final int height, + final boolean alpha) throws IOException { + final RandomAccessFile out = new RandomAccessFile(file, "rw"); ch = out.getChannel(); - int pixelSize = (alpha ? 32 : 24); - int numChannels = (alpha ? 4 : 3); + final int pixelSize = (alpha ? 32 : 24); + final int numChannels = (alpha ? 4 : 3); - int fileLength = TARGA_HEADER_SIZE + width * height * numChannels; + final int fileLength = TARGA_HEADER_SIZE + width * height * numChannels; out.setLength(fileLength); - MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength); + final MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength); // write the TARGA header image.put(0, (byte) 0).put(1, (byte) 0); diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 887312a64..d8410a102 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -145,7 +145,7 @@ public class TileRenderer extends TileRendererBase { private int offsetY; @Override - protected StringBuilder tileDetails(StringBuilder sb) { + protected StringBuilder tileDetails(final 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); @@ -165,7 +165,7 @@ public class TileRenderer extends TileRendererBase { * </p> */ @Override - public final void setImageSize(int width, int height) { + public final void setImageSize(final int width, final int height) { super.setImageSize(width, height); reset(); } @@ -184,7 +184,7 @@ public class TileRenderer extends TileRendererBase { * @param height The image-clipping.height * @see #getClippedImageSize() */ - public final void clipImageSize(int width, int height) { + public final void clipImageSize(final int width, final int height) { if( null == imageClippingDim ) { imageClippingDim = new Dimension(width, height); } else { @@ -236,7 +236,7 @@ public class TileRenderer extends TileRendererBase { * to avoid artifacts when rendering lines or points with * thickness > 1. */ - public final void setTileSize(int width, int height, int border) { + public final void setTileSize(final int width, final int height, final int border) { if( 0 > border ) { throw new IllegalArgumentException("Tile border must be >= 0"); } @@ -255,7 +255,7 @@ public class TileRenderer extends TileRendererBase { * @see #TR_TILE_X_OFFSET * @see #TR_TILE_Y_OFFSET **/ - public void setTileOffset(int xoff, int yoff) { + public void setTileOffset(final int xoff, final int yoff) { offsetX = xoff; offsetY = yoff; } @@ -299,7 +299,7 @@ public class TileRenderer extends TileRendererBase { /* pp */ final int getCurrentTile() { return currentTile; } @Override - public final int getParam(int pname) { + public final int getParam(final int pname) { switch (pname) { case TR_IMAGE_WIDTH: return imageSize.getWidth(); @@ -349,7 +349,7 @@ public class TileRenderer extends TileRendererBase { * * @param order The row traversal order, must be either {@link #TR_TOP_TO_BOTTOM} or {@link #TR_BOTTOM_TO_TOP}. */ - public final void setRowOrder(int order) { + public final void setRowOrder(final int order) { if (order == TR_TOP_TO_BOTTOM || order == TR_BOTTOM_TO_TOP) { rowOrder = order; } else { @@ -388,7 +388,7 @@ public class TileRenderer extends TileRendererBase { * {@link #eot() end-of-tiling} has been reached. */ @Override - public final void beginTile( GL gl ) throws IllegalStateException, GLException { + public final void beginTile( final GL gl ) throws IllegalStateException, GLException { if( !isSetup() ) { throw new IllegalStateException("Image size has not been set: "+this); } @@ -408,7 +408,7 @@ public class TileRenderer extends TileRendererBase { assert ( currentRow < rows ); assert ( currentColumn < columns ); - int border = tileBorder; + final int border = tileBorder; final DimensionImmutable clippedImageSize = getClippedImageSize(); int tH, tW; @@ -446,7 +446,7 @@ public class TileRenderer extends TileRendererBase { } @Override - public void endTile( GL gl ) throws IllegalStateException, GLException { + public void endTile( final GL gl ) throws IllegalStateException, GLException { if( !beginCalled ) { throw new IllegalStateException("beginTile(..) has not been called"); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java index b29846d91..99def6f5c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java @@ -60,7 +60,7 @@ public class TimeFrameI { pts = INVALID_PTS; duration = 0; } - public TimeFrameI(int pts, int duration) { + public TimeFrameI(final int pts, final int duration) { this.pts = pts; this.duration = duration; } @@ -68,11 +68,11 @@ public class TimeFrameI { /** Get this frame's presentation timestamp (PTS) in milliseconds. */ public final int getPTS() { return pts; } /** Set this frame's presentation timestamp (PTS) in milliseconds. */ - public final void setPTS(int pts) { this.pts = pts; } + public final void setPTS(final int pts) { this.pts = pts; } /** Get this frame's duration in milliseconds. */ public final int getDuration() { return duration; } /** Set this frame's duration in milliseconds. */ - public final void setDuration(int duration) { this.duration = duration; } + public final void setDuration(final int duration) { this.duration = duration; } @Override public String toString() { diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java index 1d835dd33..6d875fcf5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java @@ -61,7 +61,7 @@ public interface AudioSink { * @param planar true for planar data package (each channel in own data buffer), false for packed data channels interleaved in one buffer. * @param littleEndian true for little-endian, false for big endian */ - public AudioFormat(int sampleRate, int sampleSize, int channelCount, boolean signed, boolean fixedP, boolean planar, boolean littleEndian) { + public AudioFormat(final int sampleRate, final int sampleSize, final int channelCount, final boolean signed, final boolean fixedP, final boolean planar, final boolean littleEndian) { this.sampleRate = sampleRate; this.sampleSize = sampleSize; this.channelCount = channelCount; @@ -104,7 +104,7 @@ public interface AudioSink { * Time -> Byte Count * </p> */ - public final int getDurationsByteSize(int millisecs) { + public final int getDurationsByteSize(final int millisecs) { final int bytesPerSample = sampleSize >>> 3; // /8 return millisecs * ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } @@ -116,7 +116,7 @@ public interface AudioSink { * Byte Count -> Time * </p> */ - public final int getBytesDuration(int byteCount) { + public final int getBytesDuration(final int byteCount) { final int bytesPerSample = sampleSize >>> 3; // /8 return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } @@ -132,7 +132,7 @@ public interface AudioSink { * </p> * @param sampleCount sample count per frame and channel */ - public final float getSamplesDuration(int sampleCount) { + public final float getSamplesDuration(final int sampleCount) { return ( 1000f * sampleCount ) / sampleRate; } @@ -151,7 +151,7 @@ public interface AudioSink { * @param millisecs time in milliseconds * @param frameDuration duration per frame in milliseconds. */ - public final int getFrameCount(int millisecs, float frameDuration) { + public final int getFrameCount(final int millisecs, final float frameDuration) { return Math.max(1, (int) ( millisecs / frameDuration + 0.5f )); } @@ -170,7 +170,7 @@ public interface AudioSink { * </p> * @param sampleCount sample count */ - public final int getSamplesByteCount(int sampleCount) { + public final int getSamplesByteCount(final int sampleCount) { return sampleCount * ( sampleSize >>> 3 ); } @@ -189,7 +189,7 @@ public interface AudioSink { * </p> * @param byteCount number of bytes */ - public final int getBytesSampleCount(int byteCount) { + public final int getBytesSampleCount(final int byteCount) { return ( byteCount << 3 ) / sampleSize; } @@ -208,7 +208,7 @@ public interface AudioSink { public AudioFrame() { this.byteSize = 0; } - public AudioFrame(int pts, int duration, int byteCount) { + public AudioFrame(final int pts, final int duration, final int byteCount) { super(pts, duration); this.byteSize=byteCount; } @@ -216,7 +216,7 @@ public interface AudioSink { /** Get this frame's size in bytes. */ public final int getByteSize() { return byteSize; } /** Set this frame's size in bytes. */ - public final void setByteSize(int size) { this.byteSize=size; } + public final void setByteSize(final int size) { this.byteSize=size; } @Override public String toString() { @@ -226,7 +226,7 @@ public interface AudioSink { public static class AudioDataFrame extends AudioFrame { protected final ByteBuffer data; - public AudioDataFrame(int pts, int duration, ByteBuffer bytes, int byteCount) { + public AudioDataFrame(final int pts, final int duration, final ByteBuffer bytes, final int byteCount) { super(pts, duration, byteCount); if( byteCount > bytes.remaining() ) { throw new IllegalArgumentException("Give size "+byteCount+" exceeds remaining bytes in ls "+bytes+". "+this); diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java index 386b1e085..a2b29b4eb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java @@ -50,7 +50,7 @@ public class AudioSinkFactory { return new NullAudioSink(); } - public static AudioSink create(final ClassLoader cl, String implName) { + public static AudioSink create(final ClassLoader cl, final String implName) { final AudioSink audioSink; if(ReflectionUtil.isClassAvailable(implName, cl)){ try { @@ -58,7 +58,7 @@ public class AudioSinkFactory { if( audioSink.isInitialized() ) { return audioSink; } - } catch (Throwable t) { + } catch (final Throwable t) { if(AudioSink.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 215275951..4fffd9fab 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -246,10 +246,10 @@ public interface GLMediaPlayer extends TextureSequence { */ @SuppressWarnings("serial") public static class StreamException extends Exception { - public StreamException(Throwable cause) { + public StreamException(final Throwable cause) { super(cause); } - public StreamException(String message, Throwable cause) { + public StreamException(final String message, final Throwable cause) { super(message, cause); } } @@ -318,7 +318,7 @@ public interface GLMediaPlayer extends TextureSequence { public final int id; - State(int id){ + State(final int id){ this.id = id; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java index 558d59630..9378cec91 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java @@ -55,12 +55,12 @@ public class GLMediaPlayerFactory { return new NullGLMediaPlayer(); } - public static GLMediaPlayer create(final ClassLoader cl, String implName) { + public static GLMediaPlayer create(final ClassLoader cl, final String implName) { try { if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) { return (GLMediaPlayer) ReflectionUtil.createInstance(implName, cl); } - } catch (Throwable t) { if(GLMediaPlayer.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } + } catch (final Throwable t) { if(GLMediaPlayer.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } return null; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java index a33356067..04bc0a15d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java @@ -31,6 +31,7 @@ import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; +import java.awt.image.Raster; import java.awt.image.SinglePixelPackedSampleModel; import java.awt.image.WritableRaster; import java.nio.Buffer; @@ -78,8 +79,8 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. * If <code>true</code>, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, - Buffer buffer, boolean allowRowStride) { + public AWTGLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final BufferedImage image, + final Buffer buffer, final boolean allowRowStride) { super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride); this.image = image; } @@ -97,7 +98,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @return * @throws IllegalArgumentException if requested size exceeds image size */ - public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException { + public BufferedImage getAlignedImage(final int width, final int height) throws IllegalArgumentException { if( width * height > image.getWidth() * image.getHeight() ) { throw new IllegalArgumentException("Requested size exceeds image size: "+width+"x"+height+" > "+image.getWidth()+"x"+image.getHeight()); } @@ -110,12 +111,12 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster0.getSampleModel(); final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), width, height, width /* scanLineStride */, sppsm0.getBitMasks()); - final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null); + final WritableRaster raster1 = Raster.createWritableRaster(sppsm1, dataBuffer, null); return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null); } } - public final boolean isDataBufferSource(BufferedImage imageU) { + public final boolean isDataBufferSource(final BufferedImage imageU) { final DataBuffer dataBuffer0 = image.getRaster().getDataBuffer(); final DataBuffer dataBufferU = imageU.getRaster().getDataBuffer(); return dataBufferU == dataBuffer0; @@ -143,14 +144,14 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * See {@link #getAllowRowStride()} and {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. * If <code>true</code>, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBufferProvider(boolean allowRowStride) { + public AWTGLPixelBufferProvider(final boolean allowRowStride) { this.allowRowStride = allowRowStride; } @Override public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(GL gl, int componentCount) { + public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3; } @@ -161,7 +162,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * </p> */ @Override - public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); @@ -186,7 +187,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { /** * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ - public SingleAWTGLPixelBufferProvider(boolean allowRowStride) { + public SingleAWTGLPixelBufferProvider(final boolean allowRowStride) { super(allowRowStride); } @@ -197,7 +198,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * </p> */ @Override - public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { if( 4 == pixelAttributes.componentCount ) { if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) { singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); @@ -211,7 +212,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { } } - private AWTGLPixelBuffer allocateImpl(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + private AWTGLPixelBuffer allocateImpl(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); @@ -220,7 +221,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ @Override - public AWTGLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes) { + public AWTGLPixelBuffer getSingleBuffer(final GLPixelAttributes pixelAttributes) { return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3; } @@ -229,7 +230,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated. */ @Override - public AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack) { + public AWTGLPixelBuffer initSingleton(final int componentCount, final int width, final int height, final int depth, final boolean pack) { if( 4 == componentCount ) { if( null != singleRGBA4 ) { return null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java index 3c5d6be2d..06e3ccda5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java @@ -46,7 +46,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * * @param alpha */ - public AWTGLReadBufferUtil(GLProfile glp, boolean alpha) { + public AWTGLReadBufferUtil(final GLProfile glp, final boolean alpha) { super(new AWTGLPixelBuffer.AWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */ ), alpha, false); } @@ -64,7 +64,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #AWTGLReadBufferUtil(GLProfile, boolean) */ - public BufferedImage readPixelsToBufferedImage(GL gl, boolean awtOrientation) { + public BufferedImage readPixelsToBufferedImage(final GL gl, final boolean awtOrientation) { return readPixelsToBufferedImage(gl, 0, 0, 0, 0, awtOrientation); } @@ -84,7 +84,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #AWTGLReadBufferUtil(GLProfile, boolean) */ - public BufferedImage readPixelsToBufferedImage(GL gl, int inX, int inY, int inWidth, int inHeight, boolean awtOrientation) { + public BufferedImage readPixelsToBufferedImage(final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean awtOrientation) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java index df3cc4a39..4023a06f0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java @@ -50,8 +50,8 @@ public class ImageUtil { /** Flips the supplied BufferedImage vertically. This is often a necessary conversion step to display a Java2D image correctly with OpenGL and vice versa. */ - public static void flipImageVertically(BufferedImage image) { - WritableRaster raster = image.getRaster(); + public static void flipImageVertically(final BufferedImage image) { + final WritableRaster raster = image.getRaster(); Object scanline1 = null; Object scanline2 = null; @@ -73,8 +73,8 @@ public class ImageUtil { * * @return A instance of <code>BufferedImage</code> with a type compatible with the graphics card. */ - public static BufferedImage createCompatibleImage(int width, int height) { - GraphicsConfiguration configuration = + public static BufferedImage createCompatibleImage(final int width, final int height) { + final GraphicsConfiguration configuration = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(); return configuration.createCompatibleImage(width, height); @@ -92,7 +92,7 @@ public class ImageUtil { * * @return A thumbnail with the requested width or the original picture if thumbWidth = image.getWidth() */ - public static BufferedImage createThumbnail(BufferedImage image, int thumbWidth) { + public static BufferedImage createThumbnail(final BufferedImage image, final int thumbWidth) { // Thanks to Romain Guy for this utility if (thumbWidth > image.getWidth()) { throw new IllegalArgumentException("Thumbnail width must be greater than image width"); @@ -102,7 +102,7 @@ public class ImageUtil { return image; } - float ratio = (float) image.getWidth() / (float) image.getHeight(); + final float ratio = (float) image.getWidth() / (float) image.getHeight(); int width = image.getWidth(); BufferedImage thumb = image; @@ -112,8 +112,8 @@ public class ImageUtil { width = thumbWidth; } - BufferedImage temp = createCompatibleImage(width, (int) (width / ratio)); - Graphics2D g2 = temp.createGraphics(); + final BufferedImage temp = createCompatibleImage(width, (int) (width / ratio)); + final Graphics2D g2 = temp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java index 1ad7b9987..a78bc9bb3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java @@ -49,13 +49,13 @@ import javax.media.opengl.*; efficiency. */ public class Overlay { - private GLDrawable drawable; + private final GLDrawable drawable; private TextureRenderer renderer; private boolean contentsLost; /** Creates a new Java 2D overlay on top of the specified GLDrawable. */ - public Overlay(GLDrawable drawable) { + public Overlay(final GLDrawable drawable) { this.drawable = drawable; } @@ -103,7 +103,7 @@ public class Overlay { @param height the height of the region to update @throws GLException If an OpenGL context is not current when this method is called */ - public void markDirty(int x, int y, int width, int height) { + public void markDirty(final int x, final int y, final int width, final int height) { renderer.markDirty(x, y, width, height); } @@ -159,7 +159,7 @@ public class Overlay { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(int x, int y, int width, int height) throws GLException { + public void draw(final int x, final int y, final int width, final int height) throws GLException { draw(x, y, x, y, width, height); } @@ -184,9 +184,9 @@ public class Overlay { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(int screenx, int screeny, - int overlayx, int overlayy, - int width, int height) throws GLException { + public void draw(final int screenx, final int screeny, + final int overlayx, final int overlayy, + final int width, final int height) throws GLException { renderer.drawOrthoRect(screenx, screeny, overlayx, overlayy, width, height); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java index f686b672a..ac208044b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java @@ -88,9 +88,9 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int width, - int height) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int width, + final int height) throws GLException, IOException { writeToTargaFile(file, width, height, false); } @@ -115,10 +115,10 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int width, - int height, - boolean alpha) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int width, + final int height, + final boolean alpha) throws GLException, IOException { writeToTargaFile(file, 0, 0, width, height, alpha); } @@ -145,27 +145,27 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int x, - int y, - int width, - int height, - boolean alpha) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int x, + final int y, + final int width, + final int height, + final boolean alpha) throws GLException, IOException { if (alpha) { checkExtABGR(); } - TGAWriter writer = new TGAWriter(); + final TGAWriter writer = new TGAWriter(); writer.open(file, width, height, alpha); - ByteBuffer bgr = writer.getImageData(); + final ByteBuffer bgr = writer.getImageData(); - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); // Set up pixel storage modes - GLPixelStorageModes psm = new GLPixelStorageModes(); + final GLPixelStorageModes psm = new GLPixelStorageModes(); psm.setPackAlignment(gl, 1); - int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); + final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); // read the BGR values into the image buffer gl.glReadPixels(x, y, width, height, readbackType, @@ -198,8 +198,8 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int width, - int height) throws GLException { + public static BufferedImage readToBufferedImage(final int width, + final int height) throws GLException { return readToBufferedImage(width, height, false); } @@ -223,9 +223,9 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int width, - int height, - boolean alpha) throws GLException { + public static BufferedImage readToBufferedImage(final int width, + final int height, + final boolean alpha) throws GLException { return readToBufferedImage(0, 0, width, height, alpha); } @@ -251,26 +251,26 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int x, - int y, - int width, - int height, - boolean alpha) throws GLException { - int bufImgType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR); - int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); + public static BufferedImage readToBufferedImage(final int x, + final int y, + final int width, + final int height, + final boolean alpha) throws GLException { + final int bufImgType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR); + final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); if (alpha) { checkExtABGR(); } // Allocate necessary storage - BufferedImage image = new BufferedImage(width, height, bufImgType); + final BufferedImage image = new BufferedImage(width, height, bufImgType); - GLContext glc = GLContext.getCurrent(); - GL gl = glc.getGL(); + final GLContext glc = GLContext.getCurrent(); + final GL gl = glc.getGL(); // Set up pixel storage modes - GLPixelStorageModes psm = new GLPixelStorageModes(); + final GLPixelStorageModes psm = new GLPixelStorageModes(); psm.setPackAlignment(gl, 1); // read the BGR values into the image @@ -313,9 +313,9 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int width, - int height) throws IOException, GLException { + public static void writeToFile(final File file, + final int width, + final int height) throws IOException, GLException { writeToFile(file, width, height, false); } @@ -348,10 +348,10 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int width, - int height, - boolean alpha) throws IOException, GLException { + public static void writeToFile(final File file, + final int width, + final int height, + final boolean alpha) throws IOException, GLException { writeToFile(file, 0, 0, width, height, alpha); } @@ -386,26 +386,26 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int x, - int y, - int width, - int height, + public static void writeToFile(final File file, + final int x, + final int y, + final int width, + final int height, boolean alpha) throws IOException, GLException { - String fileSuffix = IOUtil.getFileSuffix(file); + final String fileSuffix = IOUtil.getFileSuffix(file); if (alpha && (fileSuffix.equals("jpg") || fileSuffix.equals("jpeg"))) { // JPEGs can't deal properly with alpha channels alpha = false; } - BufferedImage image = readToBufferedImage(x, y, width, height, alpha); + final BufferedImage image = readToBufferedImage(x, y, width, height, alpha); if (!ImageIO.write(image, fileSuffix, file)) { throw new IOException("Unsupported file format " + fileSuffix); } } private static void checkExtABGR() { - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) { throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr"); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index a5c8f66af..660d3bc6a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -40,7 +40,7 @@ package com.jogamp.opengl.util.awt; import com.jogamp.common.nio.Buffers; - +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.packrect.*; @@ -60,14 +60,12 @@ import java.awt.RenderingHints; import java.awt.event.*; import java.awt.font.*; import java.awt.geom.*; - import java.nio.*; - import java.text.*; - import java.util.*; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.*; import javax.media.opengl.awt.*; @@ -132,7 +130,7 @@ public class TextRenderer { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.TextRenderer", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.TextRenderer", true); } // These are occasionally useful for more in-depth debugging @@ -218,7 +216,7 @@ public class TextRenderer { @param font the font to render with */ - public TextRenderer(Font font) { + public TextRenderer(final Font font) { this(font, false, false, null, false); } @@ -232,7 +230,7 @@ public class TextRenderer { @param font the font to render with @param mipmap whether to attempt use of automatic mipmap generation */ - public TextRenderer(Font font, boolean mipmap) { + public TextRenderer(final Font font, final boolean mipmap) { this(font, false, false, null, mipmap); } @@ -249,8 +247,8 @@ public class TextRenderer { @param useFractionalMetrics whether to use fractional font metrics at the Java 2D level */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics) { this(font, antialiased, useFractionalMetrics, null, false); } @@ -268,8 +266,8 @@ public class TextRenderer { @param renderDelegate the render delegate to use to draw the text's bitmap, or null to use the default one */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics, RenderDelegate renderDelegate) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics, final RenderDelegate renderDelegate) { this(font, antialiased, useFractionalMetrics, renderDelegate, false); } @@ -290,9 +288,9 @@ public class TextRenderer { text's bitmap, or null to use the default one @param mipmap whether to attempt use of automatic mipmap generation */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics, RenderDelegate renderDelegate, - boolean mipmap) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics, RenderDelegate renderDelegate, + final boolean mipmap) { this.font = font; this.antialiased = antialiased; this.useFractionalMetrics = useFractionalMetrics; @@ -314,7 +312,7 @@ public class TextRenderer { /** Returns the bounding rectangle of the given String, assuming it was rendered at the origin. See {@link #getBounds(CharSequence) getBounds(CharSequence)}. */ - public Rectangle2D getBounds(String str) { + public Rectangle2D getBounds(final String str) { return getBounds((CharSequence) str); } @@ -333,12 +331,12 @@ public class TextRenderer { {@link java.awt.font.GlyphVector#getPixelBounds getPixelBounds}, etc.) the returned bounds correspond to, although every effort is made to ensure an accurate bound. */ - public Rectangle2D getBounds(CharSequence str) { + public Rectangle2D getBounds(final CharSequence str) { // FIXME: this should be more optimized and use the glyph cache - Rect r = stringLocations.get(str); + final Rect r = stringLocations.get(str); if (r != null) { - TextData data = (TextData) r.getUserData(); + final TextData data = (TextData) r.getUserData(); // Reconstitute the Java 2D results based on the cached values return new Rectangle2D.Double(-data.origin().x, -data.origin().y, @@ -385,7 +383,7 @@ public class TextRenderer { @param height the height of the current on-screen OpenGL drawable @throws javax.media.opengl.GLException If an OpenGL context is not current when this method is called */ - public void beginRendering(int width, int height) throws GLException { + public void beginRendering(final int width, final int height) throws GLException { beginRendering(width, height, true); } @@ -405,7 +403,7 @@ public class TextRenderer { @param disableDepthTest whether to disable the depth test @throws GLException If an OpenGL context is not current when this method is called */ - public void beginRendering(int width, int height, boolean disableDepthTest) + public void beginRendering(final int width, final int height, final boolean disableDepthTest) throws GLException { beginRendering(true, width, height, disableDepthTest); } @@ -432,8 +430,8 @@ public class TextRenderer { @param color the new color to use for rendering text @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(Color color) throws GLException { - boolean noNeedForFlush = (haveCachedColor && (cachedColor != null) && + public void setColor(final Color color) throws GLException { + final boolean noNeedForFlush = (haveCachedColor && (cachedColor != null) && color.equals(cachedColor)); if (!noNeedForFlush) { @@ -460,9 +458,9 @@ public class TextRenderer { transparent, 1.0f = completely opaque @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(float r, float g, float b, float a) + public void setColor(final float r, final float g, final float b, final float a) throws GLException { - boolean noNeedForFlush = (haveCachedColor && (cachedColor == null) && + final boolean noNeedForFlush = (haveCachedColor && (cachedColor == null) && (r == cachedR) && (g == cachedG) && (b == cachedB) && (a == cachedA)); @@ -490,14 +488,14 @@ public class TextRenderer { @param y the y coordinate at which to draw @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(CharSequence str, int x, int y) throws GLException { + public void draw(final CharSequence str, final int x, final int y) throws GLException { draw3D(str, x, y, 0, 1); } /** Draws the supplied String at the desired location using the renderer's current color. See {@link #draw(CharSequence, int, int) draw(CharSequence, int, int)}. */ - public void draw(String str, int x, int y) throws GLException { + public void draw(final String str, final int x, final int y) throws GLException { draw3D(str, x, y, 0, 1); } @@ -513,8 +511,8 @@ public class TextRenderer { @param scaleFactor a uniform scale factor applied to the width and height of the drawn rectangle @throws GLException If an OpenGL context is not current when this method is called */ - public void draw3D(CharSequence str, float x, float y, float z, - float scaleFactor) { + public void draw3D(final CharSequence str, final float x, final float y, final float z, + final float scaleFactor) { internal_draw3D(str, x, y, z, scaleFactor); } @@ -522,12 +520,12 @@ public class TextRenderer { renderer's current color. See {@link #draw3D(CharSequence, float, float, float, float) draw3D(CharSequence, float, float, float, float)}. */ - public void draw3D(String str, float x, float y, float z, float scaleFactor) { + public void draw3D(final String str, final float x, final float y, final float z, final float scaleFactor) { internal_draw3D(str, x, y, z, scaleFactor); } /** Returns the pixel width of the given character. */ - public float getCharWidth(char inChar) { + public float getCharWidth(final char inChar) { return mGlyphProducer.getGlyphPixelWidth(inChar); } @@ -582,20 +580,20 @@ public class TextRenderer { // Internals only below this point // - private static Rectangle2D preNormalize(Rectangle2D src) { + private static Rectangle2D preNormalize(final Rectangle2D src) { // Need to round to integer coordinates // Also give ourselves a little slop around the reported // bounds of glyphs because it looks like neither the visual // nor the pixel bounds works perfectly well - int minX = (int) Math.floor(src.getMinX()) - 1; - int minY = (int) Math.floor(src.getMinY()) - 1; - int maxX = (int) Math.ceil(src.getMaxX()) + 1; - int maxY = (int) Math.ceil(src.getMaxY()) + 1; + final int minX = (int) Math.floor(src.getMinX()) - 1; + final int minY = (int) Math.floor(src.getMinY()) - 1; + final int maxX = (int) Math.ceil(src.getMaxX()) + 1; + final int maxY = (int) Math.ceil(src.getMaxY()) + 1; return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY); } - private Rectangle2D normalize(Rectangle2D src) { + private Rectangle2D normalize(final Rectangle2D src) { // Give ourselves a boundary around each entity on the backing // store in order to prevent bleeding of nearby Strings due to // the fact that we use linear filtering @@ -603,7 +601,7 @@ public class TextRenderer { // NOTE that this boundary is quite heuristic and is related // to how far away in 3D we may view the text -- // heuristically, 1.5% of the font's height - int boundary = (int) Math.max(1, 0.015 * font.getSize()); + final int boundary = (int) Math.max(1, 0.015 * font.getSize()); return new Rectangle2D.Double((int) Math.floor(src.getMinX() - boundary), (int) Math.floor(src.getMinY() - boundary), @@ -612,7 +610,7 @@ public class TextRenderer { } private TextureRenderer getBackingStore() { - TextureRenderer renderer = (TextureRenderer) packer.getBackingStore(); + final TextureRenderer renderer = (TextureRenderer) packer.getBackingStore(); if (renderer != cachedBackingStore) { // Backing store changed since last time; discard any cached Graphics2D @@ -629,7 +627,7 @@ public class TextRenderer { } private Graphics2D getGraphics2D() { - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); if (cachedGraphics == null) { cachedGraphics = renderer.createGraphics(); @@ -650,9 +648,9 @@ public class TextRenderer { return cachedGraphics; } - private void beginRendering(boolean ortho, int width, int height, - boolean disableDepthTestForOrtho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + private void beginRendering(final boolean ortho, final int width, final int height, + final boolean disableDepthTestForOrtho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); if (DEBUG && !debugged) { debug(gl); @@ -677,8 +675,8 @@ public class TextRenderer { if (!haveMaxSize) { // Query OpenGL for the maximum texture size and set it in the // RectanglePacker to keep it from expanding too large - int[] sz = new int[1]; - gl.glGetIntegerv(GL2.GL_MAX_TEXTURE_SIZE, sz, 0); + final int[] sz = new int[1]; + gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, sz, 0); packer.setMaxSize(sz[0], sz[0]); haveMaxSize = true; } @@ -711,12 +709,12 @@ public class TextRenderer { * @param ortho * @throws GLException */ - private void endRendering(boolean ortho) throws GLException { + private void endRendering(final boolean ortho) throws GLException { flushGlyphPipeline(); inBeginEndPair = false; - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Pop client attrib bits used by the pipelined quad renderer gl.glPopClientAttrib(); @@ -726,8 +724,8 @@ public class TextRenderer { // binding if (getUseVertexArrays() && is15Available(gl)) { try { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - } catch (Exception e) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; } } @@ -756,8 +754,8 @@ public class TextRenderer { // text strings that haven't been used recently packer.visit(new RectVisitor() { @Override - public void visit(Rect rect) { - TextData data = (TextData) rect.getUserData(); + public void visit(final Rect rect) { + final TextData data = (TextData) rect.getUserData(); if (data.used()) { data.clearUsed(); @@ -767,11 +765,11 @@ public class TextRenderer { } }); - for (Rect r : deadRects) { + for (final Rect r : deadRects) { packer.remove(r); stringLocations.remove(((TextData) r.getUserData()).string()); - int unicodeToClearFromCache = ((TextData) r.getUserData()).unicodeID; + final int unicodeToClearFromCache = ((TextData) r.getUserData()).unicodeID; if (unicodeToClearFromCache > 0) { mGlyphProducer.clearCacheEntry(unicodeToClearFromCache); @@ -786,7 +784,7 @@ public class TextRenderer { } // If we removed dead rectangles this cycle, try to do a compaction - float frag = packer.verticalFragmentationRatio(); + final float frag = packer.verticalFragmentationRatio(); if (!deadRects.isEmpty() && (frag > MAX_VERTICAL_FRAGMENTATION)) { if (DEBUG) { @@ -804,10 +802,10 @@ public class TextRenderer { } } - private void internal_draw3D(CharSequence str, float x, float y, float z, - float scaleFactor) { - for (Glyph glyph : mGlyphProducer.getGlyphs(str)) { - float advance = glyph.draw3D(x, y, z, scaleFactor); + private void internal_draw3D(final CharSequence str, float x, final float y, final float z, + final float scaleFactor) { + for (final Glyph glyph : mGlyphProducer.getGlyphs(str)) { + final float advance = glyph.draw3D(x, y, z, scaleFactor); x += advance * scaleFactor; } } @@ -818,8 +816,8 @@ public class TextRenderer { } } - private void draw3D_ROBUST(CharSequence str, float x, float y, float z, - float scaleFactor) { + private void draw3D_ROBUST(final CharSequence str, final float x, final float y, final float z, + final float scaleFactor) { String curStr; if (str instanceof String) { curStr = (String) str; @@ -833,9 +831,9 @@ public class TextRenderer { if (rect == null) { // Rasterize this string and place it on the backing store Graphics2D g = getGraphics2D(); - Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(curStr, font, getFontRenderContext())); - Rectangle2D bbox = normalize(origBBox); - Point origin = new Point((int) -bbox.getMinX(), + final Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(curStr, font, getFontRenderContext())); + final Rectangle2D bbox = normalize(origBBox); + final Point origin = new Point((int) -bbox.getMinX(), (int) -bbox.getMinY()); rect = new Rect(0, 0, (int) bbox.getWidth(), (int) bbox.getHeight(), @@ -850,8 +848,8 @@ public class TextRenderer { // OK, should now have an (x, y) for this rectangle; rasterize // the String - int strx = rect.x() + origin.x; - int stry = rect.y() + origin.y; + final int strx = rect.x() + origin.x; + final int stry = rect.y() + origin.y; // Clear out the area we're going to draw into g.setComposite(AlphaComposite.Clear); @@ -862,7 +860,7 @@ public class TextRenderer { renderDelegate.draw(g, curStr, strx, stry); if (DRAW_BBOXES) { - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); // Draw a bounding box on the backing store g.drawRect(strx - data.origOriginX(), stry - data.origOriginY(), @@ -880,15 +878,15 @@ public class TextRenderer { } // OK, now draw the portion of the backing store to the screen - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); // NOTE that the rectangles managed by the packer have their // origin at the upper-left but the TextureRenderer's origin is // at its lower left!!! - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); data.markUsed(); - Rectangle2D origRect = data.origRect(); + final Rectangle2D origRect = data.origRect(); // Align the leftmost point of the baseline to the (x, y, z) coordinate requested renderer.draw3DRect(x - (scaleFactor * data.origOriginX()), @@ -902,10 +900,10 @@ public class TextRenderer { //---------------------------------------------------------------------- // Debugging functionality // - private void debug(GL gl) { + private void debug(final GL gl) { dbgFrame = new Frame("TextRenderer Debug Output"); - GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile())); + final GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile())); dbgCanvas.setSharedContext(GLContext.getCurrent()); dbgCanvas.addGLEventListener(new DebugListener(gl, dbgFrame)); dbgFrame.add(dbgCanvas); @@ -913,7 +911,7 @@ public class TextRenderer { final FPSAnimator anim = new FPSAnimator(dbgCanvas, 10); dbgFrame.addWindowListener(new WindowAdapter() { @Override - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting @@ -999,11 +997,11 @@ public class TextRenderer { CharSequenceIterator() { } - CharSequenceIterator(CharSequence sequence) { + CharSequenceIterator(final CharSequence sequence) { initFromCharSequence(sequence); } - public void initFromCharSequence(CharSequence sequence) { + public void initFromCharSequence(final CharSequence sequence) { mSequence = sequence; mLength = mSequence.length(); mCurrentIndex = 0; @@ -1040,7 +1038,7 @@ public class TextRenderer { } @Override - public char setIndex(int position) { + public char setIndex(final int position) { mCurrentIndex = position; return current(); @@ -1063,7 +1061,7 @@ public class TextRenderer { @Override public Object clone() { - CharSequenceIterator iter = new CharSequenceIterator(mSequence); + final CharSequenceIterator iter = new CharSequenceIterator(mSequence); iter.mCurrentIndex = mCurrentIndex; return iter; @@ -1108,7 +1106,7 @@ public class TextRenderer { private boolean used; // Whether this text was used recently - TextData(String str, Point origin, Rectangle2D origRect, int unicodeID) { + TextData(final String str, final Point origin, final Rectangle2D origRect, final int unicodeID) { this.str = str; this.origin = origin; this.origRect = origRect; @@ -1154,7 +1152,7 @@ public class TextRenderer { private Graphics2D g; @Override - public Object allocateBackingStore(int w, int h) { + public Object allocateBackingStore(final int w, final int h) { // FIXME: should consider checking Font's attributes to see // whether we're likely to need to support a full RGBA backing // store (i.e., non-default Paint, foreground color, etc.), but @@ -1177,12 +1175,12 @@ public class TextRenderer { } @Override - public void deleteBackingStore(Object backingStore) { + public void deleteBackingStore(final Object backingStore) { ((TextureRenderer) backingStore).dispose(); } @Override - public boolean preExpand(Rect cause, int attemptNumber) { + public boolean preExpand(final Rect cause, final int attemptNumber) { // Only try this one time; clear out potentially obsolete entries // NOTE: this heuristic and the fact that it clears the used bit // of all entries seems to cause cycling of entries in some @@ -1218,7 +1216,7 @@ public class TextRenderer { } @Override - public boolean additionFailed(Rect cause, int attemptNumber) { + public boolean additionFailed(final Rect cause, final int attemptNumber) { // Heavy hammer -- might consider doing something different packer.clear(); stringLocations.clear(); @@ -1242,13 +1240,13 @@ public class TextRenderer { } @Override - public void beginMovement(Object oldBackingStore, Object newBackingStore) { + public void beginMovement(final Object oldBackingStore, final Object newBackingStore) { // Exit the begin / end pair if necessary if (inBeginEndPair) { // Draw any outstanding glyphs flush(); - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Pop client attrib bits used by the pipelined quad renderer gl.glPopClientAttrib(); @@ -1258,8 +1256,8 @@ public class TextRenderer { // binding if (getUseVertexArrays() && is15Available(gl)) { try { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - } catch (Exception e) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; } } @@ -1271,15 +1269,15 @@ public class TextRenderer { } } - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; g = newRenderer.createGraphics(); } @Override - public void move(Object oldBackingStore, Rect oldLocation, - Object newBackingStore, Rect newLocation) { - TextureRenderer oldRenderer = (TextureRenderer) oldBackingStore; - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + public void move(final Object oldBackingStore, final Rect oldLocation, + final Object newBackingStore, final Rect newLocation) { + final TextureRenderer oldRenderer = (TextureRenderer) oldBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; if (oldRenderer == newRenderer) { // Movement on the same backing store -- easy case @@ -1288,7 +1286,7 @@ public class TextRenderer { newLocation.y() - oldLocation.y()); } else { // Need to draw from the old renderer's image into the new one - Image img = oldRenderer.getImage(); + final Image img = oldRenderer.getImage(); g.drawImage(img, newLocation.x(), newLocation.y(), newLocation.x() + newLocation.w(), newLocation.y() + newLocation.h(), oldLocation.x(), @@ -1298,11 +1296,11 @@ public class TextRenderer { } @Override - public void endMovement(Object oldBackingStore, Object newBackingStore) { + public void endMovement(final Object oldBackingStore, final Object newBackingStore) { g.dispose(); // Sync the whole surface - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; newRenderer.markDirty(0, 0, newRenderer.getWidth(), newRenderer.getHeight()); @@ -1316,7 +1314,7 @@ public class TextRenderer { } // Push client attrib bits used by the pipelined quad renderer - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); gl.glPushClientAttrib((int) GL2.GL_ALL_CLIENT_ATTRIB_BITS); if (haveCachedColor) { @@ -1340,32 +1338,32 @@ public class TextRenderer { } @Override - public Rectangle2D getBounds(CharSequence str, Font font, - FontRenderContext frc) { + public Rectangle2D getBounds(final CharSequence str, final Font font, + final FontRenderContext frc) { return getBounds(font.createGlyphVector(frc, new CharSequenceIterator(str)), frc); } @Override - public Rectangle2D getBounds(String str, Font font, - FontRenderContext frc) { + public Rectangle2D getBounds(final String str, final Font font, + final FontRenderContext frc) { return getBounds(font.createGlyphVector(frc, str), frc); } @Override - public Rectangle2D getBounds(GlyphVector gv, FontRenderContext frc) { + public Rectangle2D getBounds(final GlyphVector gv, final FontRenderContext frc) { return gv.getVisualBounds(); } @Override - public void drawGlyphVector(Graphics2D graphics, GlyphVector str, - int x, int y) { + public void drawGlyphVector(final Graphics2D graphics, final GlyphVector str, + final int x, final int y) { graphics.drawGlyphVector(str, x, y); } @Override - public void draw(Graphics2D graphics, String str, int x, int y) { + public void draw(final Graphics2D graphics, final String str, final int x, final int y) { graphics.drawString(str, x, y); } } @@ -1415,11 +1413,11 @@ public class TextRenderer { private boolean needAdvance; // Creates a Glyph representing an individual Unicode character - public Glyph(int unicodeID, - int glyphCode, - float advance, - GlyphVector singleUnicodeGlyphVector, - GlyphProducer producer) { + public Glyph(final int unicodeID, + final int glyphCode, + final float advance, + final GlyphVector singleUnicodeGlyphVector, + final GlyphProducer producer) { this.unicodeID = unicodeID; this.glyphCode = glyphCode; this.advance = advance; @@ -1430,7 +1428,7 @@ public class TextRenderer { // Creates a Glyph representing a sequence of characters, with // an indication of whether additional single glyphs are being // rendered after it - public Glyph(String str, boolean needAdvance) { + public Glyph(final String str, final boolean needAdvance) { this.str = str; this.needAdvance = needAdvance; } @@ -1451,14 +1449,14 @@ public class TextRenderer { } /** Draws this glyph and returns the (x) advance for this glyph */ - public float draw3D(float inX, float inY, float z, float scaleFactor) { + public float draw3D(final float inX, final float inY, final float z, final float scaleFactor) { if (str != null) { draw3D_ROBUST(str, inX, inY, z, scaleFactor); if (!needAdvance) { return 0; } // Compute and return the advance for this string - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), str); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), str); float totalAdvance = 0; for (int i = 0; i < gv.getNumGlyphs(); i++) { totalAdvance += gv.getGlyphMetrics(i).getAdvance(); @@ -1476,32 +1474,32 @@ public class TextRenderer { mPipelinedQuadRenderer = new Pipelined_QuadRenderer(); } - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); // Handles case where NPOT texture is used for backing store - TextureCoords wholeImageTexCoords = renderer.getTexture().getImageTexCoords(); - float xScale = wholeImageTexCoords.right(); - float yScale = wholeImageTexCoords.bottom(); + final TextureCoords wholeImageTexCoords = renderer.getTexture().getImageTexCoords(); + final float xScale = wholeImageTexCoords.right(); + final float yScale = wholeImageTexCoords.bottom(); - Rect rect = glyphRectForTextureMapping; - TextData data = (TextData) rect.getUserData(); + final Rect rect = glyphRectForTextureMapping; + final TextData data = (TextData) rect.getUserData(); data.markUsed(); - Rectangle2D origRect = data.origRect(); + final Rectangle2D origRect = data.origRect(); - float x = inX - (scaleFactor * data.origOriginX()); - float y = inY - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())); + final float x = inX - (scaleFactor * data.origOriginX()); + final float y = inY - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())); - int texturex = rect.x() + (data.origin().x - data.origOriginX()); - int texturey = renderer.getHeight() - rect.y() - (int) origRect.getHeight() - + final int texturex = rect.x() + (data.origin().x - data.origOriginX()); + final int texturey = renderer.getHeight() - rect.y() - (int) origRect.getHeight() - (data.origin().y - data.origOriginY()); - int width = (int) origRect.getWidth(); - int height = (int) origRect.getHeight(); + final int width = (int) origRect.getWidth(); + final int height = (int) origRect.getHeight(); - float tx1 = xScale * texturex / renderer.getWidth(); - float ty1 = yScale * (1.0f - + final float tx1 = xScale * texturex / renderer.getWidth(); + final float ty1 = yScale * (1.0f - ((float) texturey / (float) renderer.getHeight())); - float tx2 = xScale * (texturex + width) / renderer.getWidth(); - float ty2 = yScale * (1.0f - + final float tx2 = xScale * (texturex + width) / renderer.getWidth(); + final float ty2 = yScale * (1.0f - ((float) (texturey + height) / (float) renderer.getHeight())); mPipelinedQuadRenderer.glTexCoord2f(tx1, ty1); @@ -1515,7 +1513,7 @@ public class TextRenderer { mPipelinedQuadRenderer.glTexCoord2f(tx1, ty2); mPipelinedQuadRenderer.glVertex3f(x, y + (height * scaleFactor), z); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return advance; @@ -1527,21 +1525,21 @@ public class TextRenderer { } private void upload() { - GlyphVector gv = getGlyphVector(); - Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(gv, getFontRenderContext())); - Rectangle2D bbox = normalize(origBBox); - Point origin = new Point((int) -bbox.getMinX(), + final GlyphVector gv = getGlyphVector(); + final Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(gv, getFontRenderContext())); + final Rectangle2D bbox = normalize(origBBox); + final Point origin = new Point((int) -bbox.getMinX(), (int) -bbox.getMinY()); - Rect rect = new Rect(0, 0, (int) bbox.getWidth(), + final Rect rect = new Rect(0, 0, (int) bbox.getWidth(), (int) bbox.getHeight(), new TextData(null, origin, origBBox, unicodeID)); packer.add(rect); glyphRectForTextureMapping = rect; - Graphics2D g = getGraphics2D(); + final Graphics2D g = getGraphics2D(); // OK, should now have an (x, y) for this rectangle; rasterize // the glyph - int strx = rect.x() + origin.x; - int stry = rect.y() + origin.y; + final int strx = rect.x() + origin.x; + final int stry = rect.y() + origin.y; // Clear out the area we're going to draw into g.setComposite(AlphaComposite.Clear); @@ -1552,7 +1550,7 @@ public class TextRenderer { renderDelegate.drawGlyphVector(g, gv, strx, stry); if (DRAW_BBOXES) { - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); // Draw a bounding box on the backing store g.drawRect(strx - data.origOriginX(), stry - data.origOriginY(), @@ -1572,7 +1570,7 @@ public class TextRenderer { } private GlyphVector getGlyphVector() { - GlyphVector gv = singleUnicodeGlyphVector; + final GlyphVector gv = singleUnicodeGlyphVector; if (gv != null) { singleUnicodeGlyphVector = null; // Don't need this anymore return gv; @@ -1595,13 +1593,13 @@ public class TextRenderer { // We re-use this for each incoming string CharSequenceIterator iter = new CharSequenceIterator(); - GlyphProducer(int fontLengthInGlyphs) { + GlyphProducer(final int fontLengthInGlyphs) { unicodes2Glyphs = new int[512]; glyphCache = new Glyph[fontLengthInGlyphs]; clearAllCacheEntries(); } - public List<Glyph> getGlyphs(CharSequence inString) { + public List<Glyph> getGlyphs(final CharSequence inString) { glyphsOutput.clear(); GlyphVector fullRunGlyphVector; fullRunGlyphVector = fullGlyphVectorCache.get(inString.toString()); @@ -1610,30 +1608,30 @@ public class TextRenderer { fullRunGlyphVector = font.createGlyphVector(getFontRenderContext(), iter); fullGlyphVectorCache.put(inString.toString(), fullRunGlyphVector); } - boolean complex = (fullRunGlyphVector.getLayoutFlags() != 0); + final boolean complex = (fullRunGlyphVector.getLayoutFlags() != 0); if (complex || DISABLE_GLYPH_CACHE) { // Punt to the robust version of the renderer glyphsOutput.add(new Glyph(inString.toString(), false)); return glyphsOutput; } - int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs(); + final int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs(); int i = 0; while (i < lengthInGlyphs) { - Character letter = CharacterCache.valueOf(inString.charAt(i)); + final Character letter = CharacterCache.valueOf(inString.charAt(i)); GlyphMetrics metrics = glyphMetricsCache.get(letter); if (metrics == null) { metrics = fullRunGlyphVector.getGlyphMetrics(i); glyphMetricsCache.put(letter, metrics); } - Glyph glyph = getGlyph(inString, metrics, i); + final Glyph glyph = getGlyph(inString, metrics, i); if (glyph != null) { glyphsOutput.add(glyph); i++; } else { // Assemble a run of characters that don't fit in // the cache - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); while (i < lengthInGlyphs && getGlyph(inString, fullRunGlyphVector.getGlyphMetrics(i), i) == null) { buf.append(inString.charAt(i++)); @@ -1646,10 +1644,10 @@ public class TextRenderer { return glyphsOutput; } - public void clearCacheEntry(int unicodeID) { - int glyphID = unicodes2Glyphs[unicodeID]; + public void clearCacheEntry(final int unicodeID) { + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { - Glyph glyph = glyphCache[glyphID]; + final Glyph glyph = glyphCache[glyphID]; if (glyph != null) { glyph.clear(); } @@ -1664,20 +1662,20 @@ public class TextRenderer { } } - public void register(Glyph glyph) { + public void register(final Glyph glyph) { unicodes2Glyphs[glyph.getUnicodeID()] = glyph.getGlyphCode(); glyphCache[glyph.getGlyphCode()] = glyph; } - public float getGlyphPixelWidth(char unicodeID) { - Glyph glyph = getGlyph(unicodeID); + public float getGlyphPixelWidth(final char unicodeID) { + final Glyph glyph = getGlyph(unicodeID); if (glyph != null) { return glyph.getAdvance(); } // Have to do this the hard / uncached way singleUnicode[0] = unicodeID; - GlyphVector gv = font.createGlyphVector(fontRenderContext, + final GlyphVector gv = font.createGlyphVector(fontRenderContext, singleUnicode); return gv.getGlyphMetrics(0).getAdvance(); } @@ -1685,52 +1683,52 @@ public class TextRenderer { // Returns a glyph object for this single glyph. Returns null // if the unicode or glyph ID would be out of bounds of the // glyph cache. - private Glyph getGlyph(CharSequence inString, - GlyphMetrics glyphMetrics, - int index) { - char unicodeID = inString.charAt(index); + private Glyph getGlyph(final CharSequence inString, + final GlyphMetrics glyphMetrics, + final int index) { + final char unicodeID = inString.charAt(index); if (unicodeID >= unicodes2Glyphs.length) { return null; } - int glyphID = unicodes2Glyphs[unicodeID]; + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { return glyphCache[glyphID]; } // Must fabricate the glyph singleUnicode[0] = unicodeID; - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); return getGlyph(unicodeID, gv, glyphMetrics); } // It's unclear whether this variant might produce less // optimal results than if we can see the entire GlyphVector // for the incoming string - private Glyph getGlyph(int unicodeID) { + private Glyph getGlyph(final int unicodeID) { if (unicodeID >= unicodes2Glyphs.length) { return null; } - int glyphID = unicodes2Glyphs[unicodeID]; + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { return glyphCache[glyphID]; } singleUnicode[0] = (char) unicodeID; - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); return getGlyph(unicodeID, gv, gv.getGlyphMetrics(0)); } - private Glyph getGlyph(int unicodeID, - GlyphVector singleUnicodeGlyphVector, - GlyphMetrics metrics) { - int glyphCode = singleUnicodeGlyphVector.getGlyphCode(0); + private Glyph getGlyph(final int unicodeID, + final GlyphVector singleUnicodeGlyphVector, + final GlyphMetrics metrics) { + final int glyphCode = singleUnicodeGlyphVector.getGlyphCode(0); // Have seen huge glyph codes (65536) coming out of some fonts in some Unicode situations if (glyphCode >= glyphCache.length) { return null; } - Glyph glyph = new Glyph(unicodeID, + final Glyph glyph = new Glyph(unicodeID, glyphCode, metrics.getAdvance(), singleUnicodeGlyphVector, @@ -1752,7 +1750,7 @@ public class TextRenderer { } } - public static Character valueOf(char c) { + public static Character valueOf(final char c) { if (c <= 127) { // must cache return CharacterCache.cache[c]; } @@ -1769,7 +1767,7 @@ public class TextRenderer { int mVBO_For_ResuableTileTexCoords; Pipelined_QuadRenderer() { - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts); mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex); @@ -1777,34 +1775,34 @@ public class TextRenderer { if (usingVBOs) { try { - int[] vbos = new int[2]; + final int[] vbos = new int[2]; gl.glGenBuffers(2, IntBuffer.wrap(vbos)); mVBO_For_ResuableTileVertices = vbos[0]; mVBO_For_ResuableTileTexCoords = vbos[1]; - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts, - null, GL2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline + gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts, + null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex, - null, GL2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline - } catch (Exception e) { + gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex, + null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; usingVBOs = false; } } } - public void glTexCoord2f(float v, float v1) { + public void glTexCoord2f(final float v, final float v1) { mTexCoords.put(v); mTexCoords.put(v1); } - public void glVertex3f(float inX, float inY, float inZ) { + public void glVertex3f(final float inX, final float inY, final float inZ) { mVertCoords.put(inX); mVertCoords.put(inY); mVertCoords.put(inZ); @@ -1826,41 +1824,41 @@ public class TextRenderer { private void drawVertexArrays() { if (mOutstandingGlyphsVerticesPipeline > 0) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious? mVertCoords.rewind(); mTexCoords.rewind(); - gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); + gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); if (usingVBOs) { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); - gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0, mOutstandingGlyphsVerticesPipeline * kSizeInBytes_OneVertices_VertexData, mVertCoords); // upload only the new stuff - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); } else { - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, mVertCoords); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, mVertCoords); } - gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY); + gl.glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); if (usingVBOs) { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); - gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0, mOutstandingGlyphsVerticesPipeline * kSizeInBytes_OneVertices_TexData, mTexCoords); // upload only the new stuff - gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, 0); + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); } else { - gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, mTexCoords); + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, mTexCoords); } - gl.glDrawArrays(GL2.GL_QUADS, 0, + gl.glDrawArrays(GL2GL3.GL_QUADS, 0, mOutstandingGlyphsVerticesPipeline); mVertCoords.rewind(); @@ -1871,14 +1869,14 @@ public class TextRenderer { private void drawIMMEDIATE() { if (mOutstandingGlyphsVerticesPipeline > 0) { - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious? - GL2 gl = GLContext.getCurrentGL().getGL2(); - gl.glBegin(GL2.GL_QUADS); + final GL2 gl = GLContext.getCurrentGL().getGL2(); + gl.glBegin(GL2GL3.GL_QUADS); try { - int numberOfQuads = mOutstandingGlyphsVerticesPipeline / 4; + final int numberOfQuads = mOutstandingGlyphsVerticesPipeline / 4; mVertCoords.rewind(); mTexCoords.rewind(); @@ -1899,7 +1897,7 @@ public class TextRenderer { gl.glVertex3f(mVertCoords.get(), mVertCoords.get(), mVertCoords.get()); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { gl.glEnd(); @@ -1915,21 +1913,21 @@ public class TextRenderer { private GLU glu; private Frame frame; - DebugListener(GL gl, Frame frame) { + DebugListener(final GL gl, final Frame frame) { this.glu = GLU.createGLU(gl); this.frame = frame; } @Override - public void display(GLAutoDrawable drawable) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - gl.glClear(GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_COLOR_BUFFER_BIT); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT); if (packer == null) { return; } - TextureRenderer rend = getBackingStore(); + final TextureRenderer rend = getBackingStore(); final int w = rend.getWidth(); final int h = rend.getHeight(); rend.beginOrthoRendering(w, h); @@ -1947,23 +1945,23 @@ public class TextRenderer { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { glu=null; frame=null; } // Unused methods @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, - int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, + final int height) { } - public void displayChanged(GLAutoDrawable drawable, - boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, + final boolean modeChanged, final boolean deviceChanged) { } } @@ -1974,7 +1972,7 @@ public class TextRenderer { * certain graphics cards which have poor vertex array * performance. Defaults to true. */ - public void setUseVertexArrays(boolean useVertexArrays) { + public void setUseVertexArrays(final boolean useVertexArrays) { this.useVertexArrays = useVertexArrays; } @@ -1993,7 +1991,7 @@ public class TextRenderer { * graphics cards do not behave well when this is enabled, * resulting in fuzzy text. Defaults to true. */ - public void setSmoothing(boolean smoothing) { + public void setSmoothing(final boolean smoothing) { this.smoothing = smoothing; getBackingStore().setSmoothing(smoothing); } @@ -2008,7 +2006,7 @@ public class TextRenderer { return smoothing; } - private final boolean is15Available(GL gl) { + private final boolean is15Available(final GL gl) { if (!checkFor_isExtensionAvailable_GL_VERSION_1_5) { isExtensionAvailable_GL_VERSION_1_5 = gl.isExtensionAvailable(GLExtensions.VERSION_1_5); checkFor_isExtensionAvailable_GL_VERSION_1_5 = true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java index 26e1eb041..ef59f9fa0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java @@ -48,7 +48,10 @@ import java.awt.Rectangle; import java.awt.image.*; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.gl2.*; + import com.jogamp.opengl.util.texture.*; import com.jogamp.opengl.util.texture.awt.*; @@ -70,10 +73,10 @@ public class TextureRenderer { // appropriate threads, which would be somewhat unfortunate. // Whether we have an alpha channel in the (RGB/A) backing store - private boolean alpha; + private final boolean alpha; // Whether we're using only a GL_INTENSITY backing store - private boolean intensity; + private final boolean intensity; // Whether we're attempting to use automatic mipmap generation support private boolean mipmap; @@ -91,7 +94,7 @@ public class TextureRenderer { private boolean mustReallocateTexture; private Rectangle dirtyRegion; - private GLUgl2 glu = new GLUgl2(); + private final GLUgl2 glu = new GLUgl2(); // Current color private float r = 1.0f; @@ -108,7 +111,7 @@ public class TextureRenderer { @param height the height of the texture to render into @param alpha whether to allocate an alpha channel for the texture */ - public TextureRenderer(int width, int height, boolean alpha) { + public TextureRenderer(final int width, final int height, final boolean alpha) { this(width, height, alpha, false); } @@ -123,13 +126,13 @@ public class TextureRenderer { @param alpha whether to allocate an alpha channel for the texture @param mipmap whether to attempt use of automatic mipmap generation */ - public TextureRenderer(int width, int height, boolean alpha, boolean mipmap) { + public TextureRenderer(final int width, final int height, final boolean alpha, final boolean mipmap) { this(width, height, alpha, false, mipmap); } // Internal constructor to avoid confusion since alpha only makes // sense when intensity is not set - private TextureRenderer(int width, int height, boolean alpha, boolean intensity, boolean mipmap) { + private TextureRenderer(final int width, final int height, final boolean alpha, final boolean intensity, final boolean mipmap) { this.alpha = alpha; this.intensity = intensity; this.mipmap = mipmap; @@ -140,7 +143,7 @@ public class TextureRenderer { which acts only as an alpha channel. No mipmap support is requested. Internally, this associates a GL_INTENSITY OpenGL texture with the backing store. */ - public static TextureRenderer createAlphaOnlyRenderer(int width, int height) { + public static TextureRenderer createAlphaOnlyRenderer(final int width, final int height) { return createAlphaOnlyRenderer(width, height, false); } @@ -150,7 +153,7 @@ public class TextureRenderer { better smoothing when rendering the TextureRenderer's contents at a distance. Internally, this associates a GL_INTENSITY OpenGL texture with the backing store. */ - public static TextureRenderer createAlphaOnlyRenderer(int width, int height, boolean mipmap) { + public static TextureRenderer createAlphaOnlyRenderer(final int width, final int height, final boolean mipmap) { return new TextureRenderer(width, height, false, true, mipmap); } @@ -205,7 +208,7 @@ public class TextureRenderer { @param height the new height of the backing store of this renderer @throws GLException If an OpenGL context is not current when this method is called */ - public void setSize(int width, int height) throws GLException { + public void setSize(final int width, final int height) throws GLException { init(width, height); } @@ -216,7 +219,7 @@ public class TextureRenderer { @param d the new size of the backing store of this renderer @throws GLException If an OpenGL context is not current when this method is called */ - public void setSize(Dimension d) throws GLException { + public void setSize(final Dimension d) throws GLException { setSize(d.width, d.height); } @@ -228,7 +231,7 @@ public class TextureRenderer { @param smoothing whether smoothing is enabled for the OpenGL texture */ - public void setSmoothing(boolean smoothing) { + public void setSmoothing(final boolean smoothing) { this.smoothing = smoothing; smoothingChanged = true; } @@ -275,8 +278,8 @@ public class TextureRenderer { @param width the width of the region to update @param height the height of the region to update */ - public void markDirty(int x, int y, int width, int height) { - Rectangle curRegion = new Rectangle(x, y, width, height); + public void markDirty(final int x, final int y, final int width, final int height) { + final Rectangle curRegion = new Rectangle(x, y, width, height); if (dirtyRegion == null) { dirtyRegion = curRegion; } else { @@ -333,7 +336,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void beginOrthoRendering(int width, int height) throws GLException { + public void beginOrthoRendering(final int width, final int height) throws GLException { beginOrthoRendering(width, height, true); } @@ -355,7 +358,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void beginOrthoRendering(int width, int height, boolean disableDepthTest) throws GLException { + public void beginOrthoRendering(final int width, final int height, final boolean disableDepthTest) throws GLException { beginRendering(true, width, height, disableDepthTest); } @@ -399,8 +402,8 @@ public class TextureRenderer { transparent, 1.0f = completely opaque @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(float r, float g, float b, float a) throws GLException { - GL2 gl = GLContext.getCurrentGL().getGL2(); + public void setColor(final float r, final float g, final float b, final float a) throws GLException { + final GL2 gl = GLContext.getCurrentGL().getGL2(); this.r = r * a; this.g = g * a; this.b = b * a; @@ -417,7 +420,7 @@ public class TextureRenderer { @param color the new color to use for rendering @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(Color color) throws GLException { + public void setColor(final Color color) throws GLException { // Get color's RGBA components as floats in the range [0,1]. if (compArray == null) { compArray = new float[4]; @@ -440,7 +443,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void drawOrthoRect(int screenx, int screeny) throws GLException { + public void drawOrthoRect(final int screenx, final int screeny) throws GLException { drawOrthoRect(screenx, screeny, 0, 0, getWidth(), getHeight()); } @@ -462,9 +465,9 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void drawOrthoRect(int screenx, int screeny, - int texturex, int texturey, - int width, int height) throws GLException { + public void drawOrthoRect(final int screenx, final int screeny, + final int texturex, final int texturey, + final int width, final int height) throws GLException { draw3DRect(screenx, screeny, 0, texturex, texturey, width, height, 1); } @@ -493,16 +496,16 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw3DRect(float x, float y, float z, - int texturex, int texturey, - int width, int height, - float scaleFactor) throws GLException { - GL2 gl = GLContext.getCurrentGL().getGL2(); - Texture texture = getTexture(); - TextureCoords coords = texture.getSubImageTexCoords(texturex, texturey, + public void draw3DRect(final float x, final float y, final float z, + final int texturex, final int texturey, + final int width, final int height, + final float scaleFactor) throws GLException { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final Texture texture = getTexture(); + final TextureCoords coords = texture.getSubImageTexCoords(texturex, texturey, texturex + width, texturey + height); - gl.glBegin(GL2.GL_QUADS); + gl.glBegin(GL2GL3.GL_QUADS); gl.glTexCoord2f(coords.left(), coords.bottom()); gl.glVertex3f(x, y, z); gl.glTexCoord2f(coords.right(), coords.bottom()); @@ -550,70 +553,70 @@ public class TextureRenderer { // Internals only below this point // - private void beginRendering(boolean ortho, int width, int height, boolean disableDepthTestForOrtho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - int attribBits = - GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL2.GL_COLOR_BUFFER_BIT | - (ortho ? (GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0); + private void beginRendering(final boolean ortho, final int width, final int height, final boolean disableDepthTestForOrtho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final int attribBits = + GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL.GL_COLOR_BUFFER_BIT | + (ortho ? (GL.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0); gl.glPushAttrib(attribBits); - gl.glDisable(GL2.GL_LIGHTING); + gl.glDisable(GLLightingFunc.GL_LIGHTING); if (ortho) { if (disableDepthTestForOrtho) { - gl.glDisable(GL2.GL_DEPTH_TEST); + gl.glDisable(GL.GL_DEPTH_TEST); } - gl.glDisable(GL2.GL_CULL_FACE); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glDisable(GL.GL_CULL_FACE); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); glu.gluOrtho2D(0, width, 0, height); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadIdentity(); - gl.glMatrixMode(GL2.GL_TEXTURE); + gl.glMatrixMode(GL.GL_TEXTURE); gl.glPushMatrix(); gl.glLoadIdentity(); } - gl.glEnable(GL2.GL_BLEND); - gl.glBlendFunc(GL2.GL_ONE, GL2.GL_ONE_MINUS_SRC_ALPHA); - Texture texture = getTexture(); + gl.glEnable(GL.GL_BLEND); + gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); + final Texture texture = getTexture(); texture.enable(gl); texture.bind(gl); - gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE); + gl.glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL2ES1.GL_MODULATE); // Change polygon color to last saved gl.glColor4f(r, g, b, a); if (smoothingChanged) { smoothingChanged = false; if (smoothing) { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); if (mipmap) { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); } else { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); } } else { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST); - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } } } - private void endRendering(boolean ortho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - Texture texture = getTexture(); + private void endRendering(final boolean ortho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final Texture texture = getTexture(); texture.disable(gl); if (ortho) { - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPopMatrix(); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPopMatrix(); - gl.glMatrixMode(GL2.GL_TEXTURE); + gl.glMatrixMode(GL.GL_TEXTURE); gl.glPopMatrix(); } gl.glPopAttrib(); } - private void init(int width, int height) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + private void init(final int width, final int height) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Discard previous BufferedImage if any if (image != null) { image.flush(); @@ -621,8 +624,8 @@ public class TextureRenderer { } // Infer the internal format if not an intensity texture - int internalFormat = (intensity ? GL2.GL_INTENSITY : 0); - int imageType = + final int internalFormat = (intensity ? GL2.GL_INTENSITY : 0); + final int imageType = (intensity ? BufferedImage.TYPE_BYTE_GRAY : (alpha ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB)); image = new BufferedImage(width, height, imageType); @@ -650,9 +653,9 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - private void sync(int x, int y, int width, int height) throws GLException { + private void sync(final int x, final int y, final int width, final int height) throws GLException { // Force allocation if necessary - boolean canSkipUpdate = ensureTexture(); + final boolean canSkipUpdate = ensureTexture(); if (!canSkipUpdate) { // Update specified region. @@ -667,7 +670,7 @@ public class TextureRenderer { // Returns true if the texture was newly allocated, false if not private boolean ensureTexture() { - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); if (mustReallocateTexture) { if (texture != null) { texture.destroy(gl); @@ -688,8 +691,8 @@ public class TextureRenderer { if (!smoothing) { // The TextureIO classes default to GL_LINEAR filtering - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST); - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java index e8df6aaec..1f055211d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java @@ -53,12 +53,12 @@ class BitmapCharRec { public float advance; public byte[] bitmap; - public BitmapCharRec(int width, - int height, - float xorig, - float yorig, - float advance, - byte[] bitmap) { + public BitmapCharRec(final int width, + final int height, + final float xorig, + final float yorig, + final float advance, + final byte[] bitmap) { this.width = width; this.height = height; this.xorig = xorig; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java index d4ee12b32..7b8418704 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java @@ -51,10 +51,10 @@ class BitmapFontRec { public int first; public BitmapCharRec[] ch; - public BitmapFontRec(String name, - int num_chars, - int first, - BitmapCharRec[] ch) { + public BitmapFontRec(final String name, + final int num_chars, + final int first, + final BitmapCharRec[] ch) { this.name = name; this.num_chars = num_chars; this.first = first; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java index 5e26e0d14..d79f16638 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java @@ -49,7 +49,7 @@ class CoordRec { public float x; public float y; - public CoordRec(float x, float y) { + public CoordRec(final float x, final float y) { this.x = x; this.y = y; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java index 42529f3f1..92cbd66da 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java @@ -40,6 +40,7 @@ package com.jogamp.opengl.util.gl2; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.glu.*; import javax.media.opengl.glu.gl2.*; @@ -103,13 +104,13 @@ public class GLUT { public static final int BITMAP_HELVETICA_12 = 7; public static final int BITMAP_HELVETICA_18 = 8; - private GLUgl2 glu = new GLUgl2(); + private final GLUgl2 glu = new GLUgl2(); //---------------------------------------------------------------------- // Shapes // - public void glutWireSphere(double radius, int slices, int stacks) { + public void glutWireSphere(final double radius, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -119,7 +120,7 @@ public class GLUT { glu.gluSphere(quadObj, radius, slices, stacks); } - public void glutSolidSphere(double radius, int slices, int stacks) { + public void glutSolidSphere(final double radius, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -129,8 +130,8 @@ public class GLUT { glu.gluSphere(quadObj, radius, slices, stacks); } - public void glutWireCone(double base, double height, - int slices, int stacks) { + public void glutWireCone(final double base, final double height, + final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -140,8 +141,8 @@ public class GLUT { glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); } - public void glutSolidCone(double base, double height, - int slices, int stacks) { + public void glutSolidCone(final double base, final double height, + final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -151,7 +152,7 @@ public class GLUT { glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); } - public void glutWireCylinder(double radius, double height, int slices, int stacks) { + public void glutWireCylinder(final double radius, final double height, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -161,13 +162,13 @@ public class GLUT { glu.gluCylinder(quadObj, radius, radius, height, slices, stacks); } - public void glutSolidCylinder(double radius, double height, int slices, int stacks) { - GL2 gl = GLUgl2.getCurrentGL2(); + public void glutSolidCylinder(final double radius, final double height, final int slices, final int stacks) { + final GL2 gl = GLUgl2.getCurrentGL2(); // Prepare table of points for drawing end caps - double [] x = new double[slices]; - double [] y = new double[slices]; - double angleDelta = Math.PI * 2 / slices; + final double [] x = new double[slices]; + final double [] y = new double[slices]; + final double angleDelta = Math.PI * 2 / slices; double angle = 0; for (int i = 0 ; i < slices ; i ++) { angle = i * angleDelta; @@ -176,7 +177,7 @@ public class GLUT { } // Draw bottom cap - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,-1); gl.glVertex3d(0,0,0); for (int i = 0 ; i < slices ; i ++) { @@ -186,7 +187,7 @@ public class GLUT { gl.glEnd(); // Draw top cap - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,1); gl.glVertex3d(0,0,height); for (int i = 0 ; i < slices ; i ++) { @@ -205,58 +206,58 @@ public class GLUT { glu.gluCylinder(quadObj, radius, radius, height, slices, stacks); } - public void glutWireCube(float size) { - drawBox(GLUgl2.getCurrentGL2(), size, GL2.GL_LINE_LOOP); + public void glutWireCube(final float size) { + drawBox(GLUgl2.getCurrentGL2(), size, GL.GL_LINE_LOOP); } - public void glutSolidCube(float size) { - drawBox(GLUgl2.getCurrentGL2(), size, GL2.GL_QUADS); + public void glutSolidCube(final float size) { + drawBox(GLUgl2.getCurrentGL2(), size, GL2GL3.GL_QUADS); } - public void glutWireTorus(double innerRadius, double outerRadius, - int nsides, int rings) { - GL2 gl = GLUgl2.getCurrentGL2(); + public void glutWireTorus(final double innerRadius, final double outerRadius, + final int nsides, final int rings) { + final GL2 gl = GLUgl2.getCurrentGL2(); gl.glPushAttrib(GL2.GL_POLYGON_BIT); - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_LINE); doughnut(gl, innerRadius, outerRadius, nsides, rings); gl.glPopAttrib(); } - public void glutSolidTorus(double innerRadius, double outerRadius, - int nsides, int rings) { + public void glutSolidTorus(final double innerRadius, final double outerRadius, + final int nsides, final int rings) { doughnut(GLUgl2.getCurrentGL2(), innerRadius, outerRadius, nsides, rings); } public void glutWireDodecahedron() { - dodecahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + dodecahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidDodecahedron() { - dodecahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLE_FAN); + dodecahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLE_FAN); } public void glutWireOctahedron() { - octahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + octahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidOctahedron() { - octahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + octahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } public void glutWireIcosahedron() { - icosahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + icosahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidIcosahedron() { - icosahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + icosahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } public void glutWireTetrahedron() { - tetrahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + tetrahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidTetrahedron() { - tetrahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + tetrahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } /** @@ -266,7 +267,7 @@ public class GLUT { * @param scale * the factor by which to scale the teapot */ - public void glutSolidTeapot(double scale) { + public void glutSolidTeapot(final double scale) { glutSolidTeapot(scale, true); } @@ -285,8 +286,8 @@ public class GLUT { * whether to create the teapot in exactly the same way as in the C * implementation of GLUT */ - public void glutSolidTeapot(double scale, boolean cStyle) { - teapot(GLUgl2.getCurrentGL2(), 14, scale, GL2.GL_FILL, cStyle); + public void glutSolidTeapot(final double scale, final boolean cStyle) { + teapot(GLUgl2.getCurrentGL2(), 14, scale, GL2GL3.GL_FILL, cStyle); } /** @@ -296,7 +297,7 @@ public class GLUT { * @param scale * the factor by which to scale the teapot */ - public void glutWireTeapot(double scale) { + public void glutWireTeapot(final double scale) { glutWireTeapot(scale, true); } @@ -315,22 +316,22 @@ public class GLUT { * whether to create the teapot in exactly the same way as in the C * implementation of GLUT */ - public void glutWireTeapot(double scale, boolean cStyle) { - teapot(GLUgl2.getCurrentGL2(), 10, scale, GL2.GL_LINE, cStyle); + public void glutWireTeapot(final double scale, final boolean cStyle) { + teapot(GLUgl2.getCurrentGL2(), 10, scale, GL2GL3.GL_LINE, cStyle); } //---------------------------------------------------------------------- // Fonts // - public void glutBitmapCharacter(int font, char character) { - GL2 gl = GLUgl2.getCurrentGL2(); - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; + public void glutBitmapCharacter(final int font, final char character) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final int[] swapbytes = new int[1]; + final int[] lsbfirst = new int[1]; + final int[] rowlength = new int[1]; + final int[] skiprows = new int[1]; + final int[] skippixels = new int[1]; + final int[] alignment = new int[1]; beginBitmap(gl, swapbytes, lsbfirst, @@ -348,14 +349,14 @@ public class GLUT { alignment); } - public void glutBitmapString (int font, String string) { - GL2 gl = GLUgl2.getCurrentGL2(); - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; + public void glutBitmapString (final int font, final String string) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final int[] swapbytes = new int[1]; + final int[] lsbfirst = new int[1]; + final int[] rowlength = new int[1]; + final int[] skiprows = new int[1]; + final int[] skippixels = new int[1]; + final int[] alignment = new int[1]; beginBitmap(gl, swapbytes, lsbfirst, @@ -363,7 +364,7 @@ public class GLUT { skiprows, skippixels, alignment); - int len = string.length(); + final int len = string.length(); for (int i = 0; i < len; i++) { bitmapCharacterImpl(gl, font, string.charAt(i)); } @@ -376,31 +377,31 @@ public class GLUT { alignment); } - public int glutBitmapWidth (int font, char character) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = character & 0xFFFF; + public int glutBitmapWidth (final int font, final char character) { + final BitmapFontRec fontinfo = getBitmapFont(font); + final int c = character & 0xFFFF; if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) return 0; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) return (int) ch.advance; else return 0; } - public void glutStrokeCharacter(int font, char character) { - GL2 gl = GLUgl2.getCurrentGL2(); - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; + public void glutStrokeCharacter(final int font, final char character) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final StrokeFontRec fontinfo = getStrokeFont(font); + final int c = character & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) return; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) { for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL2.GL_LINE_STRIP); + final StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; + final CoordRec coord = stroke.coord[j]; gl.glVertex2f(coord.x, coord.y); } gl.glEnd(); @@ -409,21 +410,21 @@ public class GLUT { } } - public void glutStrokeString(int font, String string) { - GL2 gl = GLUgl2.getCurrentGL2(); - StrokeFontRec fontinfo = getStrokeFont(font); - int len = string.length(); + public void glutStrokeString(final int font, final String string) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final StrokeFontRec fontinfo = getStrokeFont(font); + final int len = string.length(); for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; + final int c = string.charAt(pos) & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) continue; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) { for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL2.GL_LINE_STRIP); + final StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; + final CoordRec coord = stroke.coord[j]; gl.glVertex2f(coord.x, coord.y); } gl.glEnd(); @@ -433,30 +434,30 @@ public class GLUT { } } - public int glutStrokeWidth (int font, char character) { + public int glutStrokeWidth (final int font, final char character) { return (int) glutStrokeWidthf(font, character); } - public float glutStrokeWidthf (int font, char character) { - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; + public float glutStrokeWidthf (final int font, final char character) { + final StrokeFontRec fontinfo = getStrokeFont(font); + final int c = character & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) return 0; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) return ch.right; else return 0; } - public int glutBitmapLength (int font, String string) { - BitmapFontRec fontinfo = getBitmapFont(font); + public int glutBitmapLength (final int font, final String string) { + final BitmapFontRec fontinfo = getBitmapFont(font); int length = 0; - int len = string.length(); + final int len = string.length(); for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; + final int c = string.charAt(pos) & 0xFFFF; if (c >= fontinfo.first && c < fontinfo.first + fontinfo.num_chars) { - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) length += ch.advance; } @@ -464,18 +465,18 @@ public class GLUT { return length; } - public int glutStrokeLength (int font, String string) { + public int glutStrokeLength (final int font, final String string) { return (int) glutStrokeLengthf(font, string); } - public float glutStrokeLengthf (int font, String string) { - StrokeFontRec fontinfo = getStrokeFont(font); + public float glutStrokeLengthf (final int font, final String string) { + final StrokeFontRec fontinfo = getStrokeFont(font); float length = 0; - int len = string.length(); + final int len = string.length(); for (int i = 0; i < len; i++) { - char c = string.charAt(i); + final char c = string.charAt(i); if (c >= 0 && c < fontinfo.num_chars) { - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) length += ch.right; } @@ -491,9 +492,9 @@ public class GLUT { The polyhedron is centered at the origin. */ public void glutWireRhombicDodecahedron() { - GL2 gl = GLUgl2.getCurrentGL2(); + final GL2 gl = GLUgl2.getCurrentGL2(); for( int i = 0; i < 12; i++ ) { - gl.glBegin( GL2.GL_LINE_LOOP ); + gl.glBegin( GL.GL_LINE_LOOP ); gl.glNormal3dv( rdod_n[ i ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 0 ] ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 1 ] ],0 ); @@ -511,8 +512,8 @@ public class GLUT { The polyhedron is centered at the origin. */ public void glutSolidRhombicDodecahedron() { - GL2 gl = GLUgl2.getCurrentGL2(); - gl.glBegin( GL2.GL_QUADS ); + final GL2 gl = GLUgl2.getCurrentGL2(); + gl.glBegin( GL2GL3.GL_QUADS ); for( int i = 0; i < 12; i++ ) { gl.glNormal3dv( rdod_n[ i ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 0 ] ],0 ); @@ -532,7 +533,7 @@ public class GLUT { // private GLUquadric quadObj; - private void quadObjInit(GLUgl2 glu) { + private void quadObjInit(final GLUgl2 glu) { if (quadObj == null) { quadObj = glu.gluNewQuadric(); } @@ -541,7 +542,7 @@ public class GLUT { } } - private static void doughnut(GL2 gl, double r, double R, int nsides, int rings) { + private static void doughnut(final GL2 gl, final double r, final double R, final int nsides, final int rings) { int i, j; float theta, phi, theta1; float cosTheta, sinTheta; @@ -597,9 +598,9 @@ public class GLUT { {5, 6, 2, 1}, {7, 4, 0, 3} }; - private void drawBox(GL2 gl, float size, int type) { + private void drawBox(final GL2 gl, final float size, final int type) { if (boxVertices == null) { - float[][] v = new float[8][]; + final float[][] v = new float[8][]; for (int i = 0; i < 8; i++) { v[i] = new float[3]; } @@ -611,9 +612,9 @@ public class GLUT { v[1][2] = v[2][2] = v[5][2] = v[6][2] = 0.5f; boxVertices = v; } - float[][] v = boxVertices; - float[][] n = boxNormals; - int[][] faces = boxFaces; + final float[][] v = boxVertices; + final float[][] n = boxNormals; + final int[][] faces = boxFaces; for (int i = 5; i >= 0; i--) { gl.glBegin(type); gl.glNormal3fv(n[i], 0); @@ -664,14 +665,14 @@ public class GLUT { dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; } - private static void diff3(float[] a, float[] b, float[] c) { + private static void diff3(final float[] a, final float[] b, final float[] c) { c[0] = a[0] - b[0]; c[1] = a[1] - b[1]; c[2] = a[2] - b[2]; } - private static void crossprod(float[] v1, float[] v2, float[] prod) { - float[] p = new float[3]; /* in case prod == v1 or v2 */ + private static void crossprod(final float[] v1, final float[] v2, final float[] prod) { + final float[] p = new float[3]; /* in case prod == v1 or v2 */ p[0] = v1[1] * v2[2] - v2[1] * v1[2]; p[1] = v1[2] * v2[0] - v2[2] * v1[0]; @@ -681,7 +682,7 @@ public class GLUT { prod[2] = p[2]; } - private static void normalize(float[] v) { + private static void normalize(final float[] v) { float d; d = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); @@ -694,10 +695,10 @@ public class GLUT { v[2] *= d; } - private void pentagon(GL2 gl, int a, int b, int c, int d, int e, int shadeType) { - float[] n0 = new float[3]; - float[] d1 = new float[3]; - float[] d2 = new float[3]; + private void pentagon(final GL2 gl, final int a, final int b, final int c, final int d, final int e, final int shadeType) { + final float[] n0 = new float[3]; + final float[] d1 = new float[3]; + final float[] d2 = new float[3]; diff3(dodec[a], dodec[b], d1); diff3(dodec[b], dodec[c], d2); @@ -714,7 +715,7 @@ public class GLUT { gl.glEnd(); } - private void dodecahedron(GL2 gl, int type) { + private void dodecahedron(final GL2 gl, final int type) { if (dodec == null) { initDodecahedron(); } @@ -732,9 +733,9 @@ public class GLUT { pentagon(gl, 4, 12, 5, 16, 17, type); } - private static void recorditem(GL2 gl, float[] n1, float[] n2, float[] n3, int shadeType) { - float[] q0 = new float[3]; - float[] q1 = new float[3]; + private static void recorditem(final GL2 gl, final float[] n1, final float[] n2, final float[] n3, final int shadeType) { + final float[] q0 = new float[3]; + final float[] q1 = new float[3]; diff3(n1, n2, q0); diff3(n2, n3, q1); @@ -749,11 +750,11 @@ public class GLUT { gl.glEnd(); } - private static void subdivide(GL2 gl, float[] v0, float[] v1, float[] v2, int shadeType) { + private static void subdivide(final GL2 gl, final float[] v0, final float[] v1, final float[] v2, final int shadeType) { int depth; - float[] w0 = new float[3]; - float[] w1 = new float[3]; - float[] w2 = new float[3]; + final float[] w0 = new float[3]; + final float[] w1 = new float[3]; + final float[] w2 = new float[3]; float l; int i, j, k, n; @@ -785,10 +786,10 @@ public class GLUT { } } - private static void drawtriangle(GL2 gl, int i, float[][] data, int[][] ndx, int shadeType) { - float[] x0 = data[ndx[i][0]]; - float[] x1 = data[ndx[i][1]]; - float[] x2 = data[ndx[i][2]]; + private static void drawtriangle(final GL2 gl, final int i, final float[][] data, final int[][] ndx, final int shadeType) { + final float[] x0 = data[ndx[i][0]]; + final float[] x1 = data[ndx[i][1]]; + final float[] x2 = data[ndx[i][2]]; subdivide(gl, x0, x1, x2, shadeType); } @@ -816,7 +817,7 @@ public class GLUT { {1, 3, 5} }; - private static void octahedron(GL2 gl, int shadeType) { + private static void octahedron(final GL2 gl, final int shadeType) { int i; for (i = 7; i >= 0; i--) { @@ -870,7 +871,7 @@ public class GLUT { {7, 2, 11}, }; - private static void icosahedron(GL2 gl, int shadeType) { + private static void icosahedron(final GL2 gl, final int shadeType) { int i; for (i = 19; i >= 0; i--) { @@ -950,7 +951,7 @@ public class GLUT { {1, 2, 3} }; - private static final void tetrahedron(GL2 gl, int shadeType) { + private static final void tetrahedron(final GL2 gl, final int shadeType) { for (int i = 3; i >= 0; i--) drawtriangle(gl, i, tdata, tndex, shadeType); } @@ -1112,28 +1113,28 @@ public class GLUT { 0, 0, 1, 0, 0, 1, 1, 1 }; - private static void teapot(GL2 gl, - int grid, - double scale, - int type, - boolean backCompatible) + private static void teapot(final GL2 gl, + final int grid, + final double scale, + final int type, + final boolean backCompatible) { // As mentioned above, GL2.glMap2f expects a packed array of floats - float[] p = new float[4*4*3]; - float[] q = new float[4*4*3]; - float[] r = new float[4*4*3]; - float[] s = new float[4*4*3]; + final float[] p = new float[4*4*3]; + final float[] q = new float[4*4*3]; + final float[] r = new float[4*4*3]; + final float[] s = new float[4*4*3]; int i, j, k, l; gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_EVAL_BIT | GL2.GL_POLYGON_BIT); gl.glEnable(GL2.GL_AUTO_NORMAL); - gl.glEnable(GL2.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); gl.glEnable(GL2.GL_MAP2_VERTEX_3); gl.glEnable(GL2.GL_MAP2_TEXTURE_COORD_2); gl.glPushMatrix(); if (!backCompatible) { // The time has come to have the teapot no longer be inside out - gl.glFrontFace(GL2.GL_CW); + gl.glFrontFace(GL.GL_CW); gl.glScaled(0.5*scale, 0.5*scale, 0.5*scale); } else { // We want the teapot in it's backward compatible position and @@ -1184,29 +1185,29 @@ public class GLUT { gl.glPopAttrib(); } - private static void evaluateTeapotMesh(GL2 gl, - int grid, - int type, - int partNum, - boolean repairSingularities) + private static void evaluateTeapotMesh(final GL2 gl, + final int grid, + final int type, + final int partNum, + final boolean repairSingularities) { if (repairSingularities && (partNum == 5 || partNum == 3)) { // Instead of using evaluators that give bad results at singularities, // evaluate by hand - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, type); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, type); for (int nv = 0; nv < grid; nv++) { if (nv == 0) { // Draw a small triangle-fan to fill the hole gl.glDisable(GL2.GL_AUTO_NORMAL); gl.glNormal3f(0, 0, partNum == 3 ? 1 : -1); - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); { gl.glEvalCoord2f(0, 0); // Note that we draw in clock-wise order to match the evaluator // method for (int nu = 0; nu <= grid; nu++) { - gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / (float)grid); + gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / grid); } } gl.glEnd(); @@ -1219,7 +1220,7 @@ public class GLUT { for (int nu = grid; nu >= 0; nu--) { gl.glEvalCoord2f(nu / (float)grid, (nv + 1) / (float)grid); gl.glEvalCoord2f(nu / (float)grid, Math.max(nv, 1f / grid) - / (float)grid); + / grid); } } gl.glEnd(); @@ -1233,13 +1234,13 @@ public class GLUT { // Font implementation // - private static void bitmapCharacterImpl(GL2 gl, int font, char cin) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = cin & 0xFFFF; + private static void bitmapCharacterImpl(final GL2 gl, final int font, final char cin) { + final BitmapFontRec fontinfo = getBitmapFont(font); + final int c = cin & 0xFFFF; if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) return; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) { gl.glBitmap(ch.width, ch.height, ch.xorig, ch.yorig, ch.advance, 0, ch.bitmap, 0); @@ -1249,7 +1250,7 @@ public class GLUT { private static final BitmapFontRec[] bitmapFonts = new BitmapFontRec[9]; private static final StrokeFontRec[] strokeFonts = new StrokeFontRec[9]; - private static BitmapFontRec getBitmapFont(int font) { + private static BitmapFontRec getBitmapFont(final int font) { BitmapFontRec rec = bitmapFonts[font]; if (rec == null) { switch (font) { @@ -1282,7 +1283,7 @@ public class GLUT { return rec; } - private static StrokeFontRec getStrokeFont(int font) { + private static StrokeFontRec getStrokeFont(final int font) { StrokeFontRec rec = strokeFonts[font]; if (rec == null) { switch (font) { @@ -1299,44 +1300,44 @@ public class GLUT { return rec; } - private static void beginBitmap(GL2 gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { - gl.glGetIntegerv(GL2.GL_UNPACK_SWAP_BYTES, swapbytes, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_LSB_FIRST, lsbfirst, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_ROW_LENGTH, rowlength, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_ROWS, skiprows, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_PIXELS, skippixels, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_ALIGNMENT, alignment, 0); + private static void beginBitmap(final GL2 gl, + final int[] swapbytes, + final int[] lsbfirst, + final int[] rowlength, + final int[] skiprows, + final int[] skippixels, + final int[] alignment) { + gl.glGetIntegerv(GL2GL3.GL_UNPACK_SWAP_BYTES, swapbytes, 0); + gl.glGetIntegerv(GL2GL3.GL_UNPACK_LSB_FIRST, lsbfirst, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlength, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, skiprows, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_PIXELS, skippixels, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, alignment, 0); /* Little endian machines (DEC Alpha for example) could benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE instead of GL_FALSE, but this would require changing the generated bitmaps too. */ - gl.glPixelStorei(GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE); - gl.glPixelStorei(GL2.GL_UNPACK_LSB_FIRST, GL2.GL_FALSE); - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, 0); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL2.GL_UNPACK_ALIGNMENT, 1); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE); + gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, GL.GL_FALSE); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, 0); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); } - private static void endBitmap(GL2 gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { + private static void endBitmap(final GL2 gl, + final int[] swapbytes, + final int[] lsbfirst, + final int[] rowlength, + final int[] skiprows, + final int[] skippixels, + final int[] alignment) { /* Restore saved modes. */ - gl.glPixelStorei(GL2.GL_UNPACK_SWAP_BYTES, swapbytes[0]); - gl.glPixelStorei(GL2.GL_UNPACK_LSB_FIRST, lsbfirst[0]); - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowlength[0]); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, skiprows[0]); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, skippixels[0]); - gl.glPixelStorei(GL2.GL_UNPACK_ALIGNMENT, alignment[0]); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, swapbytes[0]); + gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, lsbfirst[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlength[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, skiprows[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, skippixels[0]); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, alignment[0]); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java index 3587ca992..a191efdb4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java @@ -46,14 +46,14 @@ class GLUTStrokeMonoRoman { /* char: 33 '!' */ static final CoordRec char33_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, 100 ), new CoordRec((float) 52.381, (float) 33.3333 ), }; static final CoordRec char33_stroke1[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -66,12 +66,12 @@ static final StrokeRec char33[] = { /* char: 34 '"' */ static final CoordRec char34_stroke0[] = { - new CoordRec((float) 33.3334, (float) 100 ), + new CoordRec((float) 33.3334, 100 ), new CoordRec((float) 33.3334, (float) 66.6667 ), }; static final CoordRec char34_stroke1[] = { - new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), new CoordRec((float) 71.4286, (float) 66.6667 ), }; @@ -89,7 +89,7 @@ static final CoordRec char35_stroke0[] = { static final CoordRec char35_stroke1[] = { new CoordRec((float) 83.3334, (float) 119.048 ), - new CoordRec((float) 50, (float) -33.3333 ), + new CoordRec(50, (float) -33.3333 ), }; static final CoordRec char35_stroke2[] = { @@ -124,8 +124,8 @@ static final CoordRec char36_stroke1[] = { static final CoordRec char36_stroke2[] = { new CoordRec((float) 85.7143, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 19.0476, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -138,8 +138,8 @@ static final CoordRec char36_stroke2[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 85.7143, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 19.0476, (float) 14.2857 ), }; @@ -153,12 +153,12 @@ static final StrokeRec char36[] = { /* char: 37 '%' */ static final CoordRec char37_stroke0[] = { - new CoordRec((float) 95.2381, (float) 100 ), - new CoordRec((float) 9.5238, (float) 0 ), + new CoordRec((float) 95.2381, 100 ), + new CoordRec((float) 9.5238, 0 ), }; static final CoordRec char37_stroke1[] = { - new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 33.3333, 100 ), new CoordRec((float) 42.8571, (float) 90.4762 ), new CoordRec((float) 42.8571, (float) 80.9524 ), new CoordRec((float) 38.0952, (float) 71.4286 ), @@ -167,13 +167,13 @@ static final CoordRec char37_stroke1[] = { new CoordRec((float) 9.5238, (float) 76.1905 ), new CoordRec((float) 9.5238, (float) 85.7143 ), new CoordRec((float) 14.2857, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 33.3333, 100 ), new CoordRec((float) 42.8571, (float) 95.2381 ), new CoordRec((float) 57.1428, (float) 90.4762 ), new CoordRec((float) 71.4286, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 95.2381 ), - new CoordRec((float) 95.2381, (float) 100 ), + new CoordRec((float) 95.2381, 100 ), }; static final CoordRec char37_stroke2[] = { @@ -181,8 +181,8 @@ static final CoordRec char37_stroke2[] = { new CoordRec((float) 66.6667, (float) 28.5714 ), new CoordRec((float) 61.9048, (float) 19.0476 ), new CoordRec((float) 61.9048, (float) 9.5238 ), - new CoordRec((float) 71.4286, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), + new CoordRec((float) 80.9524, 0 ), new CoordRec((float) 90.4762, (float) 4.7619 ), new CoordRec((float) 95.2381, (float) 14.2857 ), new CoordRec((float) 95.2381, (float) 23.8095 ), @@ -199,8 +199,8 @@ static final StrokeRec char37[] = { /* char: 38 '&' */ static final CoordRec char38_stroke0[] = { - new CoordRec((float) 100, (float) 57.1429 ), - new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec(100, (float) 57.1429 ), + new CoordRec(100, (float) 61.9048 ), new CoordRec((float) 95.2381, (float) 66.6667 ), new CoordRec((float) 90.4762, (float) 66.6667 ), new CoordRec((float) 85.7143, (float) 61.9048 ), @@ -208,8 +208,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 71.4286, (float) 28.5714 ), new CoordRec((float) 61.9048, (float) 14.2857 ), new CoordRec((float) 52.3809, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 23.8095, 0 ), new CoordRec((float) 14.2857, (float) 4.7619 ), new CoordRec((float) 9.5238, (float) 9.5238 ), new CoordRec((float) 4.7619, (float) 19.0476 ), @@ -221,7 +221,7 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 57.1429, (float) 76.1905 ), new CoordRec((float) 57.1429, (float) 85.7143 ), new CoordRec((float) 52.3809, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 28.5714, (float) 85.7143 ), new CoordRec((float) 28.5714, (float) 76.1905 ), @@ -229,10 +229,10 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 42.8571, (float) 47.619 ), new CoordRec((float) 66.6667, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 85.7143, (float) 0 ), - new CoordRec((float) 95.2381, (float) 0 ), - new CoordRec((float) 100, (float) 4.7619 ), - new CoordRec((float) 100, (float) 9.5238 ), + new CoordRec((float) 85.7143, 0 ), + new CoordRec((float) 95.2381, 0 ), + new CoordRec(100, (float) 4.7619 ), + new CoordRec(100, (float) 9.5238 ), }; static final StrokeRec char38[] = { @@ -242,7 +242,7 @@ static final StrokeRec char38[] = { /* char: 39 ''' */ static final CoordRec char39_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, 100 ), new CoordRec((float) 52.381, (float) 66.6667 ), }; @@ -255,12 +255,12 @@ static final StrokeRec char39[] = { static final CoordRec char40_stroke0[] = { new CoordRec((float) 69.0476, (float) 119.048 ), new CoordRec((float) 59.5238, (float) 109.524 ), - new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec(50, (float) 95.2381 ), new CoordRec((float) 40.4762, (float) 76.1905 ), new CoordRec((float) 35.7143, (float) 52.381 ), new CoordRec((float) 35.7143, (float) 33.3333 ), new CoordRec((float) 40.4762, (float) 9.5238 ), - new CoordRec((float) 50, (float) -9.5238 ), + new CoordRec(50, (float) -9.5238 ), new CoordRec((float) 59.5238, (float) -23.8095 ), new CoordRec((float) 69.0476, (float) -33.3333 ), }; @@ -315,7 +315,7 @@ static final StrokeRec char42[] = { static final CoordRec char43_stroke0[] = { new CoordRec((float) 52.3809, (float) 85.7143 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char43_stroke1[] = { @@ -332,7 +332,7 @@ static final StrokeRec char43[] = { static final CoordRec char44_stroke0[] = { new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 47.6191, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 57.1429, (float) 4.7619 ), @@ -361,7 +361,7 @@ static final StrokeRec char45[] = { static final CoordRec char46_stroke0[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -374,7 +374,7 @@ static final StrokeRec char46[] = { static final CoordRec char47_stroke0[] = { new CoordRec((float) 19.0476, (float) -14.2857 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char47[] = { @@ -384,23 +384,23 @@ static final StrokeRec char47[] = { /* char: 48 '0' */ static final CoordRec char48_stroke0[] = { - new CoordRec((float) 47.619, (float) 100 ), + new CoordRec((float) 47.619, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 19.0476, (float) 57.1429 ), new CoordRec((float) 19.0476, (float) 42.8571 ), new CoordRec((float) 23.8095, (float) 19.0476 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 19.0476 ), new CoordRec((float) 85.7143, (float) 42.8571 ), new CoordRec((float) 85.7143, (float) 57.1429 ), new CoordRec((float) 80.9524, (float) 80.9524 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 57.1428, (float) 100 ), - new CoordRec((float) 47.619, (float) 100 ), + new CoordRec((float) 57.1428, 100 ), + new CoordRec((float) 47.619, 100 ), }; static final StrokeRec char48[] = { @@ -411,9 +411,9 @@ static final StrokeRec char48[] = { static final CoordRec char49_stroke0[] = { new CoordRec((float) 40.4762, (float) 80.9524 ), - new CoordRec((float) 50, (float) 85.7143 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec(50, (float) 85.7143 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 64.2857, 0 ), }; static final StrokeRec char49[] = { @@ -427,16 +427,16 @@ static final CoordRec char50_stroke0[] = { new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 28.5714, (float) 90.4762 ), new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 71.4286, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 90.4762 ), new CoordRec((float) 80.9524, (float) 80.9524 ), new CoordRec((float) 80.9524, (float) 71.4286 ), new CoordRec((float) 76.1905, (float) 61.9048 ), new CoordRec((float) 66.6666, (float) 47.619 ), - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char50[] = { @@ -446,8 +446,8 @@ static final StrokeRec char50[] = { /* char: 51 '3' */ static final CoordRec char51_stroke0[] = { - new CoordRec((float) 28.5714, (float) 100 ), - new CoordRec((float) 80.9524, (float) 100 ), + new CoordRec((float) 28.5714, 100 ), + new CoordRec((float) 80.9524, 100 ), new CoordRec((float) 52.3809, (float) 61.9048 ), new CoordRec((float) 66.6666, (float) 61.9048 ), new CoordRec((float) 76.1905, (float) 57.1429 ), @@ -456,8 +456,8 @@ static final CoordRec char51_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -470,14 +470,14 @@ static final StrokeRec char51[] = { /* char: 52 '4' */ static final CoordRec char52_stroke0[] = { - new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), new CoordRec((float) 16.6667, (float) 33.3333 ), new CoordRec((float) 88.0952, (float) 33.3333 ), }; static final CoordRec char52_stroke1[] = { - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 64.2857, 0 ), }; static final StrokeRec char52[] = { @@ -488,8 +488,8 @@ static final StrokeRec char52[] = { /* char: 53 '5' */ static final CoordRec char53_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), - new CoordRec((float) 28.5714, (float) 100 ), + new CoordRec((float) 76.1905, 100 ), + new CoordRec((float) 28.5714, 100 ), new CoordRec((float) 23.8095, (float) 57.1429 ), new CoordRec((float) 28.5714, (float) 61.9048 ), new CoordRec((float) 42.8571, (float) 66.6667 ), @@ -500,8 +500,8 @@ static final CoordRec char53_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -516,16 +516,16 @@ static final StrokeRec char53[] = { static final CoordRec char54_stroke0[] = { new CoordRec((float) 78.5714, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 59.5238, (float) 100 ), - new CoordRec((float) 50, (float) 100 ), + new CoordRec((float) 59.5238, 100 ), + new CoordRec(50, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 80.9524 ), new CoordRec((float) 21.4286, (float) 57.1429 ), new CoordRec((float) 21.4286, (float) 33.3333 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec(50, 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 69.0476, (float) 4.7619 ), new CoordRec((float) 78.5714, (float) 14.2857 ), new CoordRec((float) 83.3334, (float) 28.5714 ), @@ -533,7 +533,7 @@ static final CoordRec char54_stroke0[] = { new CoordRec((float) 78.5714, (float) 47.619 ), new CoordRec((float) 69.0476, (float) 57.1429 ), new CoordRec((float) 54.7619, (float) 61.9048 ), - new CoordRec((float) 50, (float) 61.9048 ), + new CoordRec(50, (float) 61.9048 ), new CoordRec((float) 35.7143, (float) 57.1429 ), new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 21.4286, (float) 33.3333 ), @@ -546,13 +546,13 @@ static final StrokeRec char54[] = { /* char: 55 '7' */ static final CoordRec char55_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 38.0952, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 38.0952, 0 ), }; static final CoordRec char55_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char55[] = { @@ -563,7 +563,7 @@ static final StrokeRec char55[] = { /* char: 56 '8' */ static final CoordRec char56_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 23.8095, (float) 76.1905 ), @@ -576,8 +576,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 85.7143, (float) 19.0476 ), new CoordRec((float) 80.9524, (float) 9.5238 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -590,8 +590,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 80.9524, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final StrokeRec char56[] = { @@ -605,23 +605,23 @@ static final CoordRec char57_stroke0[] = { new CoordRec((float) 78.5714, (float) 52.381 ), new CoordRec((float) 69.0476, (float) 42.8571 ), new CoordRec((float) 54.7619, (float) 38.0952 ), - new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec(50, (float) 38.0952 ), new CoordRec((float) 35.7143, (float) 42.8571 ), new CoordRec((float) 26.1905, (float) 52.381 ), new CoordRec((float) 21.4286, (float) 66.6667 ), new CoordRec((float) 21.4286, (float) 71.4286 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 50, (float) 100 ), - new CoordRec((float) 54.7619, (float) 100 ), + new CoordRec(50, 100 ), + new CoordRec((float) 54.7619, 100 ), new CoordRec((float) 69.0476, (float) 95.2381 ), new CoordRec((float) 78.5714, (float) 85.7143 ), new CoordRec((float) 83.3334, (float) 66.6667 ), new CoordRec((float) 83.3334, (float) 42.8571 ), new CoordRec((float) 78.5714, (float) 19.0476 ), new CoordRec((float) 69.0476, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), + new CoordRec((float) 45.2381, 0 ), new CoordRec((float) 30.9524, (float) 4.7619 ), new CoordRec((float) 26.1905, (float) 14.2857 ), }; @@ -643,7 +643,7 @@ static final CoordRec char58_stroke0[] = { static final CoordRec char58_stroke1[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -665,7 +665,7 @@ static final CoordRec char59_stroke0[] = { static final CoordRec char59_stroke1[] = { new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 47.6191, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 57.1429, (float) 4.7619 ), @@ -684,7 +684,7 @@ static final StrokeRec char59[] = { static final CoordRec char60_stroke0[] = { new CoordRec((float) 90.4762, (float) 85.7143 ), new CoordRec((float) 14.2857, (float) 42.8571 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 90.4762, 0 ), }; static final StrokeRec char60[] = { @@ -713,7 +713,7 @@ static final StrokeRec char61[] = { static final CoordRec char62_stroke0[] = { new CoordRec((float) 14.2857, (float) 85.7143 ), new CoordRec((float) 90.4762, (float) 42.8571 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 14.2857, 0 ), }; static final StrokeRec char62[] = { @@ -727,8 +727,8 @@ static final CoordRec char63_stroke0[] = { new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 28.5714, (float) 90.4762 ), new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 71.4285, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 90.4762 ), new CoordRec((float) 80.9524, (float) 80.9524 ), @@ -742,7 +742,7 @@ static final CoordRec char63_stroke0[] = { static final CoordRec char63_stroke1[] = { new CoordRec((float) 52.3809, (float) 9.5238 ), new CoordRec((float) 47.619, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), new CoordRec((float) 57.1428, (float) 4.7619 ), new CoordRec((float) 52.3809, (float) 9.5238 ), }; @@ -775,14 +775,14 @@ static final CoordRec char64_stroke1[] = { new CoordRec((float) 78.5714, (float) 61.9048 ), new CoordRec((float) 69.0476, (float) 71.4286 ), new CoordRec((float) 54.7619, (float) 76.1905 ), - new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec(50, (float) 76.1905 ), new CoordRec((float) 35.7143, (float) 71.4286 ), new CoordRec((float) 26.1905, (float) 61.9048 ), new CoordRec((float) 21.4286, (float) 47.619 ), new CoordRec((float) 21.4286, (float) 42.8571 ), new CoordRec((float) 26.1905, (float) 28.5714 ), new CoordRec((float) 35.7143, (float) 19.0476 ), - new CoordRec((float) 50, (float) 14.2857 ), + new CoordRec(50, (float) 14.2857 ), new CoordRec((float) 54.7619, (float) 14.2857 ), new CoordRec((float) 69.0476, (float) 19.0476 ), }; @@ -795,13 +795,13 @@ static final StrokeRec char64[] = { /* char: 65 'A' */ static final CoordRec char65_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 14.2857, 0 ), }; static final CoordRec char65_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 90.4762, 0 ), }; static final CoordRec char65_stroke2[] = { @@ -818,13 +818,13 @@ static final StrokeRec char65[] = { /* char: 66 'B' */ static final CoordRec char66_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char66_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -843,8 +843,8 @@ static final CoordRec char66_stroke2[] = { new CoordRec((float) 85.7143, (float) 19.0476 ), new CoordRec((float) 80.9524, (float) 9.5238 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char66[] = { @@ -859,8 +859,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 88.0952, (float) 76.1905 ), new CoordRec((float) 83.3334, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 21.4286, (float) 76.1905 ), @@ -869,8 +869,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 21.4286, (float) 23.8095 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 64.2857, 0 ), new CoordRec((float) 73.8096, (float) 4.7619 ), new CoordRec((float) 83.3334, (float) 14.2857 ), new CoordRec((float) 88.0952, (float) 23.8095 ), @@ -883,13 +883,13 @@ static final StrokeRec char67[] = { /* char: 68 'D' */ static final CoordRec char68_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char68_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 52.3809, 100 ), new CoordRec((float) 66.6666, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 85.7143 ), new CoordRec((float) 80.9524, (float) 76.1905 ), @@ -898,8 +898,8 @@ static final CoordRec char68_stroke1[] = { new CoordRec((float) 80.9524, (float) 23.8095 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char68[] = { @@ -910,13 +910,13 @@ static final StrokeRec char68[] = { /* char: 69 'E' */ static final CoordRec char69_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 21.4286, 0 ), }; static final CoordRec char69_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 83.3334, 100 ), }; static final CoordRec char69_stroke2[] = { @@ -925,8 +925,8 @@ static final CoordRec char69_stroke2[] = { }; static final CoordRec char69_stroke3[] = { - new CoordRec((float) 21.4286, (float) 0 ), - new CoordRec((float) 83.3334, (float) 0 ), + new CoordRec((float) 21.4286, 0 ), + new CoordRec((float) 83.3334, 0 ), }; static final StrokeRec char69[] = { @@ -939,13 +939,13 @@ static final StrokeRec char69[] = { /* char: 70 'F' */ static final CoordRec char70_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 21.4286, 0 ), }; static final CoordRec char70_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 83.3334, 100 ), }; static final CoordRec char70_stroke2[] = { @@ -965,8 +965,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 88.0952, (float) 76.1905 ), new CoordRec((float) 83.3334, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 21.4286, (float) 76.1905 ), @@ -975,8 +975,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 21.4286, (float) 23.8095 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 64.2857, 0 ), new CoordRec((float) 73.8096, (float) 4.7619 ), new CoordRec((float) 83.3334, (float) 14.2857 ), new CoordRec((float) 88.0952, (float) 23.8095 ), @@ -996,13 +996,13 @@ static final StrokeRec char71[] = { /* char: 72 'H' */ static final CoordRec char72_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char72_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char72_stroke2[] = { @@ -1019,8 +1019,8 @@ static final StrokeRec char72[] = { /* char: 73 'I' */ static final CoordRec char73_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 100 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char73[] = { @@ -1030,12 +1030,12 @@ static final StrokeRec char73[] = { /* char: 74 'J' */ static final CoordRec char74_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), + new CoordRec((float) 76.1905, 100 ), new CoordRec((float) 76.1905, (float) 23.8095 ), new CoordRec((float) 71.4286, (float) 9.5238 ), new CoordRec((float) 66.6667, (float) 4.7619 ), - new CoordRec((float) 57.1429, (float) 0 ), - new CoordRec((float) 47.6191, (float) 0 ), + new CoordRec((float) 57.1429, 0 ), + new CoordRec((float) 47.6191, 0 ), new CoordRec((float) 38.0953, (float) 4.7619 ), new CoordRec((float) 33.3334, (float) 9.5238 ), new CoordRec((float) 28.5715, (float) 23.8095 ), @@ -1049,18 +1049,18 @@ static final StrokeRec char74[] = { /* char: 75 'K' */ static final CoordRec char75_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char75_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), new CoordRec((float) 19.0476, (float) 33.3333 ), }; static final CoordRec char75_stroke2[] = { new CoordRec((float) 42.8571, (float) 57.1429 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char75[] = { @@ -1072,13 +1072,13 @@ static final StrokeRec char75[] = { /* char: 76 'L' */ static final CoordRec char76_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 23.8095, 0 ), }; static final CoordRec char76_stroke1[] = { - new CoordRec((float) 23.8095, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 23.8095, 0 ), + new CoordRec((float) 80.9524, 0 ), }; static final StrokeRec char76[] = { @@ -1089,23 +1089,23 @@ static final StrokeRec char76[] = { /* char: 77 'M' */ static final CoordRec char77_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 14.2857, 0 ), }; static final CoordRec char77_stroke1[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char77_stroke2[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char77_stroke3[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 90.4762, 0 ), }; static final StrokeRec char77[] = { @@ -1118,18 +1118,18 @@ static final StrokeRec char77[] = { /* char: 78 'N' */ static final CoordRec char78_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char78_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char78_stroke2[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char78[] = { @@ -1141,7 +1141,7 @@ static final StrokeRec char78[] = { /* char: 79 'O' */ static final CoordRec char79_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1150,8 +1150,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 23.8095 ), @@ -1160,8 +1160,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 85.7143, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final StrokeRec char79[] = { @@ -1171,13 +1171,13 @@ static final StrokeRec char79[] = { /* char: 80 'P' */ static final CoordRec char80_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char80_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -1196,7 +1196,7 @@ static final StrokeRec char80[] = { /* char: 81 'Q' */ static final CoordRec char81_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1205,8 +1205,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 23.8095 ), @@ -1215,8 +1215,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 85.7143, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final CoordRec char81_stroke1[] = { @@ -1232,13 +1232,13 @@ static final StrokeRec char81[] = { /* char: 82 'R' */ static final CoordRec char82_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char82_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -1251,7 +1251,7 @@ static final CoordRec char82_stroke1[] = { static final CoordRec char82_stroke2[] = { new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char82[] = { @@ -1265,8 +1265,8 @@ static final StrokeRec char82[] = { static final CoordRec char83_stroke0[] = { new CoordRec((float) 85.7143, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 19.0476, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1279,8 +1279,8 @@ static final CoordRec char83_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 85.7143, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 19.0476, (float) 14.2857 ), }; @@ -1292,13 +1292,13 @@ static final StrokeRec char83[] = { /* char: 84 'T' */ static final CoordRec char84_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char84_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char84[] = { @@ -1309,16 +1309,16 @@ static final StrokeRec char84[] = { /* char: 85 'U' */ static final CoordRec char85_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), new CoordRec((float) 19.0476, (float) 28.5714 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char85[] = { @@ -1328,13 +1328,13 @@ static final StrokeRec char85[] = { /* char: 86 'V' */ static final CoordRec char86_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char86_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final StrokeRec char86[] = { @@ -1345,23 +1345,23 @@ static final StrokeRec char86[] = { /* char: 87 'W' */ static final CoordRec char87_stroke0[] = { - new CoordRec((float) 4.7619, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), + new CoordRec((float) 4.7619, 100 ), + new CoordRec((float) 28.5714, 0 ), }; static final CoordRec char87_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 28.5714, 0 ), }; static final CoordRec char87_stroke2[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 76.1905, 0 ), }; static final CoordRec char87_stroke3[] = { - new CoordRec((float) 100, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), + new CoordRec(100, 100 ), + new CoordRec((float) 76.1905, 0 ), }; static final StrokeRec char87[] = { @@ -1374,13 +1374,13 @@ static final StrokeRec char87[] = { /* char: 88 'X' */ static final CoordRec char88_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char88_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char88[] = { @@ -1391,13 +1391,13 @@ static final StrokeRec char88[] = { /* char: 89 'Y' */ static final CoordRec char89_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 14.2857, 100 ), new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char89_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 90.4762, 100 ), new CoordRec((float) 52.3809, (float) 52.381 ), }; @@ -1409,18 +1409,18 @@ static final StrokeRec char89[] = { /* char: 90 'Z' */ static final CoordRec char90_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char90_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final CoordRec char90_stroke2[] = { - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char90[] = { @@ -1461,7 +1461,7 @@ static final StrokeRec char91[] = { /* char: 92 '\' */ static final CoordRec char92_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), new CoordRec((float) 85.7143, (float) -14.2857 ), }; @@ -1518,11 +1518,11 @@ static final StrokeRec char94[] = { /* char: 95 '_' */ static final CoordRec char95_stroke0[] = { - new CoordRec((float) 0, (float) -33.3333 ), + new CoordRec(0, (float) -33.3333 ), new CoordRec((float) 104.762, (float) -33.3333 ), new CoordRec((float) 104.762, (float) -28.5714 ), - new CoordRec((float) 0, (float) -28.5714 ), - new CoordRec((float) 0, (float) -33.3333 ), + new CoordRec(0, (float) -28.5714 ), + new CoordRec(0, (float) -33.3333 ), }; static final StrokeRec char95[] = { @@ -1532,12 +1532,12 @@ static final StrokeRec char95[] = { /* char: 96 '`' */ static final CoordRec char96_stroke0[] = { - new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 42.8572, 100 ), new CoordRec((float) 66.6667, (float) 71.4286 ), }; static final CoordRec char96_stroke1[] = { - new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 42.8572, 100 ), new CoordRec((float) 38.0953, (float) 95.2381 ), new CoordRec((float) 66.6667, (float) 71.4286 ), }; @@ -1551,7 +1551,7 @@ static final StrokeRec char96[] = { static final CoordRec char97_stroke0[] = { new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 80.9524, 0 ), }; static final CoordRec char97_stroke1[] = { @@ -1565,8 +1565,8 @@ static final CoordRec char97_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1579,8 +1579,8 @@ static final StrokeRec char97[] = { /* char: 98 'b' */ static final CoordRec char98_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 23.8095, 0 ), }; static final CoordRec char98_stroke1[] = { @@ -1594,8 +1594,8 @@ static final CoordRec char98_stroke1[] = { new CoordRec((float) 80.9524, (float) 28.5714 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 33.3333, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 14.2857 ), }; @@ -1618,8 +1618,8 @@ static final CoordRec char99_stroke0[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1631,8 +1631,8 @@ static final StrokeRec char99[] = { /* char: 100 'd' */ static final CoordRec char100_stroke0[] = { - new CoordRec((float) 80.9524, (float) 100 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 80.9524, 100 ), + new CoordRec((float) 80.9524, 0 ), }; static final CoordRec char100_stroke1[] = { @@ -1646,8 +1646,8 @@ static final CoordRec char100_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1673,8 +1673,8 @@ static final CoordRec char101_stroke0[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1686,11 +1686,11 @@ static final StrokeRec char101[] = { /* char: 102 'f' */ static final CoordRec char102_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), - new CoordRec((float) 61.9048, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), + new CoordRec((float) 61.9048, 100 ), new CoordRec((float) 52.381, (float) 95.2381 ), new CoordRec((float) 47.6191, (float) 80.9524 ), - new CoordRec((float) 47.6191, (float) 0 ), + new CoordRec((float) 47.6191, 0 ), }; static final CoordRec char102_stroke1[] = { @@ -1726,8 +1726,8 @@ static final CoordRec char103_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1740,18 +1740,18 @@ static final StrokeRec char103[] = { /* char: 104 'h' */ static final CoordRec char104_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 100 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char104_stroke1[] = { new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec(50, (float) 66.6667 ), new CoordRec((float) 64.2857, (float) 66.6667 ), new CoordRec((float) 73.8095, (float) 61.9048 ), new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char104[] = { @@ -1762,16 +1762,16 @@ static final StrokeRec char104[] = { /* char: 105 'i' */ static final CoordRec char105_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), new CoordRec((float) 52.381, (float) 95.2381 ), - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), new CoordRec((float) 52.381, (float) 104.762 ), - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), }; static final CoordRec char105_stroke1[] = { new CoordRec((float) 52.381, (float) 66.6667 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char105[] = { @@ -1782,11 +1782,11 @@ static final StrokeRec char105[] = { /* char: 106 'j' */ static final CoordRec char106_stroke0[] = { - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), new CoordRec((float) 61.9048, (float) 95.2381 ), - new CoordRec((float) 66.6667, (float) 100 ), + new CoordRec((float) 66.6667, 100 ), new CoordRec((float) 61.9048, (float) 104.762 ), - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), }; static final CoordRec char106_stroke1[] = { @@ -1805,8 +1805,8 @@ static final StrokeRec char106[] = { /* char: 107 'k' */ static final CoordRec char107_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 100 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char107_stroke1[] = { @@ -1816,7 +1816,7 @@ static final CoordRec char107_stroke1[] = { static final CoordRec char107_stroke2[] = { new CoordRec((float) 45.2381, (float) 38.0952 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char107[] = { @@ -1828,8 +1828,8 @@ static final StrokeRec char107[] = { /* char: 108 'l' */ static final CoordRec char108_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 100 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char108[] = { @@ -1839,18 +1839,18 @@ static final StrokeRec char108[] = { /* char: 109 'm' */ static final CoordRec char109_stroke0[] = { - new CoordRec((float) 0, (float) 66.6667 ), - new CoordRec((float) 0, (float) 0 ), + new CoordRec(0, (float) 66.6667 ), + new CoordRec(0, 0 ), }; static final CoordRec char109_stroke1[] = { - new CoordRec((float) 0, (float) 47.619 ), + new CoordRec(0, (float) 47.619 ), new CoordRec((float) 14.2857, (float) 61.9048 ), new CoordRec((float) 23.8095, (float) 66.6667 ), new CoordRec((float) 38.0952, (float) 66.6667 ), new CoordRec((float) 47.619, (float) 61.9048 ), new CoordRec((float) 52.381, (float) 47.619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), }; static final CoordRec char109_stroke2[] = { @@ -1858,9 +1858,9 @@ static final CoordRec char109_stroke2[] = { new CoordRec((float) 66.6667, (float) 61.9048 ), new CoordRec((float) 76.1905, (float) 66.6667 ), new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec(100, (float) 61.9048 ), new CoordRec((float) 104.762, (float) 47.619 ), - new CoordRec((float) 104.762, (float) 0 ), + new CoordRec((float) 104.762, 0 ), }; static final StrokeRec char109[] = { @@ -1873,17 +1873,17 @@ static final StrokeRec char109[] = { static final CoordRec char110_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char110_stroke1[] = { new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec(50, (float) 66.6667 ), new CoordRec((float) 64.2857, (float) 66.6667 ), new CoordRec((float) 73.8095, (float) 61.9048 ), new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char110[] = { @@ -1901,8 +1901,8 @@ static final CoordRec char111_stroke0[] = { new CoordRec((float) 21.4286, (float) 28.5714 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 59.5238, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 59.5238, 0 ), new CoordRec((float) 69.0476, (float) 4.7619 ), new CoordRec((float) 78.5714, (float) 14.2857 ), new CoordRec((float) 83.3334, (float) 28.5714 ), @@ -1935,8 +1935,8 @@ static final CoordRec char112_stroke1[] = { new CoordRec((float) 80.9524, (float) 28.5714 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 33.3333, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 14.2857 ), }; @@ -1964,8 +1964,8 @@ static final CoordRec char113_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1979,7 +1979,7 @@ static final StrokeRec char113[] = { static final CoordRec char114_stroke0[] = { new CoordRec((float) 33.3334, (float) 66.6667 ), - new CoordRec((float) 33.3334, (float) 0 ), + new CoordRec((float) 33.3334, 0 ), }; static final CoordRec char114_stroke1[] = { @@ -2011,8 +2011,8 @@ static final CoordRec char115_stroke0[] = { new CoordRec((float) 78.5715, (float) 19.0476 ), new CoordRec((float) 78.5715, (float) 14.2857 ), new CoordRec((float) 73.8095, (float) 4.7619 ), - new CoordRec((float) 59.5238, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 59.5238, 0 ), + new CoordRec((float) 45.2381, 0 ), new CoordRec((float) 30.9524, (float) 4.7619 ), new CoordRec((float) 26.1905, (float) 14.2857 ), }; @@ -2024,11 +2024,11 @@ static final StrokeRec char115[] = { /* char: 116 't' */ static final CoordRec char116_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), new CoordRec((float) 47.6191, (float) 19.0476 ), new CoordRec((float) 52.381, (float) 4.7619 ), - new CoordRec((float) 61.9048, (float) 0 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 61.9048, 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final CoordRec char116_stroke1[] = { @@ -2047,15 +2047,15 @@ static final CoordRec char117_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), new CoordRec((float) 26.1905, (float) 19.0476 ), new CoordRec((float) 30.9524, (float) 4.7619 ), - new CoordRec((float) 40.4762, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 40.4762, 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 64.2857, (float) 4.7619 ), new CoordRec((float) 78.5715, (float) 19.0476 ), }; static final CoordRec char117_stroke1[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char117[] = { @@ -2067,12 +2067,12 @@ static final StrokeRec char117[] = { static final CoordRec char118_stroke0[] = { new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char118_stroke1[] = { new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final StrokeRec char118[] = { @@ -2084,22 +2084,22 @@ static final StrokeRec char118[] = { static final CoordRec char119_stroke0[] = { new CoordRec((float) 14.2857, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), + new CoordRec((float) 33.3333, 0 ), }; static final CoordRec char119_stroke1[] = { new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), + new CoordRec((float) 33.3333, 0 ), }; static final CoordRec char119_stroke2[] = { new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final CoordRec char119_stroke3[] = { new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final StrokeRec char119[] = { @@ -2113,12 +2113,12 @@ static final StrokeRec char119[] = { static final CoordRec char120_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final CoordRec char120_stroke1[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final StrokeRec char120[] = { @@ -2130,12 +2130,12 @@ static final StrokeRec char120[] = { static final CoordRec char121_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), }; static final CoordRec char121_stroke1[] = { new CoordRec((float) 83.3334, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 45.2381, (float) -19.0476 ), new CoordRec((float) 35.7143, (float) -28.5714 ), new CoordRec((float) 26.1905, (float) -33.3333 ), @@ -2151,7 +2151,7 @@ static final StrokeRec char121[] = { static final CoordRec char122_stroke0[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char122_stroke1[] = { @@ -2160,8 +2160,8 @@ static final CoordRec char122_stroke1[] = { }; static final CoordRec char122_stroke2[] = { - new CoordRec((float) 26.1905, (float) 0 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char122[] = { @@ -2175,20 +2175,20 @@ static final StrokeRec char122[] = { static final CoordRec char123_stroke0[] = { new CoordRec((float) 64.2857, (float) 119.048 ), new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 109.524 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec(50, (float) 109.524 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 45.2381, (float) 90.4762 ), - new CoordRec((float) 50, (float) 80.9524 ), + new CoordRec(50, (float) 80.9524 ), new CoordRec((float) 54.7619, (float) 76.1905 ), new CoordRec((float) 59.5238, (float) 66.6667 ), new CoordRec((float) 59.5238, (float) 57.1429 ), - new CoordRec((float) 50, (float) 47.619 ), + new CoordRec(50, (float) 47.619 ), }; static final CoordRec char123_stroke1[] = { new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 104.762 ), - new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec(50, (float) 104.762 ), + new CoordRec(50, (float) 95.2381 ), new CoordRec((float) 54.7619, (float) 85.7143 ), new CoordRec((float) 59.5238, (float) 80.9524 ), new CoordRec((float) 64.2857, (float) 71.4286 ), @@ -2199,21 +2199,21 @@ static final CoordRec char123_stroke1[] = { new CoordRec((float) 64.2857, (float) 23.8095 ), new CoordRec((float) 64.2857, (float) 14.2857 ), new CoordRec((float) 59.5238, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 50, (float) -9.5238 ), - new CoordRec((float) 50, (float) -19.0476 ), + new CoordRec((float) 54.7619, 0 ), + new CoordRec(50, (float) -9.5238 ), + new CoordRec(50, (float) -19.0476 ), new CoordRec((float) 54.7619, (float) -28.5714 ), }; static final CoordRec char123_stroke2[] = { - new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec(50, (float) 38.0952 ), new CoordRec((float) 59.5238, (float) 28.5714 ), new CoordRec((float) 59.5238, (float) 19.0476 ), new CoordRec((float) 54.7619, (float) 9.5238 ), - new CoordRec((float) 50, (float) 4.7619 ), + new CoordRec(50, (float) 4.7619 ), new CoordRec((float) 45.2381, (float) -4.7619 ), new CoordRec((float) 45.2381, (float) -14.2857 ), - new CoordRec((float) 50, (float) -23.8095 ), + new CoordRec(50, (float) -23.8095 ), new CoordRec((float) 54.7619, (float) -28.5714 ), new CoordRec((float) 64.2857, (float) -33.3333 ), }; @@ -2239,22 +2239,22 @@ static final StrokeRec char124[] = { static final CoordRec char125_stroke0[] = { new CoordRec((float) 40.4762, (float) 119.048 ), - new CoordRec((float) 50, (float) 114.286 ), + new CoordRec(50, (float) 114.286 ), new CoordRec((float) 54.7619, (float) 109.524 ), - new CoordRec((float) 59.5238, (float) 100 ), + new CoordRec((float) 59.5238, 100 ), new CoordRec((float) 59.5238, (float) 90.4762 ), new CoordRec((float) 54.7619, (float) 80.9524 ), - new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec(50, (float) 76.1905 ), new CoordRec((float) 45.2381, (float) 66.6667 ), new CoordRec((float) 45.2381, (float) 57.1429 ), new CoordRec((float) 54.7619, (float) 47.619 ), }; static final CoordRec char125_stroke1[] = { - new CoordRec((float) 50, (float) 114.286 ), + new CoordRec(50, (float) 114.286 ), new CoordRec((float) 54.7619, (float) 104.762 ), new CoordRec((float) 54.7619, (float) 95.2381 ), - new CoordRec((float) 50, (float) 85.7143 ), + new CoordRec(50, (float) 85.7143 ), new CoordRec((float) 45.2381, (float) 80.9524 ), new CoordRec((float) 40.4762, (float) 71.4286 ), new CoordRec((float) 40.4762, (float) 61.9048 ), @@ -2264,22 +2264,22 @@ static final CoordRec char125_stroke1[] = { new CoordRec((float) 40.4762, (float) 23.8095 ), new CoordRec((float) 40.4762, (float) 14.2857 ), new CoordRec((float) 45.2381, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), + new CoordRec(50, 0 ), new CoordRec((float) 54.7619, (float) -9.5238 ), new CoordRec((float) 54.7619, (float) -19.0476 ), - new CoordRec((float) 50, (float) -28.5714 ), + new CoordRec(50, (float) -28.5714 ), }; static final CoordRec char125_stroke2[] = { new CoordRec((float) 54.7619, (float) 38.0952 ), new CoordRec((float) 45.2381, (float) 28.5714 ), new CoordRec((float) 45.2381, (float) 19.0476 ), - new CoordRec((float) 50, (float) 9.5238 ), + new CoordRec(50, (float) 9.5238 ), new CoordRec((float) 54.7619, (float) 4.7619 ), new CoordRec((float) 59.5238, (float) -4.7619 ), new CoordRec((float) 59.5238, (float) -14.2857 ), new CoordRec((float) 54.7619, (float) -23.8095 ), - new CoordRec((float) 50, (float) -28.5714 ), + new CoordRec(50, (float) -28.5714 ), new CoordRec((float) 40.4762, (float) -33.3333 ), }; @@ -2327,7 +2327,7 @@ static final StrokeRec char126[] = { /* char: 127 */ static final CoordRec char127_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), new CoordRec((float) 33.3333, (float) -33.3333 ), }; @@ -2339,8 +2339,8 @@ static final CoordRec char127_stroke1[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 28.5714 ), @@ -2357,38 +2357,38 @@ static final StrokeRec char127[] = { }; static final StrokeCharRec chars[] = { - new StrokeCharRec(0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char0 */ null, 0, 0 ), + new StrokeCharRec(0, /* char1 */ null, 0, 0 ), + new StrokeCharRec(0, /* char2 */ null, 0, 0 ), + new StrokeCharRec(0, /* char3 */ null, 0, 0 ), + new StrokeCharRec(0, /* char4 */ null, 0, 0 ), + new StrokeCharRec(0, /* char5 */ null, 0, 0 ), + new StrokeCharRec(0, /* char6 */ null, 0, 0 ), + new StrokeCharRec(0, /* char7 */ null, 0, 0 ), + new StrokeCharRec(0, /* char8 */ null, 0, 0 ), + new StrokeCharRec(0, /* char9 */ null, 0, 0 ), + new StrokeCharRec(0, /* char10 */ null, 0, 0 ), + new StrokeCharRec(0, /* char11 */ null, 0, 0 ), + new StrokeCharRec(0, /* char12 */ null, 0, 0 ), + new StrokeCharRec(0, /* char13 */ null, 0, 0 ), + new StrokeCharRec(0, /* char14 */ null, 0, 0 ), + new StrokeCharRec(0, /* char15 */ null, 0, 0 ), + new StrokeCharRec(0, /* char16 */ null, 0, 0 ), + new StrokeCharRec(0, /* char17 */ null, 0, 0 ), + new StrokeCharRec(0, /* char18 */ null, 0, 0 ), + new StrokeCharRec(0, /* char19 */ null, 0, 0 ), + new StrokeCharRec(0, /* char20 */ null, 0, 0 ), + new StrokeCharRec(0, /* char21 */ null, 0, 0 ), + new StrokeCharRec(0, /* char22 */ null, 0, 0 ), + new StrokeCharRec(0, /* char23 */ null, 0, 0 ), + new StrokeCharRec(0, /* char24 */ null, 0, 0 ), + new StrokeCharRec(0, /* char25 */ null, 0, 0 ), + new StrokeCharRec(0, /* char26 */ null, 0, 0 ), + new StrokeCharRec(0, /* char27 */ null, 0, 0 ), + new StrokeCharRec(0, /* char28 */ null, 0, 0 ), + new StrokeCharRec(0, /* char29 */ null, 0, 0 ), + new StrokeCharRec(0, /* char30 */ null, 0, 0 ), + new StrokeCharRec(0, /* char31 */ null, 0, 0 ), new StrokeCharRec(0, /* char32 */ null, (float) 52.381, (float) 104.762 ), new StrokeCharRec(2, char33, (float) 52.381, (float) 104.762 ), new StrokeCharRec(2, char34, (float) 52.381, (float) 104.762 ), diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java index cf51ddd3c..5b614c64e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java @@ -46,14 +46,14 @@ class GLUTStrokeRoman { /* char: 33 '!' */ static final CoordRec char33_stroke0[] = { - new CoordRec((float) 13.3819, (float) 100), + new CoordRec((float) 13.3819, 100), new CoordRec((float) 13.3819, (float) 33.3333), }; static final CoordRec char33_stroke1[] = { new CoordRec((float) 13.3819, (float) 9.5238), new CoordRec((float) 8.62, (float) 4.7619), - new CoordRec((float) 13.3819, (float) 0), + new CoordRec((float) 13.3819, 0), new CoordRec((float) 18.1438, (float) 4.7619), new CoordRec((float) 13.3819, (float) 9.5238), }; @@ -66,12 +66,12 @@ static final StrokeRec char33[] = { /* char: 34 '"' */ static final CoordRec char34_stroke0[] = { - new CoordRec((float) 4.02, (float) 100), + new CoordRec((float) 4.02, 100), new CoordRec((float) 4.02, (float) 66.6667), }; static final CoordRec char34_stroke1[] = { - new CoordRec((float) 42.1152, (float) 100), + new CoordRec((float) 42.1152, 100), new CoordRec((float) 42.1152, (float) 66.6667), }; @@ -124,8 +124,8 @@ static final CoordRec char36_stroke1[] = { static final CoordRec char36_stroke2[] = { new CoordRec((float) 71.4867, (float) 85.7143), new CoordRec((float) 61.9629, (float) 95.2381), - new CoordRec((float) 47.6771, (float) 100), - new CoordRec((float) 28.6295, (float) 100), + new CoordRec((float) 47.6771, 100), + new CoordRec((float) 28.6295, 100), new CoordRec((float) 14.3438, (float) 95.2381), new CoordRec((float) 4.82, (float) 85.7143), new CoordRec((float) 4.82, (float) 76.1905), @@ -138,8 +138,8 @@ static final CoordRec char36_stroke2[] = { new CoordRec((float) 71.4867, (float) 28.5714), new CoordRec((float) 71.4867, (float) 14.2857), new CoordRec((float) 61.9629, (float) 4.7619), - new CoordRec((float) 47.6771, (float) 0), - new CoordRec((float) 28.6295, (float) 0), + new CoordRec((float) 47.6771, 0), + new CoordRec((float) 28.6295, 0), new CoordRec((float) 14.3438, (float) 4.7619), new CoordRec((float) 4.82, (float) 14.2857), }; @@ -153,12 +153,12 @@ static final StrokeRec char36[] = { /* char: 37 '%' */ static final CoordRec char37_stroke0[] = { - new CoordRec((float) 92.0743, (float) 100), - new CoordRec((float) 6.36, (float) 0), + new CoordRec((float) 92.0743, 100), + new CoordRec((float) 6.36, 0), }; static final CoordRec char37_stroke1[] = { - new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 30.1695, 100), new CoordRec((float) 39.6933, (float) 90.4762), new CoordRec((float) 39.6933, (float) 80.9524), new CoordRec((float) 34.9314, (float) 71.4286), @@ -167,13 +167,13 @@ static final CoordRec char37_stroke1[] = { new CoordRec((float) 6.36, (float) 76.1905), new CoordRec((float) 6.36, (float) 85.7143), new CoordRec((float) 11.1219, (float) 95.2381), - new CoordRec((float) 20.6457, (float) 100), - new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 20.6457, 100), + new CoordRec((float) 30.1695, 100), new CoordRec((float) 39.6933, (float) 95.2381), new CoordRec((float) 53.979, (float) 90.4762), new CoordRec((float) 68.2648, (float) 90.4762), new CoordRec((float) 82.5505, (float) 95.2381), - new CoordRec((float) 92.0743, (float) 100), + new CoordRec((float) 92.0743, 100), }; static final CoordRec char37_stroke2[] = { @@ -181,8 +181,8 @@ static final CoordRec char37_stroke2[] = { new CoordRec((float) 63.5029, (float) 28.5714), new CoordRec((float) 58.741, (float) 19.0476), new CoordRec((float) 58.741, (float) 9.5238), - new CoordRec((float) 68.2648, (float) 0), - new CoordRec((float) 77.7886, (float) 0), + new CoordRec((float) 68.2648, 0), + new CoordRec((float) 77.7886, 0), new CoordRec((float) 87.3124, (float) 4.7619), new CoordRec((float) 92.0743, (float) 14.2857), new CoordRec((float) 92.0743, (float) 23.8095), @@ -208,8 +208,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 72.6467, (float) 28.5714), new CoordRec((float) 63.1229, (float) 14.2857), new CoordRec((float) 53.599, (float) 4.7619), - new CoordRec((float) 44.0752, (float) 0), - new CoordRec((float) 25.0276, (float) 0), + new CoordRec((float) 44.0752, 0), + new CoordRec((float) 25.0276, 0), new CoordRec((float) 15.5038, (float) 4.7619), new CoordRec((float) 10.7419, (float) 9.5238), new CoordRec((float) 5.98, (float) 19.0476), @@ -221,7 +221,7 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 58.361, (float) 76.1905), new CoordRec((float) 58.361, (float) 85.7143), new CoordRec((float) 53.599, (float) 95.2381), - new CoordRec((float) 44.0752, (float) 100), + new CoordRec((float) 44.0752, 100), new CoordRec((float) 34.5514, (float) 95.2381), new CoordRec((float) 29.7895, (float) 85.7143), new CoordRec((float) 29.7895, (float) 76.1905), @@ -229,8 +229,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 44.0752, (float) 47.619), new CoordRec((float) 67.8848, (float) 14.2857), new CoordRec((float) 77.4086, (float) 4.7619), - new CoordRec((float) 86.9324, (float) 0), - new CoordRec((float) 96.4562, (float) 0), + new CoordRec((float) 86.9324, 0), + new CoordRec((float) 96.4562, 0), new CoordRec((float) 101.218, (float) 4.7619), new CoordRec((float) 101.218, (float) 9.5238), }; @@ -242,7 +242,7 @@ static final StrokeRec char38[] = { /* char: 39 ''' */ static final CoordRec char39_stroke0[] = { - new CoordRec((float) 4.44, (float) 100), + new CoordRec((float) 4.44, 100), new CoordRec((float) 4.44, (float) 66.6667), }; @@ -315,7 +315,7 @@ static final StrokeRec char42[] = { static final CoordRec char43_stroke0[] = { new CoordRec((float) 48.8371, (float) 85.7143), - new CoordRec((float) 48.8371, (float) 0), + new CoordRec((float) 48.8371, 0), }; static final CoordRec char43_stroke1[] = { @@ -332,7 +332,7 @@ static final StrokeRec char43[] = { static final CoordRec char44_stroke0[] = { new CoordRec((float) 18.2838, (float) 4.7619), - new CoordRec((float) 13.5219, (float) 0), + new CoordRec((float) 13.5219, 0), new CoordRec((float) 8.76, (float) 4.7619), new CoordRec((float) 13.5219, (float) 9.5238), new CoordRec((float) 18.2838, (float) 4.7619), @@ -361,7 +361,7 @@ static final StrokeRec char45[] = { static final CoordRec char46_stroke0[] = { new CoordRec((float) 13.1019, (float) 9.5238), new CoordRec((float) 8.34, (float) 4.7619), - new CoordRec((float) 13.1019, (float) 0), + new CoordRec((float) 13.1019, 0), new CoordRec((float) 17.8638, (float) 4.7619), new CoordRec((float) 13.1019, (float) 9.5238), }; @@ -374,7 +374,7 @@ static final StrokeRec char46[] = { static final CoordRec char47_stroke0[] = { new CoordRec((float) 7.24, (float) -14.2857), - new CoordRec((float) 73.9067, (float) 100), + new CoordRec((float) 73.9067, 100), }; static final StrokeRec char47[] = { @@ -384,23 +384,23 @@ static final StrokeRec char47[] = { /* char: 48 '0' */ static final CoordRec char48_stroke0[] = { - new CoordRec((float) 33.5514, (float) 100), + new CoordRec((float) 33.5514, 100), new CoordRec((float) 19.2657, (float) 95.2381), new CoordRec((float) 9.7419, (float) 80.9524), new CoordRec((float) 4.98, (float) 57.1429), new CoordRec((float) 4.98, (float) 42.8571), new CoordRec((float) 9.7419, (float) 19.0476), new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 33.5514, (float) 0), - new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 33.5514, 0), + new CoordRec((float) 43.0752, 0), new CoordRec((float) 57.361, (float) 4.7619), new CoordRec((float) 66.8848, (float) 19.0476), new CoordRec((float) 71.6467, (float) 42.8571), new CoordRec((float) 71.6467, (float) 57.1429), new CoordRec((float) 66.8848, (float) 80.9524), new CoordRec((float) 57.361, (float) 95.2381), - new CoordRec((float) 43.0752, (float) 100), - new CoordRec((float) 33.5514, (float) 100), + new CoordRec((float) 43.0752, 100), + new CoordRec((float) 33.5514, 100), }; static final StrokeRec char48[] = { @@ -412,8 +412,8 @@ static final StrokeRec char48[] = { static final CoordRec char49_stroke0[] = { new CoordRec((float) 11.82, (float) 80.9524), new CoordRec((float) 21.3438, (float) 85.7143), - new CoordRec((float) 35.6295, (float) 100), - new CoordRec((float) 35.6295, (float) 0), + new CoordRec((float) 35.6295, 100), + new CoordRec((float) 35.6295, 0), }; static final StrokeRec char49[] = { @@ -427,16 +427,16 @@ static final CoordRec char50_stroke0[] = { new CoordRec((float) 10.1819, (float) 80.9524), new CoordRec((float) 14.9438, (float) 90.4762), new CoordRec((float) 19.7057, (float) 95.2381), - new CoordRec((float) 29.2295, (float) 100), - new CoordRec((float) 48.2771, (float) 100), + new CoordRec((float) 29.2295, 100), + new CoordRec((float) 48.2771, 100), new CoordRec((float) 57.801, (float) 95.2381), new CoordRec((float) 62.5629, (float) 90.4762), new CoordRec((float) 67.3248, (float) 80.9524), new CoordRec((float) 67.3248, (float) 71.4286), new CoordRec((float) 62.5629, (float) 61.9048), new CoordRec((float) 53.039, (float) 47.619), - new CoordRec((float) 5.42, (float) 0), - new CoordRec((float) 72.0867, (float) 0), + new CoordRec((float) 5.42, 0), + new CoordRec((float) 72.0867, 0), }; static final StrokeRec char50[] = { @@ -446,8 +446,8 @@ static final StrokeRec char50[] = { /* char: 51 '3' */ static final CoordRec char51_stroke0[] = { - new CoordRec((float) 14.5238, (float) 100), - new CoordRec((float) 66.9048, (float) 100), + new CoordRec((float) 14.5238, 100), + new CoordRec((float) 66.9048, 100), new CoordRec((float) 38.3333, (float) 61.9048), new CoordRec((float) 52.619, (float) 61.9048), new CoordRec((float) 62.1429, (float) 57.1429), @@ -456,11 +456,11 @@ static final CoordRec char51_stroke0[] = { new CoordRec((float) 71.6667, (float) 28.5714), new CoordRec((float) 66.9048, (float) 14.2857), new CoordRec((float) 57.381, (float) 4.7619), - new CoordRec((float) 43.0952, (float) 0), - new CoordRec((float) 28.8095, (float) 0), + new CoordRec((float) 43.0952, 0), + new CoordRec((float) 28.8095, 0), new CoordRec((float) 14.5238, (float) 4.7619), new CoordRec((float) 9.7619, (float) 9.5238), - new CoordRec((float) 5, (float) 19.0476), + new CoordRec(5, (float) 19.0476), }; static final StrokeRec char51[] = { @@ -470,14 +470,14 @@ static final StrokeRec char51[] = { /* char: 52 '4' */ static final CoordRec char52_stroke0[] = { - new CoordRec((float) 51.499, (float) 100), + new CoordRec((float) 51.499, 100), new CoordRec((float) 3.88, (float) 33.3333), new CoordRec((float) 75.3086, (float) 33.3333), }; static final CoordRec char52_stroke1[] = { - new CoordRec((float) 51.499, (float) 100), - new CoordRec((float) 51.499, (float) 0), + new CoordRec((float) 51.499, 100), + new CoordRec((float) 51.499, 0), }; static final StrokeRec char52[] = { @@ -488,8 +488,8 @@ static final StrokeRec char52[] = { /* char: 53 '5' */ static final CoordRec char53_stroke0[] = { - new CoordRec((float) 62.0029, (float) 100), - new CoordRec((float) 14.3838, (float) 100), + new CoordRec((float) 62.0029, 100), + new CoordRec((float) 14.3838, 100), new CoordRec((float) 9.6219, (float) 57.1429), new CoordRec((float) 14.3838, (float) 61.9048), new CoordRec((float) 28.6695, (float) 66.6667), @@ -500,8 +500,8 @@ static final CoordRec char53_stroke0[] = { new CoordRec((float) 71.5267, (float) 28.5714), new CoordRec((float) 66.7648, (float) 14.2857), new CoordRec((float) 57.241, (float) 4.7619), - new CoordRec((float) 42.9552, (float) 0), - new CoordRec((float) 28.6695, (float) 0), + new CoordRec((float) 42.9552, 0), + new CoordRec((float) 28.6695, 0), new CoordRec((float) 14.3838, (float) 4.7619), new CoordRec((float) 9.6219, (float) 9.5238), new CoordRec((float) 4.86, (float) 19.0476), @@ -516,16 +516,16 @@ static final StrokeRec char53[] = { static final CoordRec char54_stroke0[] = { new CoordRec((float) 62.7229, (float) 85.7143), new CoordRec((float) 57.961, (float) 95.2381), - new CoordRec((float) 43.6752, (float) 100), - new CoordRec((float) 34.1514, (float) 100), + new CoordRec((float) 43.6752, 100), + new CoordRec((float) 34.1514, 100), new CoordRec((float) 19.8657, (float) 95.2381), new CoordRec((float) 10.3419, (float) 80.9524), new CoordRec((float) 5.58, (float) 57.1429), new CoordRec((float) 5.58, (float) 33.3333), new CoordRec((float) 10.3419, (float) 14.2857), new CoordRec((float) 19.8657, (float) 4.7619), - new CoordRec((float) 34.1514, (float) 0), - new CoordRec((float) 38.9133, (float) 0), + new CoordRec((float) 34.1514, 0), + new CoordRec((float) 38.9133, 0), new CoordRec((float) 53.199, (float) 4.7619), new CoordRec((float) 62.7229, (float) 14.2857), new CoordRec((float) 67.4848, (float) 28.5714), @@ -546,13 +546,13 @@ static final StrokeRec char54[] = { /* char: 55 '7' */ static final CoordRec char55_stroke0[] = { - new CoordRec((float) 72.2267, (float) 100), - new CoordRec((float) 24.6076, (float) 0), + new CoordRec((float) 72.2267, 100), + new CoordRec((float) 24.6076, 0), }; static final CoordRec char55_stroke1[] = { - new CoordRec((float) 5.56, (float) 100), - new CoordRec((float) 72.2267, (float) 100), + new CoordRec((float) 5.56, 100), + new CoordRec((float) 72.2267, 100), }; static final StrokeRec char55[] = { @@ -563,7 +563,7 @@ static final StrokeRec char55[] = { /* char: 56 '8' */ static final CoordRec char56_stroke0[] = { - new CoordRec((float) 29.4095, (float) 100), + new CoordRec((float) 29.4095, 100), new CoordRec((float) 15.1238, (float) 95.2381), new CoordRec((float) 10.3619, (float) 85.7143), new CoordRec((float) 10.3619, (float) 76.1905), @@ -576,8 +576,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 72.2667, (float) 19.0476), new CoordRec((float) 67.5048, (float) 9.5238), new CoordRec((float) 62.7429, (float) 4.7619), - new CoordRec((float) 48.4571, (float) 0), - new CoordRec((float) 29.4095, (float) 0), + new CoordRec((float) 48.4571, 0), + new CoordRec((float) 29.4095, 0), new CoordRec((float) 15.1238, (float) 4.7619), new CoordRec((float) 10.3619, (float) 9.5238), new CoordRec((float) 5.6, (float) 19.0476), @@ -590,8 +590,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 67.5048, (float) 76.1905), new CoordRec((float) 67.5048, (float) 85.7143), new CoordRec((float) 62.7429, (float) 95.2381), - new CoordRec((float) 48.4571, (float) 100), - new CoordRec((float) 29.4095, (float) 100), + new CoordRec((float) 48.4571, 100), + new CoordRec((float) 29.4095, 100), }; static final StrokeRec char56[] = { @@ -612,16 +612,16 @@ static final CoordRec char57_stroke0[] = { new CoordRec((float) 6.6, (float) 71.4286), new CoordRec((float) 11.3619, (float) 85.7143), new CoordRec((float) 20.8857, (float) 95.2381), - new CoordRec((float) 35.1714, (float) 100), - new CoordRec((float) 39.9333, (float) 100), + new CoordRec((float) 35.1714, 100), + new CoordRec((float) 39.9333, 100), new CoordRec((float) 54.219, (float) 95.2381), new CoordRec((float) 63.7429, (float) 85.7143), new CoordRec((float) 68.5048, (float) 66.6667), new CoordRec((float) 68.5048, (float) 42.8571), new CoordRec((float) 63.7429, (float) 19.0476), new CoordRec((float) 54.219, (float) 4.7619), - new CoordRec((float) 39.9333, (float) 0), - new CoordRec((float) 30.4095, (float) 0), + new CoordRec((float) 39.9333, 0), + new CoordRec((float) 30.4095, 0), new CoordRec((float) 16.1238, (float) 4.7619), new CoordRec((float) 11.3619, (float) 14.2857), }; @@ -643,7 +643,7 @@ static final CoordRec char58_stroke0[] = { static final CoordRec char58_stroke1[] = { new CoordRec((float) 14.0819, (float) 9.5238), new CoordRec((float) 9.32, (float) 4.7619), - new CoordRec((float) 14.0819, (float) 0), + new CoordRec((float) 14.0819, 0), new CoordRec((float) 18.8438, (float) 4.7619), new CoordRec((float) 14.0819, (float) 9.5238), }; @@ -665,7 +665,7 @@ static final CoordRec char59_stroke0[] = { static final CoordRec char59_stroke1[] = { new CoordRec((float) 17.7238, (float) 4.7619), - new CoordRec((float) 12.9619, (float) 0), + new CoordRec((float) 12.9619, 0), new CoordRec((float) 8.2, (float) 4.7619), new CoordRec((float) 12.9619, (float) 9.5238), new CoordRec((float) 17.7238, (float) 4.7619), @@ -684,7 +684,7 @@ static final StrokeRec char59[] = { static final CoordRec char60_stroke0[] = { new CoordRec((float) 79.2505, (float) 85.7143), new CoordRec((float) 3.06, (float) 42.8571), - new CoordRec((float) 79.2505, (float) 0), + new CoordRec((float) 79.2505, 0), }; static final StrokeRec char60[] = { @@ -713,7 +713,7 @@ static final StrokeRec char61[] = { static final CoordRec char62_stroke0[] = { new CoordRec((float) 2.78, (float) 85.7143), new CoordRec((float) 78.9705, (float) 42.8571), - new CoordRec((float) 2.78, (float) 0), + new CoordRec((float) 2.78, 0), }; static final StrokeRec char62[] = { @@ -727,8 +727,8 @@ static final CoordRec char63_stroke0[] = { new CoordRec((float) 8.42, (float) 80.9524), new CoordRec((float) 13.1819, (float) 90.4762), new CoordRec((float) 17.9438, (float) 95.2381), - new CoordRec((float) 27.4676, (float) 100), - new CoordRec((float) 46.5152, (float) 100), + new CoordRec((float) 27.4676, 100), + new CoordRec((float) 46.5152, 100), new CoordRec((float) 56.039, (float) 95.2381), new CoordRec((float) 60.801, (float) 90.4762), new CoordRec((float) 65.5629, (float) 80.9524), @@ -742,7 +742,7 @@ static final CoordRec char63_stroke0[] = { static final CoordRec char63_stroke1[] = { new CoordRec((float) 36.9914, (float) 9.5238), new CoordRec((float) 32.2295, (float) 4.7619), - new CoordRec((float) 36.9914, (float) 0), + new CoordRec((float) 36.9914, 0), new CoordRec((float) 41.7533, (float) 4.7619), new CoordRec((float) 36.9914, (float) 9.5238), }; @@ -795,13 +795,13 @@ static final StrokeRec char64[] = { /* char: 65 'A' */ static final CoordRec char65_stroke0[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 40.5952, 100), + new CoordRec((float) 2.5, 0), }; static final CoordRec char65_stroke1[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 78.6905, (float) 0), + new CoordRec((float) 40.5952, 100), + new CoordRec((float) 78.6905, 0), }; static final CoordRec char65_stroke2[] = { @@ -818,13 +818,13 @@ static final StrokeRec char65[] = { /* char: 66 'B' */ static final CoordRec char66_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char66_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 54.2771, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 54.2771, 100), new CoordRec((float) 68.5629, (float) 95.2381), new CoordRec((float) 73.3248, (float) 90.4762), new CoordRec((float) 78.0867, (float) 80.9524), @@ -843,8 +843,8 @@ static final CoordRec char66_stroke2[] = { new CoordRec((float) 78.0867, (float) 19.0476), new CoordRec((float) 73.3248, (float) 9.5238), new CoordRec((float) 68.5629, (float) 4.7619), - new CoordRec((float) 54.2771, (float) 0), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 54.2771, 0), + new CoordRec((float) 11.42, 0), }; static final StrokeRec char66[] = { @@ -859,8 +859,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 78.0886, (float) 76.1905), new CoordRec((float) 73.3267, (float) 85.7143), new CoordRec((float) 63.8029, (float) 95.2381), - new CoordRec((float) 54.279, (float) 100), - new CoordRec((float) 35.2314, (float) 100), + new CoordRec((float) 54.279, 100), + new CoordRec((float) 35.2314, 100), new CoordRec((float) 25.7076, (float) 95.2381), new CoordRec((float) 16.1838, (float) 85.7143), new CoordRec((float) 11.4219, (float) 76.1905), @@ -869,8 +869,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 11.4219, (float) 23.8095), new CoordRec((float) 16.1838, (float) 14.2857), new CoordRec((float) 25.7076, (float) 4.7619), - new CoordRec((float) 35.2314, (float) 0), - new CoordRec((float) 54.279, (float) 0), + new CoordRec((float) 35.2314, 0), + new CoordRec((float) 54.279, 0), new CoordRec((float) 63.8029, (float) 4.7619), new CoordRec((float) 73.3267, (float) 14.2857), new CoordRec((float) 78.0886, (float) 23.8095), @@ -883,13 +883,13 @@ static final StrokeRec char67[] = { /* char: 68 'D' */ static final CoordRec char68_stroke0[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 11.96, (float) 0), + new CoordRec((float) 11.96, 100), + new CoordRec((float) 11.96, 0), }; static final CoordRec char68_stroke1[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 45.2933, (float) 100), + new CoordRec((float) 11.96, 100), + new CoordRec((float) 45.2933, 100), new CoordRec((float) 59.579, (float) 95.2381), new CoordRec((float) 69.1029, (float) 85.7143), new CoordRec((float) 73.8648, (float) 76.1905), @@ -898,8 +898,8 @@ static final CoordRec char68_stroke1[] = { new CoordRec((float) 73.8648, (float) 23.8095), new CoordRec((float) 69.1029, (float) 14.2857), new CoordRec((float) 59.579, (float) 4.7619), - new CoordRec((float) 45.2933, (float) 0), - new CoordRec((float) 11.96, (float) 0), + new CoordRec((float) 45.2933, 0), + new CoordRec((float) 11.96, 0), }; static final StrokeRec char68[] = { @@ -910,13 +910,13 @@ static final StrokeRec char68[] = { /* char: 69 'E' */ static final CoordRec char69_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char69_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 73.3248, 100), }; static final CoordRec char69_stroke2[] = { @@ -925,8 +925,8 @@ static final CoordRec char69_stroke2[] = { }; static final CoordRec char69_stroke3[] = { - new CoordRec((float) 11.42, (float) 0), - new CoordRec((float) 73.3248, (float) 0), + new CoordRec((float) 11.42, 0), + new CoordRec((float) 73.3248, 0), }; static final StrokeRec char69[] = { @@ -939,13 +939,13 @@ static final StrokeRec char69[] = { /* char: 70 'F' */ static final CoordRec char70_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char70_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 73.3248, 100), }; static final CoordRec char70_stroke2[] = { @@ -965,8 +965,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 78.4886, (float) 76.1905), new CoordRec((float) 73.7267, (float) 85.7143), new CoordRec((float) 64.2029, (float) 95.2381), - new CoordRec((float) 54.679, (float) 100), - new CoordRec((float) 35.6314, (float) 100), + new CoordRec((float) 54.679, 100), + new CoordRec((float) 35.6314, 100), new CoordRec((float) 26.1076, (float) 95.2381), new CoordRec((float) 16.5838, (float) 85.7143), new CoordRec((float) 11.8219, (float) 76.1905), @@ -975,8 +975,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 11.8219, (float) 23.8095), new CoordRec((float) 16.5838, (float) 14.2857), new CoordRec((float) 26.1076, (float) 4.7619), - new CoordRec((float) 35.6314, (float) 0), - new CoordRec((float) 54.679, (float) 0), + new CoordRec((float) 35.6314, 0), + new CoordRec((float) 54.679, 0), new CoordRec((float) 64.2029, (float) 4.7619), new CoordRec((float) 73.7267, (float) 14.2857), new CoordRec((float) 78.4886, (float) 23.8095), @@ -996,13 +996,13 @@ static final StrokeRec char71[] = { /* char: 72 'H' */ static final CoordRec char72_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char72_stroke1[] = { - new CoordRec((float) 78.0867, (float) 100), - new CoordRec((float) 78.0867, (float) 0), + new CoordRec((float) 78.0867, 100), + new CoordRec((float) 78.0867, 0), }; static final CoordRec char72_stroke2[] = { @@ -1019,8 +1019,8 @@ static final StrokeRec char72[] = { /* char: 73 'I' */ static final CoordRec char73_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 10.86, 0), }; static final StrokeRec char73[] = { @@ -1030,12 +1030,12 @@ static final StrokeRec char73[] = { /* char: 74 'J' */ static final CoordRec char74_stroke0[] = { - new CoordRec((float) 50.119, (float) 100), + new CoordRec((float) 50.119, 100), new CoordRec((float) 50.119, (float) 23.8095), new CoordRec((float) 45.3571, (float) 9.5238), new CoordRec((float) 40.5952, (float) 4.7619), - new CoordRec((float) 31.0714, (float) 0), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 31.0714, 0), + new CoordRec((float) 21.5476, 0), new CoordRec((float) 12.0238, (float) 4.7619), new CoordRec((float) 7.2619, (float) 9.5238), new CoordRec((float) 2.5, (float) 23.8095), @@ -1049,18 +1049,18 @@ static final StrokeRec char74[] = { /* char: 75 'K' */ static final CoordRec char75_stroke0[] = { - new CoordRec((float) 11.28, (float) 100), - new CoordRec((float) 11.28, (float) 0), + new CoordRec((float) 11.28, 100), + new CoordRec((float) 11.28, 0), }; static final CoordRec char75_stroke1[] = { - new CoordRec((float) 77.9467, (float) 100), + new CoordRec((float) 77.9467, 100), new CoordRec((float) 11.28, (float) 33.3333), }; static final CoordRec char75_stroke2[] = { new CoordRec((float) 35.0895, (float) 57.1429), - new CoordRec((float) 77.9467, (float) 0), + new CoordRec((float) 77.9467, 0), }; static final StrokeRec char75[] = { @@ -1072,13 +1072,13 @@ static final StrokeRec char75[] = { /* char: 76 'L' */ static final CoordRec char76_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 11.68, 0), }; static final CoordRec char76_stroke1[] = { - new CoordRec((float) 11.68, (float) 0), - new CoordRec((float) 68.8229, (float) 0), + new CoordRec((float) 11.68, 0), + new CoordRec((float) 68.8229, 0), }; static final StrokeRec char76[] = { @@ -1089,23 +1089,23 @@ static final StrokeRec char76[] = { /* char: 77 'M' */ static final CoordRec char77_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 10.86, 0), }; static final CoordRec char77_stroke1[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 48.9552, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 48.9552, 0), }; static final CoordRec char77_stroke2[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 48.9552, (float) 0), + new CoordRec((float) 87.0505, 100), + new CoordRec((float) 48.9552, 0), }; static final CoordRec char77_stroke3[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 87.0505, (float) 0), + new CoordRec((float) 87.0505, 100), + new CoordRec((float) 87.0505, 0), }; static final StrokeRec char77[] = { @@ -1118,18 +1118,18 @@ static final StrokeRec char77[] = { /* char: 78 'N' */ static final CoordRec char78_stroke0[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 11.14, (float) 0), + new CoordRec((float) 11.14, 100), + new CoordRec((float) 11.14, 0), }; static final CoordRec char78_stroke1[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 77.8067, (float) 0), + new CoordRec((float) 11.14, 100), + new CoordRec((float) 77.8067, 0), }; static final CoordRec char78_stroke2[] = { - new CoordRec((float) 77.8067, (float) 100), - new CoordRec((float) 77.8067, (float) 0), + new CoordRec((float) 77.8067, 100), + new CoordRec((float) 77.8067, 0), }; static final StrokeRec char78[] = { @@ -1141,7 +1141,7 @@ static final StrokeRec char78[] = { /* char: 79 'O' */ static final CoordRec char79_stroke0[] = { - new CoordRec((float) 34.8114, (float) 100), + new CoordRec((float) 34.8114, 100), new CoordRec((float) 25.2876, (float) 95.2381), new CoordRec((float) 15.7638, (float) 85.7143), new CoordRec((float) 11.0019, (float) 76.1905), @@ -1150,8 +1150,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 11.0019, (float) 23.8095), new CoordRec((float) 15.7638, (float) 14.2857), new CoordRec((float) 25.2876, (float) 4.7619), - new CoordRec((float) 34.8114, (float) 0), - new CoordRec((float) 53.859, (float) 0), + new CoordRec((float) 34.8114, 0), + new CoordRec((float) 53.859, 0), new CoordRec((float) 63.3829, (float) 4.7619), new CoordRec((float) 72.9067, (float) 14.2857), new CoordRec((float) 77.6686, (float) 23.8095), @@ -1160,8 +1160,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 77.6686, (float) 76.1905), new CoordRec((float) 72.9067, (float) 85.7143), new CoordRec((float) 63.3829, (float) 95.2381), - new CoordRec((float) 53.859, (float) 100), - new CoordRec((float) 34.8114, (float) 100), + new CoordRec((float) 53.859, 100), + new CoordRec((float) 34.8114, 100), }; static final StrokeRec char79[] = { @@ -1171,13 +1171,13 @@ static final StrokeRec char79[] = { /* char: 80 'P' */ static final CoordRec char80_stroke0[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 12.1, (float) 0), + new CoordRec((float) 12.1, 100), + new CoordRec((float) 12.1, 0), }; static final CoordRec char80_stroke1[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 54.9571, (float) 100), + new CoordRec((float) 12.1, 100), + new CoordRec((float) 54.9571, 100), new CoordRec((float) 69.2429, (float) 95.2381), new CoordRec((float) 74.0048, (float) 90.4762), new CoordRec((float) 78.7667, (float) 80.9524), @@ -1196,7 +1196,7 @@ static final StrokeRec char80[] = { /* char: 81 'Q' */ static final CoordRec char81_stroke0[] = { - new CoordRec((float) 33.8714, (float) 100), + new CoordRec((float) 33.8714, 100), new CoordRec((float) 24.3476, (float) 95.2381), new CoordRec((float) 14.8238, (float) 85.7143), new CoordRec((float) 10.0619, (float) 76.1905), @@ -1205,8 +1205,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 10.0619, (float) 23.8095), new CoordRec((float) 14.8238, (float) 14.2857), new CoordRec((float) 24.3476, (float) 4.7619), - new CoordRec((float) 33.8714, (float) 0), - new CoordRec((float) 52.919, (float) 0), + new CoordRec((float) 33.8714, 0), + new CoordRec((float) 52.919, 0), new CoordRec((float) 62.4429, (float) 4.7619), new CoordRec((float) 71.9667, (float) 14.2857), new CoordRec((float) 76.7286, (float) 23.8095), @@ -1215,8 +1215,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 76.7286, (float) 76.1905), new CoordRec((float) 71.9667, (float) 85.7143), new CoordRec((float) 62.4429, (float) 95.2381), - new CoordRec((float) 52.919, (float) 100), - new CoordRec((float) 33.8714, (float) 100), + new CoordRec((float) 52.919, 100), + new CoordRec((float) 33.8714, 100), }; static final CoordRec char81_stroke1[] = { @@ -1232,13 +1232,13 @@ static final StrokeRec char81[] = { /* char: 82 'R' */ static final CoordRec char82_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 11.68, 0), }; static final CoordRec char82_stroke1[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 54.5371, (float) 100), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 54.5371, 100), new CoordRec((float) 68.8229, (float) 95.2381), new CoordRec((float) 73.5848, (float) 90.4762), new CoordRec((float) 78.3467, (float) 80.9524), @@ -1251,7 +1251,7 @@ static final CoordRec char82_stroke1[] = { static final CoordRec char82_stroke2[] = { new CoordRec((float) 45.0133, (float) 52.381), - new CoordRec((float) 78.3467, (float) 0), + new CoordRec((float) 78.3467, 0), }; static final StrokeRec char82[] = { @@ -1265,11 +1265,11 @@ static final StrokeRec char82[] = { static final CoordRec char83_stroke0[] = { new CoordRec((float) 74.6667, (float) 85.7143), new CoordRec((float) 65.1429, (float) 95.2381), - new CoordRec((float) 50.8571, (float) 100), - new CoordRec((float) 31.8095, (float) 100), + new CoordRec((float) 50.8571, 100), + new CoordRec((float) 31.8095, 100), new CoordRec((float) 17.5238, (float) 95.2381), - new CoordRec((float) 8, (float) 85.7143), - new CoordRec((float) 8, (float) 76.1905), + new CoordRec(8, (float) 85.7143), + new CoordRec(8, (float) 76.1905), new CoordRec((float) 12.7619, (float) 66.6667), new CoordRec((float) 17.5238, (float) 61.9048), new CoordRec((float) 27.0476, (float) 57.1429), @@ -1279,10 +1279,10 @@ static final CoordRec char83_stroke0[] = { new CoordRec((float) 74.6667, (float) 28.5714), new CoordRec((float) 74.6667, (float) 14.2857), new CoordRec((float) 65.1429, (float) 4.7619), - new CoordRec((float) 50.8571, (float) 0), - new CoordRec((float) 31.8095, (float) 0), + new CoordRec((float) 50.8571, 0), + new CoordRec((float) 31.8095, 0), new CoordRec((float) 17.5238, (float) 4.7619), - new CoordRec((float) 8, (float) 14.2857), + new CoordRec(8, (float) 14.2857), }; static final StrokeRec char83[] = { @@ -1292,13 +1292,13 @@ static final StrokeRec char83[] = { /* char: 84 'T' */ static final CoordRec char84_stroke0[] = { - new CoordRec((float) 35.6933, (float) 100), - new CoordRec((float) 35.6933, (float) 0), + new CoordRec((float) 35.6933, 100), + new CoordRec((float) 35.6933, 0), }; static final CoordRec char84_stroke1[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 69.0267, (float) 100), + new CoordRec((float) 2.36, 100), + new CoordRec((float) 69.0267, 100), }; static final StrokeRec char84[] = { @@ -1309,16 +1309,16 @@ static final StrokeRec char84[] = { /* char: 85 'U' */ static final CoordRec char85_stroke0[] = { - new CoordRec((float) 11.54, (float) 100), + new CoordRec((float) 11.54, 100), new CoordRec((float) 11.54, (float) 28.5714), new CoordRec((float) 16.3019, (float) 14.2857), new CoordRec((float) 25.8257, (float) 4.7619), - new CoordRec((float) 40.1114, (float) 0), - new CoordRec((float) 49.6352, (float) 0), + new CoordRec((float) 40.1114, 0), + new CoordRec((float) 49.6352, 0), new CoordRec((float) 63.921, (float) 4.7619), new CoordRec((float) 73.4448, (float) 14.2857), new CoordRec((float) 78.2067, (float) 28.5714), - new CoordRec((float) 78.2067, (float) 100), + new CoordRec((float) 78.2067, 100), }; static final StrokeRec char85[] = { @@ -1328,13 +1328,13 @@ static final StrokeRec char85[] = { /* char: 86 'V' */ static final CoordRec char86_stroke0[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 40.4552, (float) 0), + new CoordRec((float) 2.36, 100), + new CoordRec((float) 40.4552, 0), }; static final CoordRec char86_stroke1[] = { - new CoordRec((float) 78.5505, (float) 100), - new CoordRec((float) 40.4552, (float) 0), + new CoordRec((float) 78.5505, 100), + new CoordRec((float) 40.4552, 0), }; static final StrokeRec char86[] = { @@ -1345,23 +1345,23 @@ static final StrokeRec char86[] = { /* char: 87 'W' */ static final CoordRec char87_stroke0[] = { - new CoordRec((float) 2.22, (float) 100), - new CoordRec((float) 26.0295, (float) 0), + new CoordRec((float) 2.22, 100), + new CoordRec((float) 26.0295, 0), }; static final CoordRec char87_stroke1[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 26.0295, (float) 0), + new CoordRec((float) 49.839, 100), + new CoordRec((float) 26.0295, 0), }; static final CoordRec char87_stroke2[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 73.6486, (float) 0), + new CoordRec((float) 49.839, 100), + new CoordRec((float) 73.6486, 0), }; static final CoordRec char87_stroke3[] = { - new CoordRec((float) 97.4581, (float) 100), - new CoordRec((float) 73.6486, (float) 0), + new CoordRec((float) 97.4581, 100), + new CoordRec((float) 73.6486, 0), }; static final StrokeRec char87[] = { @@ -1374,13 +1374,13 @@ static final StrokeRec char87[] = { /* char: 88 'X' */ static final CoordRec char88_stroke0[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 0), + new CoordRec((float) 2.5, 100), + new CoordRec((float) 69.1667, 0), }; static final CoordRec char88_stroke1[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 69.1667, 100), + new CoordRec((float) 2.5, 0), }; static final StrokeRec char88[] = { @@ -1391,13 +1391,13 @@ static final StrokeRec char88[] = { /* char: 89 'Y' */ static final CoordRec char89_stroke0[] = { - new CoordRec((float) 1.52, (float) 100), + new CoordRec((float) 1.52, 100), new CoordRec((float) 39.6152, (float) 52.381), - new CoordRec((float) 39.6152, (float) 0), + new CoordRec((float) 39.6152, 0), }; static final CoordRec char89_stroke1[] = { - new CoordRec((float) 77.7105, (float) 100), + new CoordRec((float) 77.7105, 100), new CoordRec((float) 39.6152, (float) 52.381), }; @@ -1409,18 +1409,18 @@ static final StrokeRec char89[] = { /* char: 90 'Z' */ static final CoordRec char90_stroke0[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 69.1667, 100), + new CoordRec((float) 2.5, 0), }; static final CoordRec char90_stroke1[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 100), + new CoordRec((float) 2.5, 100), + new CoordRec((float) 69.1667, 100), }; static final CoordRec char90_stroke2[] = { - new CoordRec((float) 2.5, (float) 0), - new CoordRec((float) 69.1667, (float) 0), + new CoordRec((float) 2.5, 0), + new CoordRec((float) 69.1667, 0), }; static final StrokeRec char90[] = { @@ -1461,7 +1461,7 @@ static final StrokeRec char91[] = { /* char: 92 '\' */ static final CoordRec char92_stroke0[] = { - new CoordRec((float) 5.84, (float) 100), + new CoordRec((float) 5.84, 100), new CoordRec((float) 72.5067, (float) -14.2857), }; @@ -1532,12 +1532,12 @@ static final StrokeRec char95[] = { /* char: 96 '`' */ static final CoordRec char96_stroke0[] = { - new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 33.0219, 100), new CoordRec((float) 56.8314, (float) 71.4286), }; static final CoordRec char96_stroke1[] = { - new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 33.0219, 100), new CoordRec((float) 28.26, (float) 95.2381), new CoordRec((float) 56.8314, (float) 71.4286), }; @@ -1551,7 +1551,7 @@ static final StrokeRec char96[] = { static final CoordRec char97_stroke0[] = { new CoordRec((float) 63.8229, (float) 66.6667), - new CoordRec((float) 63.8229, (float) 0), + new CoordRec((float) 63.8229, 0), }; static final CoordRec char97_stroke1[] = { @@ -1565,8 +1565,8 @@ static final CoordRec char97_stroke1[] = { new CoordRec((float) 6.68, (float) 28.5714), new CoordRec((float) 11.4419, (float) 14.2857), new CoordRec((float) 20.9657, (float) 4.7619), - new CoordRec((float) 30.4895, (float) 0), - new CoordRec((float) 44.7752, (float) 0), + new CoordRec((float) 30.4895, 0), + new CoordRec((float) 44.7752, 0), new CoordRec((float) 54.299, (float) 4.7619), new CoordRec((float) 63.8229, (float) 14.2857), }; @@ -1579,8 +1579,8 @@ static final StrokeRec char97[] = { /* char: 98 'b' */ static final CoordRec char98_stroke0[] = { - new CoordRec((float) 8.76, (float) 100), - new CoordRec((float) 8.76, (float) 0), + new CoordRec((float) 8.76, 100), + new CoordRec((float) 8.76, 0), }; static final CoordRec char98_stroke1[] = { @@ -1594,8 +1594,8 @@ static final CoordRec char98_stroke1[] = { new CoordRec((float) 65.9029, (float) 28.5714), new CoordRec((float) 61.141, (float) 14.2857), new CoordRec((float) 51.6171, (float) 4.7619), - new CoordRec((float) 42.0933, (float) 0), - new CoordRec((float) 27.8076, (float) 0), + new CoordRec((float) 42.0933, 0), + new CoordRec((float) 27.8076, 0), new CoordRec((float) 18.2838, (float) 4.7619), new CoordRec((float) 8.76, (float) 14.2857), }; @@ -1618,8 +1618,8 @@ static final CoordRec char99_stroke0[] = { new CoordRec((float) 5.52, (float) 28.5714), new CoordRec((float) 10.2819, (float) 14.2857), new CoordRec((float) 19.8057, (float) 4.7619), - new CoordRec((float) 29.3295, (float) 0), - new CoordRec((float) 43.6152, (float) 0), + new CoordRec((float) 29.3295, 0), + new CoordRec((float) 43.6152, 0), new CoordRec((float) 53.139, (float) 4.7619), new CoordRec((float) 62.6629, (float) 14.2857), }; @@ -1631,8 +1631,8 @@ static final StrokeRec char99[] = { /* char: 100 'd' */ static final CoordRec char100_stroke0[] = { - new CoordRec((float) 61.7829, (float) 100), - new CoordRec((float) 61.7829, (float) 0), + new CoordRec((float) 61.7829, 100), + new CoordRec((float) 61.7829, 0), }; static final CoordRec char100_stroke1[] = { @@ -1646,8 +1646,8 @@ static final CoordRec char100_stroke1[] = { new CoordRec((float) 4.64, (float) 28.5714), new CoordRec((float) 9.4019, (float) 14.2857), new CoordRec((float) 18.9257, (float) 4.7619), - new CoordRec((float) 28.4495, (float) 0), - new CoordRec((float) 42.7352, (float) 0), + new CoordRec((float) 28.4495, 0), + new CoordRec((float) 42.7352, 0), new CoordRec((float) 52.259, (float) 4.7619), new CoordRec((float) 61.7829, (float) 14.2857), }; @@ -1673,8 +1673,8 @@ static final CoordRec char101_stroke0[] = { new CoordRec((float) 5.72, (float) 28.5714), new CoordRec((float) 10.4819, (float) 14.2857), new CoordRec((float) 20.0057, (float) 4.7619), - new CoordRec((float) 29.5295, (float) 0), - new CoordRec((float) 43.8152, (float) 0), + new CoordRec((float) 29.5295, 0), + new CoordRec((float) 43.8152, 0), new CoordRec((float) 53.339, (float) 4.7619), new CoordRec((float) 62.8629, (float) 14.2857), }; @@ -1686,11 +1686,11 @@ static final StrokeRec char101[] = { /* char: 102 'f' */ static final CoordRec char102_stroke0[] = { - new CoordRec((float) 38.7752, (float) 100), - new CoordRec((float) 29.2514, (float) 100), + new CoordRec((float) 38.7752, 100), + new CoordRec((float) 29.2514, 100), new CoordRec((float) 19.7276, (float) 95.2381), new CoordRec((float) 14.9657, (float) 80.9524), - new CoordRec((float) 14.9657, (float) 0), + new CoordRec((float) 14.9657, 0), }; static final CoordRec char102_stroke1[] = { @@ -1726,8 +1726,8 @@ static final CoordRec char103_stroke1[] = { new CoordRec((float) 5.36, (float) 28.5714), new CoordRec((float) 10.1219, (float) 14.2857), new CoordRec((float) 19.6457, (float) 4.7619), - new CoordRec((float) 29.1695, (float) 0), - new CoordRec((float) 43.4552, (float) 0), + new CoordRec((float) 29.1695, 0), + new CoordRec((float) 43.4552, 0), new CoordRec((float) 52.979, (float) 4.7619), new CoordRec((float) 62.5029, (float) 14.2857), }; @@ -1740,8 +1740,8 @@ static final StrokeRec char103[] = { /* char: 104 'h' */ static final CoordRec char104_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 100), + new CoordRec((float) 9.6, 0), }; static final CoordRec char104_stroke1[] = { @@ -1751,7 +1751,7 @@ static final CoordRec char104_stroke1[] = { new CoordRec((float) 47.6952, (float) 66.6667), new CoordRec((float) 57.219, (float) 61.9048), new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final StrokeRec char104[] = { @@ -1762,16 +1762,16 @@ static final StrokeRec char104[] = { /* char: 105 'i' */ static final CoordRec char105_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 10.02, 100), new CoordRec((float) 14.7819, (float) 95.2381), - new CoordRec((float) 19.5438, (float) 100), + new CoordRec((float) 19.5438, 100), new CoordRec((float) 14.7819, (float) 104.762), - new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 10.02, 100), }; static final CoordRec char105_stroke1[] = { new CoordRec((float) 14.7819, (float) 66.6667), - new CoordRec((float) 14.7819, (float) 0), + new CoordRec((float) 14.7819, 0), }; static final StrokeRec char105[] = { @@ -1782,11 +1782,11 @@ static final StrokeRec char105[] = { /* char: 106 'j' */ static final CoordRec char106_stroke0[] = { - new CoordRec((float) 17.3876, (float) 100), + new CoordRec((float) 17.3876, 100), new CoordRec((float) 22.1495, (float) 95.2381), - new CoordRec((float) 26.9114, (float) 100), + new CoordRec((float) 26.9114, 100), new CoordRec((float) 22.1495, (float) 104.762), - new CoordRec((float) 17.3876, (float) 100), + new CoordRec((float) 17.3876, 100), }; static final CoordRec char106_stroke1[] = { @@ -1805,8 +1805,8 @@ static final StrokeRec char106[] = { /* char: 107 'k' */ static final CoordRec char107_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 100), + new CoordRec((float) 9.6, 0), }; static final CoordRec char107_stroke1[] = { @@ -1816,7 +1816,7 @@ static final CoordRec char107_stroke1[] = { static final CoordRec char107_stroke2[] = { new CoordRec((float) 28.6476, (float) 38.0952), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final StrokeRec char107[] = { @@ -1828,8 +1828,8 @@ static final StrokeRec char107[] = { /* char: 108 'l' */ static final CoordRec char108_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), - new CoordRec((float) 10.02, (float) 0), + new CoordRec((float) 10.02, 100), + new CoordRec((float) 10.02, 0), }; static final StrokeRec char108[] = { @@ -1840,7 +1840,7 @@ static final StrokeRec char108[] = { static final CoordRec char109_stroke0[] = { new CoordRec((float) 9.6, (float) 66.6667), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 0), }; static final CoordRec char109_stroke1[] = { @@ -1850,7 +1850,7 @@ static final CoordRec char109_stroke1[] = { new CoordRec((float) 47.6952, (float) 66.6667), new CoordRec((float) 57.219, (float) 61.9048), new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final CoordRec char109_stroke2[] = { @@ -1860,7 +1860,7 @@ static final CoordRec char109_stroke2[] = { new CoordRec((float) 100.076, (float) 66.6667), new CoordRec((float) 109.6, (float) 61.9048), new CoordRec((float) 114.362, (float) 47.619), - new CoordRec((float) 114.362, (float) 0), + new CoordRec((float) 114.362, 0), }; static final StrokeRec char109[] = { @@ -1873,7 +1873,7 @@ static final StrokeRec char109[] = { static final CoordRec char110_stroke0[] = { new CoordRec((float) 9.18, (float) 66.6667), - new CoordRec((float) 9.18, (float) 0), + new CoordRec((float) 9.18, 0), }; static final CoordRec char110_stroke1[] = { @@ -1883,7 +1883,7 @@ static final CoordRec char110_stroke1[] = { new CoordRec((float) 47.2752, (float) 66.6667), new CoordRec((float) 56.799, (float) 61.9048), new CoordRec((float) 61.561, (float) 47.619), - new CoordRec((float) 61.561, (float) 0), + new CoordRec((float) 61.561, 0), }; static final StrokeRec char110[] = { @@ -1901,8 +1901,8 @@ static final CoordRec char111_stroke0[] = { new CoordRec((float) 4.98, (float) 28.5714), new CoordRec((float) 9.7419, (float) 14.2857), new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 28.7895, (float) 0), - new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 28.7895, 0), + new CoordRec((float) 43.0752, 0), new CoordRec((float) 52.599, (float) 4.7619), new CoordRec((float) 62.1229, (float) 14.2857), new CoordRec((float) 66.8848, (float) 28.5714), @@ -1935,8 +1935,8 @@ static final CoordRec char112_stroke1[] = { new CoordRec((float) 66.6029, (float) 28.5714), new CoordRec((float) 61.841, (float) 14.2857), new CoordRec((float) 52.3171, (float) 4.7619), - new CoordRec((float) 42.7933, (float) 0), - new CoordRec((float) 28.5076, (float) 0), + new CoordRec((float) 42.7933, 0), + new CoordRec((float) 28.5076, 0), new CoordRec((float) 18.9838, (float) 4.7619), new CoordRec((float) 9.46, (float) 14.2857), }; @@ -1964,8 +1964,8 @@ static final CoordRec char113_stroke1[] = { new CoordRec((float) 4.84, (float) 28.5714), new CoordRec((float) 9.6019, (float) 14.2857), new CoordRec((float) 19.1257, (float) 4.7619), - new CoordRec((float) 28.6495, (float) 0), - new CoordRec((float) 42.9352, (float) 0), + new CoordRec((float) 28.6495, 0), + new CoordRec((float) 42.9352, 0), new CoordRec((float) 52.459, (float) 4.7619), new CoordRec((float) 61.9829, (float) 14.2857), }; @@ -1979,7 +1979,7 @@ static final StrokeRec char113[] = { static final CoordRec char114_stroke0[] = { new CoordRec((float) 9.46, (float) 66.6667), - new CoordRec((float) 9.46, (float) 0), + new CoordRec((float) 9.46, 0), }; static final CoordRec char114_stroke1[] = { @@ -2011,8 +2011,8 @@ static final CoordRec char115_stroke0[] = { new CoordRec((float) 57.081, (float) 19.0476), new CoordRec((float) 57.081, (float) 14.2857), new CoordRec((float) 52.319, (float) 4.7619), - new CoordRec((float) 38.0333, (float) 0), - new CoordRec((float) 23.7476, (float) 0), + new CoordRec((float) 38.0333, 0), + new CoordRec((float) 23.7476, 0), new CoordRec((float) 9.4619, (float) 4.7619), new CoordRec((float) 4.7, (float) 14.2857), }; @@ -2024,11 +2024,11 @@ static final StrokeRec char115[] = { /* char: 116 't' */ static final CoordRec char116_stroke0[] = { - new CoordRec((float) 14.8257, (float) 100), + new CoordRec((float) 14.8257, 100), new CoordRec((float) 14.8257, (float) 19.0476), new CoordRec((float) 19.5876, (float) 4.7619), - new CoordRec((float) 29.1114, (float) 0), - new CoordRec((float) 38.6352, (float) 0), + new CoordRec((float) 29.1114, 0), + new CoordRec((float) 38.6352, 0), }; static final CoordRec char116_stroke1[] = { @@ -2047,15 +2047,15 @@ static final CoordRec char117_stroke0[] = { new CoordRec((float) 9.46, (float) 66.6667), new CoordRec((float) 9.46, (float) 19.0476), new CoordRec((float) 14.2219, (float) 4.7619), - new CoordRec((float) 23.7457, (float) 0), - new CoordRec((float) 38.0314, (float) 0), + new CoordRec((float) 23.7457, 0), + new CoordRec((float) 38.0314, 0), new CoordRec((float) 47.5552, (float) 4.7619), new CoordRec((float) 61.841, (float) 19.0476), }; static final CoordRec char117_stroke1[] = { new CoordRec((float) 61.841, (float) 66.6667), - new CoordRec((float) 61.841, (float) 0), + new CoordRec((float) 61.841, 0), }; static final StrokeRec char117[] = { @@ -2067,12 +2067,12 @@ static final StrokeRec char117[] = { static final CoordRec char118_stroke0[] = { new CoordRec((float) 1.8, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), + new CoordRec((float) 30.3714, 0), }; static final CoordRec char118_stroke1[] = { new CoordRec((float) 58.9429, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), + new CoordRec((float) 30.3714, 0), }; static final StrokeRec char118[] = { @@ -2084,22 +2084,22 @@ static final StrokeRec char118[] = { static final CoordRec char119_stroke0[] = { new CoordRec((float) 2.5, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 21.5476, 0), }; static final CoordRec char119_stroke1[] = { new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 21.5476, 0), }; static final CoordRec char119_stroke2[] = { new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), + new CoordRec((float) 59.6429, 0), }; static final CoordRec char119_stroke3[] = { new CoordRec((float) 78.6905, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), + new CoordRec((float) 59.6429, 0), }; static final StrokeRec char119[] = { @@ -2113,12 +2113,12 @@ static final StrokeRec char119[] = { static final CoordRec char120_stroke0[] = { new CoordRec((float) 1.66, (float) 66.6667), - new CoordRec((float) 54.041, (float) 0), + new CoordRec((float) 54.041, 0), }; static final CoordRec char120_stroke1[] = { new CoordRec((float) 54.041, (float) 66.6667), - new CoordRec((float) 1.66, (float) 0), + new CoordRec((float) 1.66, 0), }; static final StrokeRec char120[] = { @@ -2130,12 +2130,12 @@ static final StrokeRec char120[] = { static final CoordRec char121_stroke0[] = { new CoordRec((float) 6.5619, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), + new CoordRec((float) 35.1333, 0), }; static final CoordRec char121_stroke1[] = { new CoordRec((float) 63.7048, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), + new CoordRec((float) 35.1333, 0), new CoordRec((float) 25.6095, (float) -19.0476), new CoordRec((float) 16.0857, (float) -28.5714), new CoordRec((float) 6.5619, (float) -33.3333), @@ -2151,7 +2151,7 @@ static final StrokeRec char121[] = { static final CoordRec char122_stroke0[] = { new CoordRec((float) 56.821, (float) 66.6667), - new CoordRec((float) 4.44, (float) 0), + new CoordRec((float) 4.44, 0), }; static final CoordRec char122_stroke1[] = { @@ -2160,8 +2160,8 @@ static final CoordRec char122_stroke1[] = { }; static final CoordRec char122_stroke2[] = { - new CoordRec((float) 4.44, (float) 0), - new CoordRec((float) 56.821, (float) 0), + new CoordRec((float) 4.44, 0), + new CoordRec((float) 56.821, 0), }; static final StrokeRec char122[] = { @@ -2176,7 +2176,7 @@ static final CoordRec char123_stroke0[] = { new CoordRec((float) 31.1895, (float) 119.048), new CoordRec((float) 21.6657, (float) 114.286), new CoordRec((float) 16.9038, (float) 109.524), - new CoordRec((float) 12.1419, (float) 100), + new CoordRec((float) 12.1419, 100), new CoordRec((float) 12.1419, (float) 90.4762), new CoordRec((float) 16.9038, (float) 80.9524), new CoordRec((float) 21.6657, (float) 76.1905), @@ -2199,7 +2199,7 @@ static final CoordRec char123_stroke1[] = { new CoordRec((float) 31.1895, (float) 23.8095), new CoordRec((float) 31.1895, (float) 14.2857), new CoordRec((float) 26.4276, (float) 4.7619), - new CoordRec((float) 21.6657, (float) 0), + new CoordRec((float) 21.6657, 0), new CoordRec((float) 16.9038, (float) -9.5238), new CoordRec((float) 16.9038, (float) -19.0476), new CoordRec((float) 21.6657, (float) -28.5714), @@ -2241,7 +2241,7 @@ static final CoordRec char125_stroke0[] = { new CoordRec((float) 9.18, (float) 119.048), new CoordRec((float) 18.7038, (float) 114.286), new CoordRec((float) 23.4657, (float) 109.524), - new CoordRec((float) 28.2276, (float) 100), + new CoordRec((float) 28.2276, 100), new CoordRec((float) 28.2276, (float) 90.4762), new CoordRec((float) 23.4657, (float) 80.9524), new CoordRec((float) 18.7038, (float) 76.1905), @@ -2264,7 +2264,7 @@ static final CoordRec char125_stroke1[] = { new CoordRec((float) 9.18, (float) 23.8095), new CoordRec((float) 9.18, (float) 14.2857), new CoordRec((float) 13.9419, (float) 4.7619), - new CoordRec((float) 18.7038, (float) 0), + new CoordRec((float) 18.7038, 0), new CoordRec((float) 23.4657, (float) -9.5238), new CoordRec((float) 23.4657, (float) -19.0476), new CoordRec((float) 18.7038, (float) -28.5714), @@ -2327,7 +2327,7 @@ static final StrokeRec char126[] = { /* char: 127 */ static final CoordRec char127_stroke0[] = { - new CoordRec((float) 52.381, (float) 100), + new CoordRec((float) 52.381, 100), new CoordRec((float) 14.2857, (float) -33.3333), }; @@ -2335,12 +2335,12 @@ static final CoordRec char127_stroke1[] = { new CoordRec((float) 28.5714, (float) 66.6667), new CoordRec((float) 14.2857, (float) 61.9048), new CoordRec((float) 4.7619, (float) 52.381), - new CoordRec((float) 0, (float) 38.0952), - new CoordRec((float) 0, (float) 23.8095), + new CoordRec(0, (float) 38.0952), + new CoordRec(0, (float) 23.8095), new CoordRec((float) 4.7619, (float) 14.2857), new CoordRec((float) 14.2857, (float) 4.7619), - new CoordRec((float) 28.5714, (float) 0), - new CoordRec((float) 38.0952, (float) 0), + new CoordRec((float) 28.5714, 0), + new CoordRec((float) 38.0952, 0), new CoordRec((float) 52.381, (float) 4.7619), new CoordRec((float) 61.9048, (float) 14.2857), new CoordRec((float) 66.6667, (float) 28.5714), @@ -2357,38 +2357,38 @@ static final StrokeRec char127[] = { }; static final StrokeCharRec chars[] = { - new StrokeCharRec( 0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char0 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char1 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char2 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char3 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char4 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char5 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char6 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char7 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char8 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char9 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char10 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char11 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char12 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char13 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char14 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char15 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char16 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char17 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char18 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char19 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char20 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char21 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char22 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char23 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char24 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char25 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char26 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char27 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char28 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char29 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char30 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char31 */ null, 0, 0 ), new StrokeCharRec( 0, /* char32 */ null, (float) 52.381, (float) 104.762 ), new StrokeCharRec( 2, char33, (float) 13.3819, (float) 26.6238 ), new StrokeCharRec( 2, char34, (float) 23.0676, (float) 51.4352 ), diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java index 515212f0e..59935e358 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java @@ -51,10 +51,10 @@ class StrokeCharRec { public float center; public float right; - public StrokeCharRec(int num_strokes, - StrokeRec[] stroke, - float center, - float right) { + public StrokeCharRec(final int num_strokes, + final StrokeRec[] stroke, + final float center, + final float right) { this.num_strokes = num_strokes; this.stroke = stroke; this.center = center; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java index 5335c8523..5810ac38a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java @@ -52,11 +52,11 @@ class StrokeFontRec { public float top; public float bottom; - public StrokeFontRec(String name, - int num_chars, - StrokeCharRec[] ch, - float top, - float bottom) { + public StrokeFontRec(final String name, + final int num_chars, + final StrokeCharRec[] ch, + final float top, + final float bottom) { this.name = name; this.num_chars = num_chars; this.ch = ch; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java index b0c91c696..fcb7c912a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java @@ -49,8 +49,8 @@ class StrokeRec { public int num_coords; public CoordRec[] coord; - public StrokeRec(int num_coords, - CoordRec[] coord) { + public StrokeRec(final int num_coords, + final CoordRec[] coord) { this.num_coords = num_coords; this.coord = coord; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 7c6a40468..4a3e5b2e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -96,7 +96,7 @@ public class ShaderCode { * * @throws IllegalArgumentException if <code>count</count> and <code>source.length</code> do not match */ - public ShaderCode(int type, int count, CharSequence[][] source) { + public ShaderCode(final int type, final int count, final CharSequence[][] source) { if(source.length != count) { throw new IllegalArgumentException("shader number ("+count+") and sourceFiles array ("+source.length+") of different lenght."); } @@ -126,7 +126,7 @@ public class ShaderCode { * @param count number of shaders * @param binary binary buffer containing the shader binaries, */ - public ShaderCode(int type, int count, int binFormat, Buffer binary) { + public ShaderCode(final int type, final int count, final int binFormat, final Buffer binary) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: case GL2ES2.GL_FRAGMENT_SHADER: @@ -162,7 +162,7 @@ public class ShaderCode { * @throws IllegalArgumentException if <code>count</count> and <code>sourceFiles.length</code> do not match * @see #readShaderSource(Class, String) */ - public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context, String[] sourceFiles, boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context, final String[] sourceFiles, final boolean mutableStringBuilder) { if(null != gl && !ShaderUtil.isShaderCompilerAvailable(gl)) { return null; } @@ -174,7 +174,7 @@ public class ShaderCode { for(int i=0; i<sourceFiles.length; i++) { try { shaderSources[i][0] = readShaderSource(context, sourceFiles[i], mutableStringBuilder); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("readShaderSource("+sourceFiles[i]+") error: ", ioe); } if(null == shaderSources[i][0]) { @@ -201,12 +201,12 @@ public class ShaderCode { * @see #readShaderBinary(Class, String) * @see ShaderUtil#getShaderBinaryFormats(GL) */ - public static ShaderCode create(int type, int count, Class<?> context, int binFormat, String binaryFile) { + public static ShaderCode create(final int type, final int count, final Class<?> context, int binFormat, final String binaryFile) { ByteBuffer shaderBinary = null; if(null!=binaryFile && 0<=binFormat) { try { shaderBinary = readShaderBinary(context, binaryFile); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("readShaderBinary("+binaryFile+") error: ", ioe); } if(null == shaderBinary) { @@ -238,7 +238,7 @@ public class ShaderCode { * * @see #create(GL2ES2, int, Class, String, String, String, boolean) */ - public static String getFileSuffix(boolean binary, int type) { + public static String getFileSuffix(final boolean binary, final int type) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: return binary?SUFFIX_VERTEX_BINARY:SUFFIX_VERTEX_SOURCE; @@ -261,7 +261,7 @@ public class ShaderCode { * * @see #create(GL2ES2, int, Class, String, String, String, boolean) */ - public static String getBinarySubPath(int binFormat) { + public static String getBinarySubPath(final int binFormat) { switch (binFormat) { case GLES2.GL_NVIDIA_PLATFORM_BINARY_NV: return SUB_PATH_NVIDIA; @@ -347,9 +347,9 @@ public class ShaderCode { * @see ShaderUtil#getShaderBinaryFormats(GL) * @see #getBinarySubPath(int) */ - public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context, - String srcRoot, String[] srcBasenames, String binRoot, String binBasename, - boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context, + final String srcRoot, final String[] srcBasenames, final String binRoot, final String binBasename, + final boolean mutableStringBuilder) { ShaderCode res = null; final String srcPath[]; String srcPathString = null; @@ -376,10 +376,10 @@ public class ShaderCode { srcPath = null; } if( null!=binBasename ) { - Set<Integer> binFmts = ShaderUtil.getShaderBinaryFormats(gl); + final Set<Integer> binFmts = ShaderUtil.getShaderBinaryFormats(gl); final String binSuffix = getFileSuffix(true, type); - for(Iterator<Integer> iter=binFmts.iterator(); iter.hasNext(); ) { - int bFmt = iter.next().intValue(); + for(final Iterator<Integer> iter=binFmts.iterator(); iter.hasNext(); ) { + final int bFmt = iter.next().intValue(); final String bFmtPath = getBinarySubPath(bFmt); if(null==bFmtPath) continue; binFileName = binRoot + '/' + bFmtPath + '/' + binBasename + "." + binSuffix; @@ -447,8 +447,8 @@ public class ShaderCode { * * @see #create(GL2ES2, int, int, Class, String, String[], String, String) */ - public static ShaderCode create(GL2ES2 gl, int type, Class<?> context, - String srcRoot, String binRoot, String basename, boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final Class<?> context, + final String srcRoot, final String binRoot, final String basename, final boolean mutableStringBuilder) { return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder ); } @@ -460,7 +460,7 @@ public class ShaderCode { public int shaderType() { return shaderType; } public String shaderTypeStr() { return shaderTypeStr(shaderType); } - public static String shaderTypeStr(int type) { + public static String shaderTypeStr(final int type) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: return "VERTEX_SHADER"; @@ -480,10 +480,10 @@ public class ShaderCode { public IntBuffer shader() { return shader; } - public boolean compile(GL2ES2 gl) { + public boolean compile(final GL2ES2 gl) { return compile(gl, null); } - public boolean compile(GL2ES2 gl, PrintStream verboseOut) { + public boolean compile(final GL2ES2 gl, final PrintStream verboseOut) { if(isValid()) return true; // Create & Compile the vertex/fragment shader objects @@ -503,7 +503,7 @@ public class ShaderCode { return valid; } - public void destroy(GL2ES2 gl) { + public void destroy(final GL2ES2 gl) { if(isValid()) { if(null!=gl) { ShaderUtil.deleteShader(gl, shader()); @@ -521,7 +521,7 @@ public class ShaderCode { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this==obj) { return true; } if(obj instanceof ShaderCode) { return id()==((ShaderCode)obj).id(); @@ -534,7 +534,7 @@ public class ShaderCode { } @Override public String toString() { - StringBuilder buf = new StringBuilder("ShaderCode[id="+id+", type="+shaderTypeStr()+", valid="+valid+", shader: "); + final StringBuilder buf = new StringBuilder("ShaderCode[id="+id+", type="+shaderTypeStr()+", valid="+valid+", shader: "); for(int i=0; i<shader.remaining(); i++) { buf.append(" "+shader.get(i)); } @@ -546,7 +546,7 @@ public class ShaderCode { return buf.toString(); } - public void dumpShaderSource(PrintStream out) { + public void dumpShaderSource(final PrintStream out) { if(null==shaderSource) { out.println("<no shader source>"); return; @@ -560,7 +560,7 @@ public class ShaderCode { if(i>=sourceCount) { out.println("<no shader source>"); } else { - CharSequence[] src = shaderSource[i]; + final CharSequence[] src = shaderSource[i]; int lineno=0; for(int j=0; j<src.length; j++) { @@ -572,7 +572,7 @@ public class ShaderCode { lineno++; out.printf("%4d: %s\n", lineno, line); } - } catch (IOException e) { /* impossible .. StringReader */ } + } catch (final IOException e) { /* impossible .. StringReader */ } } } out.println("--------------------------------------------------------------"); @@ -593,7 +593,7 @@ public class ShaderCode { * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ - public int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data) { + public int insertShaderSource(final int shaderIdx, final String tag, final int fromIndex, final CharSequence data) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -650,7 +650,7 @@ public class ShaderCode { * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ - public int replaceInShaderSource(String oldName, String newName) { + public int replaceInShaderSource(final String oldName, final String newName) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -670,9 +670,9 @@ public class ShaderCode { final StringBuilder sb = (StringBuilder)src[j]; int curPos = 0; while(curPos<sb.length()-oldNameLen+1) { - int startIdx = sb.indexOf(oldName, curPos); + final int startIdx = sb.indexOf(oldName, curPos); if(0<=startIdx) { - int endIdx = startIdx + oldNameLen; + final int endIdx = startIdx + oldNameLen; sb.replace(startIdx, endIdx, newName); curPos = startIdx + newNameLen; num++; @@ -698,7 +698,7 @@ public class ShaderCode { * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ - public int insertShaderSource(int shaderIdx, int position, CharSequence data) { + public int insertShaderSource(final int shaderIdx, int position, final CharSequence data) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -750,7 +750,7 @@ public class ShaderCode { * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> * @see IOUtil#getResource(Class, String) */ - public int insertShaderSource(int shaderIdx, int position, Class<?> context, String path) throws IOException { + public int insertShaderSource(final int shaderIdx, final int position, final Class<?> context, final String path) throws IOException { final CharSequence data = readShaderSource(context, path, true); if( null != data ) { return insertShaderSource(shaderIdx, position, data); @@ -760,7 +760,7 @@ public class ShaderCode { } @SuppressWarnings("resource") - private static int readShaderSource(Class<?> context, URLConnection conn, StringBuilder result, int lineno) throws IOException { + private static int readShaderSource(final Class<?> context, final URLConnection conn, final StringBuilder result, int lineno) throws IOException { if(DEBUG_CODE) { if(0 == lineno) { result.append("// "+conn.getURL().toExternalForm()+"\n"); @@ -774,7 +774,7 @@ public class ShaderCode { while ((line = reader.readLine()) != null) { lineno++; if (line.startsWith("#include ")) { - String includeFile = line.substring(9).trim(); + final String includeFile = line.substring(9).trim(); URLConnection nextConn = null; // Try relative of current shader location @@ -805,7 +805,7 @@ public class ShaderCode { * @param result * @throws IOException */ - public static void readShaderSource(Class<?> context, URLConnection conn, StringBuilder result) throws IOException { + public static void readShaderSource(final Class<?> context, final URLConnection conn, final StringBuilder result) throws IOException { readShaderSource(context, conn, result, 0); } @@ -829,12 +829,12 @@ public class ShaderCode { * * @see IOUtil#getResource(Class, String) */ - public static CharSequence readShaderSource(Class<?> context, String path, boolean mutableStringBuilder) throws IOException { - URLConnection conn = IOUtil.getResource(context, path); + public static CharSequence readShaderSource(final Class<?> context, final String path, final boolean mutableStringBuilder) throws IOException { + final URLConnection conn = IOUtil.getResource(context, path); if (conn == null) { return null; } - StringBuilder result = new StringBuilder(); + final StringBuilder result = new StringBuilder(); readShaderSource(context, conn, result); return mutableStringBuilder ? result : result.toString(); } @@ -853,7 +853,7 @@ public class ShaderCode { * * @see IOUtil#getResource(Class, String) */ - public static ByteBuffer readShaderBinary(Class<?> context, String path) throws IOException { + public static ByteBuffer readShaderBinary(final Class<?> context, final String path) throws IOException { final URLConnection conn = IOUtil.getResource(context, path); if (conn == null) { return null; @@ -901,7 +901,7 @@ public class ShaderCode { * @param behavior shall be either {@link #REQUIRE}, {@link #ENABLE}, {@link #DISABLE} or {@link #WARN} * @return the complete extension directive */ - public static String createExtensionDirective(String extensionName, String behavior) { + public static String createExtensionDirective(final String extensionName, final String behavior) { return "#extension " + extensionName + " : " + behavior + "\n"; } @@ -913,7 +913,7 @@ public class ShaderCode { * @param gl a GL context, which must have been made current once * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ - public final int addGLSLVersion(GL2ES2 gl) { + public final int addGLSLVersion(final GL2ES2 gl) { return insertShaderSource(0, 0, gl.getContext().getGLSLVersionString()); } @@ -929,7 +929,7 @@ public class ShaderCode { * @param pos position within this mutable shader source. * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ - public final int addDefaultShaderPrecision(GL2ES2 gl, int pos) { + public final int addDefaultShaderPrecision(final GL2ES2 gl, int pos) { final String defaultPrecision; if( gl.isGLES3() ) { switch ( shaderType ) { @@ -973,7 +973,7 @@ public class ShaderCode { } /** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */ - public static final boolean requiresDefaultPrecision(GL2ES2 gl) { + public static final boolean requiresDefaultPrecision(final GL2ES2 gl) { if( gl.isGLES() ) { return true; } @@ -981,7 +981,7 @@ public class ShaderCode { } /** Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. 1.50[. */ - public static final boolean requiresGL3DefaultPrecision(GL2ES2 gl) { + public static final boolean requiresGL3DefaultPrecision(final GL2ES2 gl) { if( gl.isGL3() ) { final VersionNumber glslVersion = gl.getContext().getGLSLVersionNumber(); return glslVersion.compareTo(GLContext.Version130) >= 0 && glslVersion.compareTo(GLContext.Version150) < 0 ; @@ -1005,7 +1005,7 @@ public class ShaderCode { * @see #addGLSLVersion(GL2ES2) * @see #addDefaultShaderPrecision(GL2ES2, int) */ - public final int defaultShaderCustomization(GL2ES2 gl, boolean preludeVersion, boolean addDefaultPrecision) { + public final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final boolean addDefaultPrecision) { int pos; if( preludeVersion ) { pos = addGLSLVersion(gl); @@ -1031,7 +1031,7 @@ public class ShaderCode { * @see #addGLSLVersion(GL2ES2) * @see #addDefaultShaderPrecision(GL2ES2, int) */ - public final int defaultShaderCustomization(GL2ES2 gl, boolean preludeVersion, String esDefaultPrecision) { + public final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final String esDefaultPrecision) { int pos; if( preludeVersion ) { pos = addGLSLVersion(gl); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index 3ac17b0c5..a9b0bddc6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -65,7 +65,7 @@ public class ShaderProgram { * * @see #release(GL2ES2, boolean) */ - public synchronized void destroy(GL2ES2 gl) { + public synchronized void destroy(final GL2ES2 gl) { release(gl, true); } @@ -76,7 +76,7 @@ public class ShaderProgram { * * @see #release(GL2ES2, boolean) */ - public synchronized void release(GL2ES2 gl) { + public synchronized void release(final GL2ES2 gl) { release(gl, false); } @@ -84,12 +84,12 @@ public class ShaderProgram { * Detaches all shader codes and deletes the program. * If <code>destroyShaderCode</code> is true it destroys the shader codes as well. */ - public synchronized void release(GL2ES2 gl, boolean destroyShaderCode) { + public synchronized void release(final GL2ES2 gl, final boolean destroyShaderCode) { if( programLinked ) { useProgram(gl, false); } - for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { - ShaderCode shaderCode = iter.next(); + for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { + final ShaderCode shaderCode = iter.next(); if(attachedShaderCode.remove(shaderCode)) { ShaderUtil.detachShader(gl, shaderProgram, shaderCode.shader()); } @@ -115,11 +115,11 @@ public class ShaderProgram { * <p>This command does not compile and attach the shader, * use {@link #add(GL2ES2, ShaderCode)} for this purpose.</p> */ - public synchronized void add(ShaderCode shaderCode) throws GLException { + public synchronized void add(final ShaderCode shaderCode) throws GLException { allShaderCode.add(shaderCode); } - public synchronized boolean contains(ShaderCode shaderCode) { + public synchronized boolean contains(final ShaderCode shaderCode) { return allShaderCode.contains(shaderCode); } @@ -128,9 +128,9 @@ public class ShaderProgram { * @param id * @return */ - public synchronized ShaderCode getShader(int id) { - for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { - ShaderCode shaderCode = iter.next(); + public synchronized ShaderCode getShader(final int id) { + for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { + final ShaderCode shaderCode = iter.next(); if(shaderCode.id() == id) { return shaderCode; } @@ -149,7 +149,7 @@ public class ShaderProgram { * @param gl * @return true if shader program is valid, i.e. not zero */ - public synchronized final boolean init(GL2ES2 gl) { + public synchronized final boolean init(final GL2ES2 gl) { if( 0 == shaderProgram ) { shaderProgram = gl.glCreateProgram(); } @@ -163,7 +163,7 @@ public class ShaderProgram { * * @return true if the shader was successfully added, false if compilation failed. */ - public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) { + public synchronized boolean add(final GL2ES2 gl, final ShaderCode shaderCode, final PrintStream verboseOut) { if( !init(gl) ) { return false; } if( allShaderCode.add(shaderCode) ) { if( !shaderCode.compile(gl, verboseOut) ) { @@ -195,12 +195,12 @@ public class ShaderProgram { * @see ShaderState#glResetAllVertexAttributes * @see ShaderState#glResetAllVertexAttributes */ - public synchronized boolean replaceShader(GL2ES2 gl, ShaderCode oldShader, ShaderCode newShader, PrintStream verboseOut) { + public synchronized boolean replaceShader(final GL2ES2 gl, final ShaderCode oldShader, final ShaderCode newShader, final PrintStream verboseOut) { if(!init(gl) || !newShader.compile(gl, verboseOut)) { return false; } - boolean shaderWasInUse = inUse(); + final boolean shaderWasInUse = inUse(); if(shaderWasInUse) { useProgram(gl, false); } @@ -238,13 +238,13 @@ public class ShaderProgram { * * @see #init(GL2ES2) */ - public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) { + public synchronized boolean link(final GL2ES2 gl, final PrintStream verboseOut) { if( !init(gl) ) { programLinked = false; // mark unlinked due to user attempt to [re]link return false; } - for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { + for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { final ShaderCode shaderCode = iter.next(); if(!shaderCode.compile(gl, verboseOut)) { programLinked = false; // mark unlinked due to user attempt to [re]link @@ -264,7 +264,7 @@ public class ShaderProgram { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(obj instanceof ShaderProgram) { return id()==((ShaderProgram)obj).id(); @@ -283,7 +283,7 @@ public class ShaderProgram { } sb.append("ShaderProgram[id=").append(id); sb.append(", linked="+programLinked+", inUse="+programInUse+", program: "+shaderProgram+","); - for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { + for(final Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) { sb.append(Platform.getNewline()).append(" ").append(iter.next()); } sb.append("]"); @@ -299,11 +299,11 @@ public class ShaderProgram { * Performs {@link GL2ES2#glValidateProgram(int)} via {@link ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream)}. * @see ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream) **/ - public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) { + public synchronized boolean validateProgram(final GL2ES2 gl, final PrintStream verboseOut) { return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut); } - public synchronized void useProgram(GL2ES2 gl, boolean on) { + public synchronized void useProgram(final GL2ES2 gl, boolean on) { if(!programLinked) { throw new GLException("Program is not linked"); } if(programInUse==on) { return; } if( 0 == shaderProgram ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index 64dd589b8..c841f2f09 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -41,6 +41,7 @@ import javax.media.opengl.GLUniformData; import jogamp.opengl.Debug; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.GLArrayDataEditable; /** @@ -60,7 +61,7 @@ public class ShaderState { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLSLState", true); } public ShaderState() { @@ -68,12 +69,12 @@ public class ShaderState { public boolean verbose() { return verbose; } - public void setVerbose(boolean v) { verbose = DEBUG || v; } + public void setVerbose(final boolean v) { verbose = DEBUG || v; } /** * Returns the attached user object for the given name to this ShaderState. */ - public final Object getAttachedObject(String name) { + public final Object getAttachedObject(final String name) { return attachedObjectsByString.get(name); } @@ -83,7 +84,7 @@ public class ShaderState { * * @return the previous mapped object or null if none */ - public final Object attachObject(String name, Object obj) { + public final Object attachObject(final String name, final Object obj) { return attachedObjectsByString.put(name, obj); } @@ -92,7 +93,7 @@ public class ShaderState { * * @return the previous mapped object or null if none */ - public final Object detachObject(String name) { + public final Object detachObject(final String name) { return attachedObjectsByString.remove(name); } @@ -103,7 +104,7 @@ public class ShaderState { * * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) */ - public synchronized void useProgram(GL2ES2 gl, boolean on) throws GLException { + public synchronized void useProgram(final GL2ES2 gl, final boolean on) throws GLException { if(null==shaderProgram) { throw new GLException("No program is attached"); } if(on) { if(shaderProgram.linked()) { @@ -154,10 +155,10 @@ public class ShaderState { * * @throws GLException if program was not linked and linking fails */ - public synchronized boolean attachShaderProgram(GL2ES2 gl, ShaderProgram prog, boolean enable) throws GLException { + public synchronized boolean attachShaderProgram(final GL2ES2 gl, final ShaderProgram prog, final boolean enable) throws GLException { if(verbose) { - int curId = (null!=shaderProgram)?shaderProgram.id():-1; - int newId = (null!=prog)?prog.id():-1; + final int curId = (null!=shaderProgram)?shaderProgram.id():-1; + final int newId = (null!=prog)?prog.id():-1; System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog); if(DEBUG) { Thread.dumpStack(); @@ -213,7 +214,7 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see #release(GL2ES2, boolean, boolean, boolean) */ - public synchronized void destroy(GL2ES2 gl) { + public synchronized void destroy(final GL2ES2 gl) { release(gl, true, true, true); attachedObjectsByString.clear(); } @@ -225,7 +226,7 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see #release(GL2ES2, boolean, boolean, boolean) */ - public synchronized void releaseAllData(GL2ES2 gl) { + public synchronized void releaseAllData(final GL2ES2 gl) { release(gl, false, false, false); } @@ -234,12 +235,12 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see ShaderProgram#release(GL2ES2, boolean) */ - public synchronized void release(GL2ES2 gl, boolean destroyBoundAttributes, boolean destroyShaderProgram, boolean destroyShaderCode) { + public synchronized void release(final GL2ES2 gl, final boolean destroyBoundAttributes, final boolean destroyShaderProgram, final boolean destroyShaderCode) { if(null!=shaderProgram && shaderProgram.linked() ) { shaderProgram.useProgram(gl, false); } if(destroyBoundAttributes) { - for(Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) { + for(final Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) { iter.next().destroy(gl); } } @@ -265,8 +266,8 @@ public class ShaderState { * @see #getAttribLocation(GL2ES2, String) * @see GL2ES2#glGetAttribLocation(int, String) */ - public int getCachedAttribLocation(String name) { - Integer idx = activeAttribLocationMap.get(name); + public int getCachedAttribLocation(final String name) { + final Integer idx = activeAttribLocationMap.get(name); return (null!=idx)?idx.intValue():-1; } @@ -285,11 +286,11 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public GLArrayData getAttribute(String name) { + public GLArrayData getAttribute(final String name) { return activeAttribDataMap.get(name); } - public boolean isActiveAttribute(GLArrayData attribute) { + public boolean isActiveAttribute(final GLArrayData attribute) { return attribute == activeAttribDataMap.get(attribute.getName()); } @@ -313,7 +314,7 @@ public class ShaderState { * @see #getAttribute(String) * @see GLArrayData#associate(Object, boolean) */ - public void ownAttribute(GLArrayData attribute, boolean own) { + public void ownAttribute(final GLArrayData attribute, final boolean own) { if(own) { final int location = getCachedAttribLocation(attribute.getName()); if(0<=location) { @@ -326,7 +327,7 @@ public class ShaderState { attribute.associate(this, own); } - public boolean ownsAttribute(GLArrayData attribute) { + public boolean ownsAttribute(final GLArrayData attribute) { return managedAttributes.contains(attribute); } @@ -343,7 +344,7 @@ public class ShaderState { * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) */ - public void bindAttribLocation(GL2ES2 gl, int location, String name) { + public void bindAttribLocation(final GL2ES2 gl, final int location, final String name) { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); final Integer loc = new Integer(location); @@ -366,7 +367,7 @@ public class ShaderState { * @see #getCachedAttribLocation(String) * @see #getAttribute(String) */ - public void bindAttribLocation(GL2ES2 gl, int location, GLArrayData data) { + public void bindAttribLocation(final GL2ES2 gl, final int location, final GLArrayData data) { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); final String name = data.getName(); @@ -391,7 +392,7 @@ public class ShaderState { * @see #bindAttribLocation(GL2ES2, int, String) * @see GL2ES2#glGetAttribLocation(int, String) */ - public int getAttribLocation(GL2ES2 gl, String name) { + public int getAttribLocation(final GL2ES2 gl, final String name) { if(null==shaderProgram) throw new GLException("No program is attached"); int location = getCachedAttribLocation(name); if(0>location) { @@ -431,7 +432,7 @@ public class ShaderState { * @see GL2ES2#glGetAttribLocation(int, String) * @see #getAttribute(String) */ - public int getAttribLocation(GL2ES2 gl, GLArrayData data) { + public int getAttribLocation(final GL2ES2 gl, final GLArrayData data) { if(null==shaderProgram) throw new GLException("No program is attached"); final String name = data.getName(); int location = getCachedAttribLocation(name); @@ -441,7 +442,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = data.setLocation(gl, shaderProgram.program()); if(0<=location) { - Integer idx = new Integer(location); + final Integer idx = new Integer(location); activeAttribLocationMap.put(name, idx); if(DEBUG) { System.err.println("ShaderState: glGetAttribLocation: "+name+", loc: "+location); @@ -464,7 +465,7 @@ public class ShaderState { /** * @return true if the named attribute is enable */ - public final boolean isVertexAttribArrayEnabled(String name) { + public final boolean isVertexAttribArrayEnabled(final String name) { final Boolean v = activedAttribEnabledMap.get(name); return null != v && v.booleanValue(); } @@ -472,11 +473,11 @@ public class ShaderState { /** * @return true if the {@link GLArrayData} attribute is enable */ - public final boolean isVertexAttribArrayEnabled(GLArrayData data) { + public final boolean isVertexAttribArrayEnabled(final GLArrayData data) { return isVertexAttribArrayEnabled(data.getName()); } - private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) { + private boolean enableVertexAttribArray(final GL2ES2 gl, final String name, int location) { activedAttribEnabledMap.put(name, Boolean.TRUE); if(0>location) { location = getAttribLocation(gl, name); @@ -515,7 +516,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean enableVertexAttribArray(GL2ES2 gl, String name) { + public boolean enableVertexAttribArray(final GL2ES2 gl, final String name) { return enableVertexAttribArray(gl, name, -1); } @@ -541,7 +542,7 @@ public class ShaderState { * @see #getVertexAttribPointer * @see GLArrayDataEditable#enableBuffer(GL, boolean) */ - public boolean enableVertexAttribArray(GL2ES2 gl, GLArrayData data) { + public boolean enableVertexAttribArray(final GL2ES2 gl, final GLArrayData data) { if(0 > data.getLocation()) { getAttribLocation(gl, data); } else { @@ -551,7 +552,7 @@ public class ShaderState { return enableVertexAttribArray(gl, data.getName(), data.getLocation()); } - private boolean disableVertexAttribArray(GL2ES2 gl, String name, int location) { + private boolean disableVertexAttribArray(final GL2ES2 gl, final String name, int location) { activedAttribEnabledMap.put(name, Boolean.FALSE); if(0>location) { location = getAttribLocation(gl, name); @@ -591,7 +592,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean disableVertexAttribArray(GL2ES2 gl, String name) { + public boolean disableVertexAttribArray(final GL2ES2 gl, final String name) { return disableVertexAttribArray(gl, name, -1); } @@ -616,7 +617,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean disableVertexAttribArray(GL2ES2 gl, GLArrayData data) { + public boolean disableVertexAttribArray(final GL2ES2 gl, final GLArrayData data) { if(0 > data.getLocation()) { getAttribLocation(gl, data); } @@ -641,7 +642,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean vertexAttribPointer(GL2ES2 gl, GLArrayData data) { + public boolean vertexAttribPointer(final GL2ES2 gl, final GLArrayData data) { int location = data.getLocation(); if(0 > location) { location = getAttribLocation(gl, data); @@ -670,12 +671,12 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public void releaseAllAttributes(GL2ES2 gl) { + public void releaseAllAttributes(final GL2ES2 gl) { if(null!=shaderProgram) { - for(Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { disableVertexAttribArray(gl, iter.next()); } - for(Iterator<String> iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { + for(final Iterator<String> iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { disableVertexAttribArray(gl, iter.next()); } } @@ -702,8 +703,8 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public void disableAllVertexAttributeArrays(GL2ES2 gl, boolean removeFromState) { - for(Iterator<String> iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { + public void disableAllVertexAttributeArrays(final GL2ES2 gl, final boolean removeFromState) { + for(final Iterator<String> iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { final String name = iter.next(); if(removeFromState) { activedAttribEnabledMap.remove(name); @@ -715,7 +716,7 @@ public class ShaderState { } } - private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) { + private final void relocateAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. note: 'activeAttribLocationMap' is cleared before final String name = attribute.getName(); final int loc = attribute.setLocation(gl, shaderProgram.program()); @@ -760,19 +761,19 @@ public class ShaderState { * * @see #attachShaderProgram(GL2ES2, ShaderProgram) */ - private final void resetAllAttributes(GL2ES2 gl) { + private final void resetAllAttributes(final GL2ES2 gl) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); activeAttribLocationMap.clear(); for(int i=0; i<managedAttributes.size(); i++) { managedAttributes.get(i).setLocation(-1); } - for(Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { relocateAttribute(gl, iter.next()); } } - private final void setAttribute(GL2ES2 gl, GLArrayData attribute) { + private final void setAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. final String name = attribute.getName(); final int loc = attribute.getLocation(); @@ -798,8 +799,8 @@ public class ShaderState { /** * preserves the attribute location .. (program not linked) */ - private final void setAllAttributes(GL2ES2 gl) { - for(Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + private final void setAllAttributes(final GL2ES2 gl) { + for(final Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { setAttribute(gl, iter.next()); } } @@ -814,8 +815,8 @@ public class ShaderState { * @return -1 if there is no such uniform available, * otherwise >= 0 */ - public final int getCachedUniformLocation(String name) { - Integer idx = activeUniformLocationMap.get(name); + public final int getCachedUniformLocation(final String name) { + final Integer idx = activeUniformLocationMap.get(name); return (null!=idx)?idx.intValue():-1; } @@ -833,7 +834,7 @@ public class ShaderState { * * @see #getUniform(String) */ - public void ownUniform(GLUniformData uniform) { + public void ownUniform(final GLUniformData uniform) { final int location = getCachedUniformLocation(uniform.getName()); if(0<=location) { uniform.setLocation(location); @@ -842,7 +843,7 @@ public class ShaderState { managedUniforms.add(uniform); } - public boolean ownsUniform(GLUniformData uniform) { + public boolean ownsUniform(final GLUniformData uniform) { return managedUniforms.contains(uniform); } @@ -865,14 +866,14 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public final int getUniformLocation(GL2ES2 gl, String name) { + public final int getUniformLocation(final GL2ES2 gl, final String name) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); int location = getCachedUniformLocation(name); if(0>location) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = gl.glGetUniformLocation(shaderProgram.program(), name); if(0<=location) { - Integer idx = new Integer(location); + final Integer idx = new Integer(location); activeUniformLocationMap.put(name, idx); } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); @@ -904,7 +905,7 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public int getUniformLocation(GL2ES2 gl, GLUniformData data) { + public int getUniformLocation(final GL2ES2 gl, final GLUniformData data) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); final String name = data.getName(); int location = getCachedUniformLocation(name); @@ -942,7 +943,7 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public boolean uniform(GL2ES2 gl, GLUniformData data) { + public boolean uniform(final GL2ES2 gl, final GLUniformData data) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); int location = data.getLocation(); if(0>location) { @@ -964,7 +965,7 @@ public class ShaderState { * * @return the GLUniformData object, null if not previously set. */ - public GLUniformData getUniform(String name) { + public GLUniformData getUniform(final String name) { return activeUniformDataMap.get(name); } @@ -972,7 +973,7 @@ public class ShaderState { * Releases all mapped uniform data * and loses all indices */ - public void releaseAllUniforms(GL2ES2 gl) { + public void releaseAllUniforms(final GL2ES2 gl) { activeUniformDataMap.clear(); activeUniformLocationMap.clear(); managedUniforms.clear(); @@ -993,13 +994,13 @@ public class ShaderState { * * @see #attachShaderProgram(GL2ES2, ShaderProgram) */ - private final void resetAllUniforms(GL2ES2 gl) { + private final void resetAllUniforms(final GL2ES2 gl) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); activeUniformLocationMap.clear(); - for(Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) { + for(final Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) { iter.next().setLocation(-1); } - for(Iterator<GLUniformData> iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator<GLUniformData> iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) { final GLUniformData data = iter.next(); final int loc = data.setLocation(gl, shaderProgram.program()); if( 0 <= loc ) { @@ -1013,7 +1014,7 @@ public class ShaderState { } } - public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) { + public StringBuilder toString(StringBuilder sb, final boolean alsoUnlocated) { if(null==sb) { sb = new StringBuilder(); } @@ -1028,35 +1029,35 @@ public class ShaderState { } sb.append(Platform.getNewline()).append(" enabledAttributes ["); { - Iterator<String> names = activedAttribEnabledMap.keySet().iterator(); - Iterator<Boolean> values = activedAttribEnabledMap.values().iterator(); + final Iterator<String> names = activedAttribEnabledMap.keySet().iterator(); + final Iterator<Boolean> values = activedAttribEnabledMap.values().iterator(); while( names.hasNext() ) { sb.append(Platform.getNewline()).append(" ").append(names.next()).append(": ").append(values.next()); } } sb.append(Platform.getNewline()).append(" ],").append(" activeAttributes ["); - for(Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator<GLArrayData> iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { final GLArrayData ad = iter.next(); if( alsoUnlocated || 0 <= ad.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ad); } } sb.append(Platform.getNewline()).append(" ],").append(" managedAttributes ["); - for(Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) { + for(final Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) { final GLArrayData ad = iter.next(); if( alsoUnlocated || 0 <= ad.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ad); } } sb.append(Platform.getNewline()).append(" ],").append(" activeUniforms ["); - for(Iterator<GLUniformData> iter=activeUniformDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator<GLUniformData> iter=activeUniformDataMap.values().iterator(); iter.hasNext(); ) { final GLUniformData ud = iter.next(); if( alsoUnlocated || 0 <= ud.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ud); } } sb.append(Platform.getNewline()).append(" ],").append(" managedUniforms ["); - for(Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) { + for(final Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) { final GLUniformData ud = iter.next(); if( alsoUnlocated || 0 <= ud.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ud); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index ad5331a28..b927e8ceb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -43,49 +43,49 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.GLExtensions; public class ShaderUtil { - public static String getShaderInfoLog(GL _gl, int shaderObj) { + public static String getShaderInfoLog(final GL _gl, final int shaderObj) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] infoLogLength=new int[1]; + final int[] infoLogLength=new int[1]; gl.glGetShaderiv(shaderObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0); if(infoLogLength[0]==0) { return "(no info log)"; } - int[] charsWritten=new int[1]; - byte[] infoLogBytes = new byte[infoLogLength[0]]; + final int[] charsWritten=new int[1]; + final byte[] infoLogBytes = new byte[infoLogLength[0]]; gl.glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); return new String(infoLogBytes, 0, charsWritten[0]); } - public static String getProgramInfoLog(GL _gl, int programObj) { + public static String getProgramInfoLog(final GL _gl, final int programObj) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] infoLogLength=new int[1]; + final int[] infoLogLength=new int[1]; gl.glGetProgramiv(programObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0); if(infoLogLength[0]==0) { return "(no info log)"; } - int[] charsWritten=new int[1]; - byte[] infoLogBytes = new byte[infoLogLength[0]]; + final int[] charsWritten=new int[1]; + final byte[] infoLogBytes = new byte[infoLogLength[0]]; gl.glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); return new String(infoLogBytes, 0, charsWritten[0]); } - public static boolean isShaderStatusValid(GL _gl, int shaderObj, int name, PrintStream verboseOut) { + public static boolean isShaderStatusValid(final GL _gl, final int shaderObj, final int name, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] ires = new int[1]; + final int[] ires = new int[1]; gl.glGetShaderiv(shaderObj, name, ires, 0); - boolean res = ires[0]==1; + final boolean res = ires[0]==1; if(!res && null!=verboseOut) { verboseOut.println("Shader status invalid: "+ getShaderInfoLog(gl, shaderObj)); } return res; } - public static boolean isShaderStatusValid(GL _gl, IntBuffer shaders, int name, PrintStream verboseOut) { + public static boolean isShaderStatusValid(final GL _gl, final IntBuffer shaders, final int name, final PrintStream verboseOut) { boolean res = true; for (int i = shaders.position(); i < shaders.limit(); i++) { res = isShaderStatusValid(_gl, shaders.get(i), name, verboseOut) && res; @@ -93,15 +93,15 @@ public class ShaderUtil { return res; } - public static boolean isProgramStatusValid(GL _gl, int programObj, int name) { + public static boolean isProgramStatusValid(final GL _gl, final int programObj, final int name) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] ires = new int[1]; + final int[] ires = new int[1]; gl.glGetProgramiv(programObj, name, ires, 0); return ires[0]==1; } - public static boolean isProgramLinkStatusValid(GL _gl, int programObj, PrintStream verboseOut) { + public static boolean isProgramLinkStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); if(!gl.glIsProgram(programObj)) { if(null!=verboseOut) { @@ -130,7 +130,7 @@ public class ShaderUtil { * </p> * @see GL2ES2#glValidateProgram(int) **/ - public static boolean isProgramExecStatusValid(GL _gl, int programObj, PrintStream verboseOut) { + public static boolean isProgramExecStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); gl.glValidateProgram(programObj); if(!isProgramStatusValid(gl, programObj, GL2ES2.GL_VALIDATE_STATUS)) { @@ -142,7 +142,7 @@ public class ShaderUtil { return true; } - public static void createShader(GL _gl, int type, IntBuffer shaders) { + public static void createShader(final GL _gl, final int type, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { shaders.put(i, gl.glCreateShader(type)); @@ -154,7 +154,7 @@ public class ShaderUtil { * {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS} * via {@link GL2ES2#glGetIntegerv(int, int[], int)}. */ - public static Set<Integer> getShaderBinaryFormats(GL _gl) { + public static Set<Integer> getShaderBinaryFormats(final GL _gl) { final GL2ES2 gl = _gl.getGL2ES2(); final ProfileInformation info = getProfileInformation(gl); if(null == info.shaderBinaryFormats) { @@ -166,13 +166,13 @@ public class ShaderUtil { final int err = gl.glGetError(); final int numFormats = GL.GL_NO_ERROR == err ? param[0] : 0; if(numFormats>0) { - int[] formats = new int[numFormats]; + final int[] formats = new int[numFormats]; gl.glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0); for(int i=0; i<numFormats; i++) { info.shaderBinaryFormats.add(new Integer(formats[i])); } } - } catch (GLException gle) { + } catch (final GLException gle) { System.err.println("Caught exception on thread "+Thread.currentThread().getName()); gle.printStackTrace(); } @@ -182,7 +182,7 @@ public class ShaderUtil { } /** Returns true if a hader compiler is available, otherwise false. */ - public static boolean isShaderCompilerAvailable(GL _gl) { + public static boolean isShaderCompilerAvailable(final GL _gl) { final GL2ES2 gl = _gl.getGL2ES2(); final ProfileInformation info = getProfileInformation(gl); if(null==info.shaderCompilerAvailable) { @@ -202,7 +202,7 @@ public class ShaderUtil { } info.shaderCompilerAvailable = new Boolean(v); queryOK = true; - } catch (GLException gle) { + } catch (final GLException gle) { System.err.println("Caught exception on thread "+Thread.currentThread().getName()); gle.printStackTrace(); } @@ -219,25 +219,25 @@ public class ShaderUtil { } /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ - public static boolean isGeometryShaderSupported(GL _gl) { + public static boolean isGeometryShaderSupported(final GL _gl) { final GLContext ctx = _gl.getContext(); return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 || ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4); } - public static void shaderSource(GL _gl, int shader, CharSequence[] source) + public static void shaderSource(final GL _gl, final int shader, final CharSequence[] source) { final GL2ES2 gl = _gl.getGL2ES2(); if(!isShaderCompilerAvailable(_gl)) { throw new GLException("No compiler is available"); } - int count = (null!=source)?source.length:0; + final int count = (null!=source)?source.length:0; if(count==0) { throw new GLException("No sources specified"); } - IntBuffer lengths = Buffers.newDirectIntBuffer(count); + final IntBuffer lengths = Buffers.newDirectIntBuffer(count); for(int i=0; i<count; i++) { lengths.put(i, source[i].length()); } @@ -260,10 +260,10 @@ public class ShaderUtil { } } - public static void shaderSource(GL _gl, IntBuffer shaders, CharSequence[][] sources) + public static void shaderSource(final GL _gl, final IntBuffer shaders, final CharSequence[][] sources) { - int sourceNum = (null!=sources)?sources.length:0; - int shaderNum = (null!=shaders)?shaders.remaining():0; + final int sourceNum = (null!=sources)?sources.length:0; + final int shaderNum = (null!=shaders)?shaders.remaining():0; if(shaderNum<=0 || sourceNum<=0 || shaderNum!=sourceNum) { throw new GLException("Invalid number of shaders and/or sources: shaders="+ shaderNum+", sources="+sourceNum); @@ -273,28 +273,28 @@ public class ShaderUtil { } } - public static void shaderBinary(GL _gl, IntBuffer shaders, int binFormat, java.nio.Buffer bin) + public static void shaderBinary(final GL _gl, final IntBuffer shaders, final int binFormat, final java.nio.Buffer bin) { final GL2ES2 gl = _gl.getGL2ES2(); if(getShaderBinaryFormats(gl).size()<=0) { throw new GLException("No binary formats are supported"); } - int shaderNum = shaders.remaining(); + final int shaderNum = shaders.remaining(); if(shaderNum<=0) { throw new GLException("No shaders specified"); } if(null==bin) { throw new GLException("Null shader binary"); } - int binLength = bin.remaining(); + final int binLength = bin.remaining(); if(0>=binLength) { throw new GLException("Empty shader binary (remaining == 0)"); } gl.glShaderBinary(shaderNum, shaders, binFormat, bin, binLength); } - public static void compileShader(GL _gl, IntBuffer shaders) + public static void compileShader(final GL _gl, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -302,7 +302,7 @@ public class ShaderUtil { } } - public static void attachShader(GL _gl, int program, IntBuffer shaders) + public static void attachShader(final GL _gl, final int program, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -310,7 +310,7 @@ public class ShaderUtil { } } - public static void detachShader(GL _gl, int program, IntBuffer shaders) + public static void detachShader(final GL _gl, final int program, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -318,7 +318,7 @@ public class ShaderUtil { } } - public static void deleteShader(GL _gl, IntBuffer shaders) + public static void deleteShader(final GL _gl, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -327,9 +327,9 @@ public class ShaderUtil { } } - public static boolean createAndLoadShader(GL _gl, IntBuffer shader, int shaderType, - int binFormat, java.nio.Buffer bin, - PrintStream verboseOut) + public static boolean createAndLoadShader(final GL _gl, final IntBuffer shader, final int shaderType, + final int binFormat, final java.nio.Buffer bin, + final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); int err = gl.glGetError(); // flush previous errors .. @@ -352,9 +352,9 @@ public class ShaderUtil { return err == GL.GL_NO_ERROR; } - public static boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType, - CharSequence[][] sources, - PrintStream verboseOut) + public static boolean createAndCompileShader(final GL _gl, final IntBuffer shader, final int shaderType, + final CharSequence[][] sources, + final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); int err = gl.glGetError(); // flush previous errors .. @@ -390,7 +390,7 @@ public class ShaderUtil { Set<Integer> shaderBinaryFormats = null; } - private static ProfileInformation getProfileInformation(GL gl) { + private static ProfileInformation getProfileInformation(final GL gl) { final GLContext context = gl.getContext(); context.validateCurrent(); ProfileInformation data = (ProfileInformation) context.getAttachedObject(implObjectKey); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index 2f8884a3a..1ed875f27 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -37,7 +37,7 @@ public class FixedFuncUtil { * @see ShaderSelectionMode#COLOR_TEXTURE * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX */ - public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, boolean force, boolean verbose) { + public static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, final boolean force, final boolean verbose) { if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) { final GL2ES2 es2 = gl.getGL2ES2(); final FixedFuncHook hook = new FixedFuncHook(es2, mode, pmvMatrix); @@ -66,7 +66,7 @@ public class FixedFuncUtil { * @see ShaderSelectionMode#COLOR_TEXTURE * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX */ - public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { + public static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) { return wrapFixedFuncEmul(gl, mode, null, false, false); } @@ -90,7 +90,7 @@ public class FixedFuncUtil { * @see javax.media.opengl.fixedfunc.GLPointerFunc#glNormalPointer * @see javax.media.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer */ - public static String getPredefinedArrayIndexName(int glArrayIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex) { return GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index 44fbf1c6d..f113be2b2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -30,7 +30,7 @@ public abstract class CompileShader { public abstract String getFragmentShaderCompiler(); - public void processOneShader(String resourceName) + public void processOneShader(final String resourceName) throws IOException, UnsupportedEncodingException, InterruptedException { int type = -1; @@ -49,11 +49,11 @@ public abstract class CompileShader { suffixLen = 4; type = GL2ES2.GL_VERTEX_SHADER; } - String justName = basename(resourceName); + final String justName = basename(resourceName); outName = justName.substring(0, justName.length() - suffixLen) + ShaderCode.getFileSuffix(true, type); - URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); - String dirName = dirname(resourceURL.getPath()); + final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final String dirName = dirname(resourceURL.getPath()); outName = dirName + File.separator + "bin" + File.separator + ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator + @@ -61,19 +61,19 @@ public abstract class CompileShader { processOneShader(resourceName, outName, type); } - public void processOneShader(String resourceName, String outName, int type) + public void processOneShader(final String resourceName, final String outName, final int type) throws IOException, UnsupportedEncodingException, InterruptedException { - URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); - String dirName = dirname(resourceURL.getPath()); + final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final String dirName = dirname(resourceURL.getPath()); - CharSequence shader = ShaderCode.readShaderSource(null, resourceName, false); + final CharSequence shader = ShaderCode.readShaderSource(null, resourceName, false); if(null==shader) { System.err.println("Can't find shader source " + resourceName + " - ignored"); return; } System.err.println("Preprocessing: "+ resourceName+", in dir: "+dirName); - String justName = basename(resourceName); + final String justName = basename(resourceName); String processor; switch (type) { case GL2ES2.GL_VERTEX_SHADER: @@ -85,26 +85,26 @@ public abstract class CompileShader { default: throw new GLException("Unknown shader type: "+type); } - File outputFile = new File(outName); + final File outputFile = new File(outName); // Write shader to a file in java.io.tmpdir - File tmpDir = new File(dirName+File.separator+"tmp"); + final File tmpDir = new File(dirName+File.separator+"tmp"); tmpDir.mkdirs(); - File tmpFile = new File(tmpDir, justName); - Writer writer = new BufferedWriter(new FileWriter(tmpFile)); + final File tmpFile = new File(tmpDir, justName); + final Writer writer = new BufferedWriter(new FileWriter(tmpFile)); writer.write(shader.toString(), 0, shader.length()); writer.flush(); writer.close(); System.err.println("Preprocessed: "+ tmpFile.getAbsolutePath()); - File processorDir = getSDKCompilerDir(); + final File processorDir = getSDKCompilerDir(); System.err.println("SDK: "+ processorDir.getAbsolutePath() + ", compiler: "+processor); System.err.println("Output: "+ outputFile.getAbsolutePath()); // Run the tool - Process process = Runtime.getRuntime().exec(new String[] { + final Process process = Runtime.getRuntime().exec(new String[] { processorDir.getAbsolutePath() + File.separator + processor, tmpFile.getAbsolutePath(), outputFile.getAbsolutePath() @@ -116,7 +116,7 @@ public abstract class CompileShader { // tmpFile.delete(); } - protected static String basename(String path) { + protected static String basename(final String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash < 0) { lastSlash = path.lastIndexOf("\\"); @@ -130,7 +130,7 @@ public abstract class CompileShader { return basename; } - protected static String dirname(String path) { + protected static String dirname(final String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash < 0) { lastSlash = path.lastIndexOf("\\"); @@ -144,19 +144,19 @@ public abstract class CompileShader { return dirname; } - public void run(String[] args) { + public void run(final String[] args) { try { for (int i = 0; i < args.length; i++) { processOneShader(args[i]); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } private static class StreamMonitor implements Runnable { - private InputStream istream; - public StreamMonitor(InputStream stream) { + private final InputStream istream; + public StreamMonitor(final InputStream stream) { istream = stream; new Thread(this, "Output Reader Thread").start(); } @@ -164,7 +164,7 @@ public abstract class CompileShader { @Override public void run() { - byte[] buffer = new byte[4096]; + final byte[] buffer = new byte[4096]; try { int numRead = 0; do { @@ -175,10 +175,10 @@ public abstract class CompileShader { } } while (numRead >= 0); } - catch (IOException e) { + catch (final IOException e) { try { istream.close(); - } catch (IOException e2) { + } catch (final IOException e2) { } // Should allow clean exit when process shuts down } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java index 215cf592b..9ff37c7ee 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java @@ -13,7 +13,7 @@ public class CompileShaderNVidia extends CompileShader { private static final String NVAPSDK; static { - String nvapSDKProp = System.getProperty("NVAPSDK"); + final String nvapSDKProp = System.getProperty("NVAPSDK"); if (nvapSDKProp != null) { NVAPSDK = nvapSDKProp; } else { @@ -51,7 +51,7 @@ public class CompileShaderNVidia extends CompileShader { return "glslf.bat"; } - public static void main(String[] args) { + public static void main(final String[] args) { new CompileShaderNVidia().run(args); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java index 9aadfba93..e694f1b33 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java @@ -42,29 +42,29 @@ package com.jogamp.opengl.util.packrect; import java.util.*; public class Level { - private int width; + private final int width; private int height; - private int yPos; - private LevelSet holder; + private final int yPos; + private final LevelSet holder; - private List<Rect> rects = new ArrayList<Rect>(); + private final List<Rect> rects = new ArrayList<Rect>(); private List<Rect> freeList; private int nextAddX; static class RectXComparator implements Comparator<Rect> { @Override - public int compare(Rect r1, Rect r2) { + public int compare(final Rect r1, final Rect r2) { return r1.x() - r2.x(); } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { return this == obj; } } private static final Comparator<Rect> rectXComparator = new RectXComparator(); - public Level(int width, int height, int yPos, LevelSet holder) { + public Level(final int width, final int height, final int yPos, final LevelSet holder) { this.width = width; this.height = height; this.yPos = yPos; @@ -80,7 +80,7 @@ public class Level { in the RectanglePacker and allocation from the free list. More disruptive changes like compaction of the level must be requested explicitly. */ - public boolean add(Rect rect) { + public boolean add(final Rect rect) { if (rect.h() > height) { // See whether it's worth trying to expand vertically if (nextAddX + rect.w() > width) { @@ -108,8 +108,8 @@ public class Level { // See whether we can add from the free list if (freeList != null) { Rect candidate = null; - for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); if (cur.canContain(rect)) { candidate = cur; break; @@ -139,7 +139,7 @@ public class Level { } /** Removes the given Rect from this Level. */ - public boolean remove(Rect rect) { + public boolean remove(final Rect rect) { if (!rects.remove(rect)) return false; @@ -165,14 +165,14 @@ public class Level { /** Indicates whether this Level could satisfy an allocation request if it were compacted. */ - public boolean couldAllocateIfCompacted(Rect rect) { + public boolean couldAllocateIfCompacted(final Rect rect) { if (rect.h() > height) return false; if (freeList == null) return false; int freeListWidth = 0; - for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); freeListWidth += cur.w(); } // Add on the remaining space at the end @@ -180,12 +180,12 @@ public class Level { return (freeListWidth >= rect.w()); } - public void compact(Object backingStore, BackingStoreManager manager) { + public void compact(final Object backingStore, final BackingStoreManager manager) { Collections.sort(rects, rectXComparator); int nextCompactionDest = 0; manager.beginMovement(backingStore, backingStore); - for (Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); if (cur.x() != nextCompactionDest) { manager.move(backingStore, cur, backingStore, new Rect(nextCompactionDest, cur.y(), cur.w(), cur.h(), null)); @@ -203,9 +203,9 @@ public class Level { } /** Visits all Rects contained in this Level. */ - public void visit(RectVisitor visitor) { - for (Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) { - Rect rect = iter.next(); + public void visit(final RectVisitor visitor) { + for (final Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) { + final Rect rect = iter.next(); visitor.visit(rect); } } @@ -216,8 +216,8 @@ public class Level { original Rects. */ public void updateRectangleReferences() { for (int i = 0; i < rects.size(); i++) { - Rect cur = rects.get(i); - Rect next = cur.getNextLocation(); + final Rect cur = rects.get(i); + final Rect next = cur.getNextLocation(); next.setPosition(cur.x(), cur.y()); if (cur.w() != next.w() || cur.h() != next.h()) throw new RuntimeException("Unexpected disparity in rectangle sizes during updateRectangleReferences"); @@ -235,8 +235,8 @@ public class Level { Collections.sort(freeList, rectXComparator); int i = 0; while (i < freeList.size() - 1) { - Rect r1 = freeList.get(i); - Rect r2 = freeList.get(i+1); + final Rect r1 = freeList.get(i); + final Rect r2 = freeList.get(i+1); if (r1.maxX() + 1 == r2.x()) { // Coalesce r1 and r2 into one block freeList.remove(i+1); @@ -246,7 +246,7 @@ public class Level { } } // See whether the last block bumps up against the addition point - Rect last = freeList.get(freeList.size() - 1); + final Rect last = freeList.get(freeList.size() - 1); if (last.maxX() + 1 == nextAddX) { nextAddX -= last.w(); freeList.remove(freeList.size() - 1); @@ -262,8 +262,8 @@ public class Level { public void dumpFreeSpace() { int freeListWidth = 0; - for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); System.err.println(" Free rectangle at " + cur); freeListWidth += cur.w(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java index 433421f1a..803ca28cf 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java @@ -47,14 +47,14 @@ import java.util.*; public class LevelSet { // Maintained in sorted order by increasing Y coordinate - private List<Level> levels = new ArrayList<Level>(); + private final List<Level> levels = new ArrayList<Level>(); private int nextAddY; - private int w; + private final int w; private int h; /** A LevelSet manages all of the backing store for a region of a specified width and height. */ - public LevelSet(int w, int h) { + public LevelSet(final int w, final int h) { this.w = w; this.h = h; } @@ -66,14 +66,14 @@ public class LevelSet { the LevelSet given its current dimensions, false if not. Caller is responsible for performing compaction, expansion, etc. as a consequence. */ - public boolean add(Rect rect) { + public boolean add(final Rect rect) { if (rect.w() > w) return false; // Go in reverse order through the levels seeing whether we can // trivially satisfy the allocation request for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.add(rect)) return true; } @@ -82,7 +82,7 @@ public class LevelSet { // increases the computational complexity of the addition process, // but prevents us from expanding unnecessarily. for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.couldAllocateIfCompacted(rect)) return false; } @@ -92,19 +92,19 @@ public class LevelSet { if (nextAddY + rect.h() > h) return false; - Level newLevel = new Level(w, rect.h(), nextAddY, this); + final Level newLevel = new Level(w, rect.h(), nextAddY, this); levels.add(newLevel); nextAddY += rect.h(); - boolean res = newLevel.add(rect); + final boolean res = newLevel.add(rect); if (!res) throw new RuntimeException("Unexpected failure in addition to new Level"); return true; } /** Removes the given Rect from this LevelSet. */ - public boolean remove(Rect rect) { + public boolean remove(final Rect rect) { for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.remove(rect)) return true; } @@ -116,14 +116,14 @@ public class LevelSet { if necessary. This is the correct fallback path to {@link #add(Rect)} above. Returns true if allocated successfully, false otherwise (indicating the need to expand the backing store). */ - public boolean compactAndAdd(Rect rect, - Object backingStore, - BackingStoreManager manager) { + public boolean compactAndAdd(final Rect rect, + final Object backingStore, + final BackingStoreManager manager) { for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.couldAllocateIfCompacted(rect)) { level.compact(backingStore, manager); - boolean res = level.add(rect); + final boolean res = level.add(rect); if (!res) throw new RuntimeException("Unexpected failure to add after compaction"); return true; @@ -136,7 +136,7 @@ public class LevelSet { /** Indicates whether it's legal to trivially increase the height of the given Level. This is only possible if it's the last Level added and there's enough room in the backing store. */ - public boolean canExpand(Level level, int height) { + public boolean canExpand(final Level level, final int height) { if (levels.isEmpty()) return false; // Should not happen if (levels.get(levels.size() - 1) == level && @@ -145,7 +145,7 @@ public class LevelSet { return false; } - public void expand(Level level, int oldHeight, int newHeight) { + public void expand(final Level level, final int oldHeight, final int newHeight) { nextAddY += (newHeight - oldHeight); } @@ -156,7 +156,7 @@ public class LevelSet { /** Sets the height of this LevelSet. It is only legal to reduce the height to greater than or equal to the currently used height. */ - public void setHeight(int height) throws IllegalArgumentException { + public void setHeight(final int height) throws IllegalArgumentException { if (height < getUsedHeight()) { throw new IllegalArgumentException("May not reduce height below currently used height"); } @@ -170,11 +170,11 @@ public class LevelSet { it may be profitable to perform a compaction. */ public float verticalFragmentationRatio() { int freeHeight = 0; - int usedHeight = getUsedHeight(); + final int usedHeight = getUsedHeight(); if (usedHeight == 0) return 0.0f; - for (Iterator<Level> iter = iterator(); iter.hasNext(); ) { - Level level = iter.next(); + for (final Iterator<Level> iter = iterator(); iter.hasNext(); ) { + final Level level = iter.next(); if (level.isEmpty()) { freeHeight += level.h(); } @@ -187,9 +187,9 @@ public class LevelSet { } /** Visits all Rects contained in this LevelSet. */ - public void visit(RectVisitor visitor) { - for (Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) { - Level level = iter.next(); + public void visit(final RectVisitor visitor) { + for (final Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) { + final Level level = iter.next(); level.visit(visitor); } } @@ -199,8 +199,8 @@ public class LevelSet { update the new Rects in a newly laid-out LevelSet with the original Rects. */ public void updateRectangleReferences() { - for (Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) { - Level level = iter.next(); + for (final Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) { + final Level level = iter.next(); level.updateRectangleReferences(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java index 89f594230..cbf6b933c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java @@ -77,11 +77,11 @@ public class Rect { this(null); } - public Rect(Object userData) { + public Rect(final Object userData) { this(0, 0, 0, 0, userData); } - public Rect(int x, int y, int w, int h, Object userData) { + public Rect(final int x, final int y, final int w, final int h, final Object userData) { setPosition(x, y); setSize(w, h); setUserData(userData); @@ -94,7 +94,7 @@ public class Rect { public Object getUserData() { return userData; } public Rect getNextLocation() { return nextLocation; } - public void setPosition(int x, int y) { + public void setPosition(final int x, final int y) { if (x < 0) throw new IllegalArgumentException("Negative x"); if (y < 0) @@ -103,7 +103,7 @@ public class Rect { this.y = y; } - public void setSize(int w, int h) throws IllegalArgumentException { + public void setSize(final int w, final int h) throws IllegalArgumentException { if (w < 0) throw new IllegalArgumentException("Negative width"); if (h < 0) @@ -112,8 +112,8 @@ public class Rect { this.h = h; } - public void setUserData(Object obj) { userData = obj; } - public void setNextLocation(Rect nextLocation) { this.nextLocation = nextLocation; } + public void setUserData(final Object obj) { userData = obj; } + public void setNextLocation(final Rect nextLocation) { this.nextLocation = nextLocation; } // Helpers for computations. @@ -139,7 +139,7 @@ public class Rect { return y() + h() - 1; } - public boolean canContain(Rect other) { + public boolean canContain(final Rect other) { return (w() >= other.w() && h() >= other.h()); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java index 44faa44b0..65f59ba53 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java @@ -48,34 +48,34 @@ import java.util.*; backing store, when necessary. */ public class RectanglePacker { - private BackingStoreManager manager; + private final BackingStoreManager manager; private Object backingStore; private LevelSet levels; - private float EXPANSION_FACTOR = 0.5f; - private float SHRINK_FACTOR = 0.3f; + private final float EXPANSION_FACTOR = 0.5f; + private final float SHRINK_FACTOR = 0.3f; - private int initialWidth; - private int initialHeight; + private final int initialWidth; + private final int initialHeight; private int maxWidth = -1; private int maxHeight = -1; static class RectHComparator implements Comparator<Rect> { @Override - public int compare(Rect r1, Rect r2) { + public int compare(final Rect r1, final Rect r2) { return r2.h() - r1.h(); } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { return this == obj; } } private static final Comparator<Rect> rectHComparator = new RectHComparator(); - public RectanglePacker(BackingStoreManager manager, - int initialWidth, - int initialHeight) { + public RectanglePacker(final BackingStoreManager manager, + final int initialWidth, + final int initialHeight) { this.manager = manager; levels = new LevelSet(initialWidth, initialHeight); this.initialWidth = initialWidth; @@ -95,7 +95,7 @@ public class RectanglePacker { necessary. Setting up a maximum width and height introduces the possibility that additions will fail; these are handled with the BackingStoreManager's allocationFailed notification. */ - public void setMaxSize(int maxWidth, int maxHeight) { + public void setMaxSize(final int maxWidth, final int maxHeight) { this.maxWidth = maxWidth; this.maxHeight = maxHeight; } @@ -107,7 +107,7 @@ public class RectanglePacker { BackingStoreManager#preExpand BackingStoreManager.preExpand} does not clear enough space for the incoming rectangle, then this method will throw a RuntimeException. */ - public void add(Rect rect) throws RuntimeException { + public void add(final Rect rect) throws RuntimeException { // Allocate backing store if we don't have any yet if (backingStore == null) backingStore = manager.allocateBackingStore(levels.w(), levels.h()); @@ -143,12 +143,12 @@ public class RectanglePacker { } /** Removes the given rectangle from this RectanglePacker. */ - public void remove(Rect rect) { + public void remove(final Rect rect) { levels.remove(rect); } /** Visits all Rects contained in this RectanglePacker. */ - public void visit(RectVisitor visitor) { + public void visit(final RectVisitor visitor) { levels.visit(visitor); } @@ -168,7 +168,7 @@ public class RectanglePacker { } // The "cause" rect may be null - private void compactImpl(Rect cause) { + private void compactImpl(final Rect cause) { // Have to either expand, compact or both. Need to figure out what // direction to go. Prefer to expand vertically. Expand // horizontally only if rectangle being added is too wide. FIXME: @@ -205,12 +205,12 @@ public class RectanglePacker { nextLevelSet = new LevelSet(newWidth, newHeight); // Make copies of all existing rectangles - List<Rect> newRects = new ArrayList<Rect>(); - for (Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) { - Level level = i1.next(); - for (Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) { - Rect cur = i2.next(); - Rect newRect = new Rect(0, 0, cur.w(), cur.h(), null); + final List<Rect> newRects = new ArrayList<Rect>(); + for (final Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) { + final Level level = i1.next(); + for (final Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) { + final Rect cur = i2.next(); + final Rect newRect = new Rect(0, 0, cur.w(), cur.h(), null); cur.setNextLocation(newRect); // Hook up the reverse mapping too for easier replacement newRect.setNextLocation(cur); @@ -222,7 +222,7 @@ public class RectanglePacker { Collections.sort(newRects, rectHComparator); // Try putting all of these rectangles into the new level set done = true; - for (Iterator<Rect> iter = newRects.iterator(); iter.hasNext(); ) { + for (final Iterator<Rect> iter = newRects.iterator(); iter.hasNext(); ) { if (!nextLevelSet.add(iter.next())) { done = false; break; @@ -268,13 +268,13 @@ public class RectanglePacker { // new locations of rectangles on the backing store. Allocate a // new backing store, move the contents over and deallocate the // old one. - Object newBackingStore = manager.allocateBackingStore(nextLevelSet.w(), + final Object newBackingStore = manager.allocateBackingStore(nextLevelSet.w(), nextLevelSet.h()); manager.beginMovement(backingStore, newBackingStore); - for (Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) { - Level level = i1.next(); - for (Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) { - Rect cur = i2.next(); + for (final Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) { + final Level level = i1.next(); + for (final Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) { + final Rect cur = i2.next(); manager.move(backingStore, cur, newBackingStore, cur.getNextLocation()); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java index a2d202d11..f5ef5672f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java @@ -77,7 +77,7 @@ public class ImageSequence implements TextureSequence { } public final void addFrame(final GL gl, final Class<?> context, final String imageResourcePath, final String imageSuffix) throws IOException { - URLConnection urlConn = IOUtil.getResource(context, imageResourcePath); + final URLConnection urlConn = IOUtil.getResource(context, imageResourcePath); if(null != urlConn) { final TextureData texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, imageSuffix); final Texture tex = new Texture(getTextureTarget()); @@ -97,7 +97,7 @@ public class ImageSequence implements TextureSequence { public final boolean getManualStepping() { return manualStepping; } public final TextureSequence.TextureFrame getFrame(final int idx) { return frames.get(idx); } - public void destroy(GL gl) throws GLException { + public void destroy(final GL gl) throws GLException { for(int i=frames.size()-1; i>=0; i--) { frames.get(i).getTexture().destroy(gl); } @@ -133,7 +133,7 @@ public class ImageSequence implements TextureSequence { } @Override - public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException { + public TextureSequence.TextureFrame getNextTexture(final GL gl) throws IllegalStateException { if( !manualStepping ) { frameIdx = ( frameIdx + 1 ) % frames.size(); } @@ -153,7 +153,7 @@ public class ImageSequence implements TextureSequence { private String textureLookupFunctionName = "myTexture2D"; @Override - public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException { + public String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException { if(useBuildInTexLookup) { return "texture2D"; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 47be0714e..e7693f4a6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -205,7 +205,7 @@ public class Texture { private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot", true); private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect", true); - public Texture(GL gl, TextureData data) throws GLException { + public Texture(final GL gl, final TextureData data) throws GLException { texID = 0; updateImage(gl, data); } @@ -216,7 +216,7 @@ public class Texture { * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D, * GL2.GL_TEXTURE_RECTANGLE */ - public Texture(int target) { + public Texture(final int target) { texID = 0; this.target = target; } @@ -278,7 +278,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void enable(GL gl) throws GLException { + public void enable(final GL gl) throws GLException { if( !gl.isGLcore() && GLES2.GL_TEXTURE_EXTERNAL_OES != target) { gl.glEnable(target); } @@ -305,7 +305,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void disable(GL gl) throws GLException { + public void disable(final GL gl) throws GLException { if( !gl.isGLcore() && GLES2.GL_TEXTURE_EXTERNAL_OES != target ) { gl.glDisable(target); } @@ -325,7 +325,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void bind(GL gl) throws GLException { + public void bind(final GL gl) throws GLException { validateTexID(gl, true); gl.glBindTexture(target, texID); } @@ -335,7 +335,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void destroy(GL gl) throws GLException { + public void destroy(final GL gl) throws GLException { if(0!=texID) { gl.glDeleteTextures(1, new int[] {texID}, 0); texID = 0; @@ -437,7 +437,7 @@ public class Texture { * * @return the texture coordinates corresponding to the specified sub-image */ - public TextureCoords getSubImageTexCoords(int x1, int y1, int x2, int y2) { + public TextureCoords getSubImageTexCoords(final int x1, final int y1, final int x2, final int y2) { if (target == GL2.GL_TEXTURE_RECTANGLE_ARB) { if (mustFlipVertically) { return new TextureCoords(x1, texHeight - y1, x2, texHeight - y2); @@ -445,12 +445,12 @@ public class Texture { return new TextureCoords(x1, y1, x2, y2); } } else { - float tx1 = (float)x1 / (float)texWidth; - float ty1 = (float)y1 / (float)texHeight; - float tx2 = (float)x2 / (float)texWidth; - float ty2 = (float)y2 / (float)texHeight; + final float tx1 = (float)x1 / (float)texWidth; + final float ty1 = (float)y1 / (float)texHeight; + final float tx2 = (float)x2 / (float)texWidth; + final float ty2 = (float)y2 / (float)texHeight; if (mustFlipVertically) { - float yMax = (float) imgHeight / (float) texHeight; + final float yMax = (float) imgHeight / (float) texHeight; return new TextureCoords(tx1, yMax - ty1, tx2, yMax - ty2); } else { return new TextureCoords(tx1, ty1, tx2, ty2); @@ -464,7 +464,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateImage(GL gl, TextureData data) throws GLException { + public void updateImage(final GL gl, final TextureData data) throws GLException { updateImage(gl, data, 0); } @@ -487,7 +487,7 @@ public class Texture { * No-op if no change, otherwise generates new {@link TextureCoords}. * </p> */ - public void setMustFlipVertically(boolean v) { + public void setMustFlipVertically(final boolean v) { if( v != mustFlipVertically ) { mustFlipVertically = v; updateTexCoords(); @@ -501,7 +501,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateImage(GL gl, TextureData data, int targetOverride) throws GLException { + public void updateImage(final GL gl, final TextureData data, final int targetOverride) throws GLException { validateTexID(gl, true); imgWidth = data.getWidth(); @@ -522,7 +522,7 @@ public class Texture { data.setHaveGL12(gl.isExtensionAvailable(GLExtensions.VERSION_1_2)); // Indicates whether both width and height are power of two - boolean isPOT = isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight); + final boolean isPOT = isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight); // Note that automatic mipmap generation doesn't work for // GL_ARB_texture_rectangle @@ -634,7 +634,7 @@ public class Texture { } if (data.getMipmap() && !haveAutoMipmapGeneration) { - int[] align = new int[1]; + final int[] align = new int[1]; gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment()); @@ -644,7 +644,7 @@ public class Texture { try { // FIXME: may need check for GLUnsupportedException - GLU glu = GLU.createGLU(gl); + final GLU glu = GLU.createGLU(gl); glu.gluBuild2DMipmaps(texTarget, data.getInternalFormat(), data.getWidth(), data.getHeight(), data.getPixelFormat(), data.getPixelType(), data.getBuffer()); @@ -653,7 +653,7 @@ public class Texture { } } else { checkCompressedTextureExtensions(gl, data); - Buffer[] mipmapData = data.getMipmapData(); + final Buffer[] mipmapData = data.getMipmapData(); if (mipmapData != null) { int width = texWidth; int height = texHeight; @@ -684,7 +684,7 @@ public class Texture { texWidth, texHeight, data.getBorder(), data.getBuffer().capacity(), data.getBuffer()); } else { - ByteBuffer buf = DDSImage.allocateBlankBuffer(texWidth, + final ByteBuffer buf = DDSImage.allocateBlankBuffer(texWidth, texHeight, data.getInternalFormat()); gl.glCompressedTexImage2D(texTarget, 0, data.getInternalFormat(), @@ -710,9 +710,9 @@ public class Texture { } } - int minFilter = (data.getMipmap() ? GL.GL_LINEAR_MIPMAP_LINEAR : GL.GL_LINEAR); - int magFilter = GL.GL_LINEAR; - int wrapMode = (gl.isExtensionAvailable(GLExtensions.VERSION_1_2) || !gl.isGL2()) ? GL.GL_CLAMP_TO_EDGE : GL2.GL_CLAMP; + final int minFilter = (data.getMipmap() ? GL.GL_LINEAR_MIPMAP_LINEAR : GL.GL_LINEAR); + final int magFilter = GL.GL_LINEAR; + final int wrapMode = (gl.isExtensionAvailable(GLExtensions.VERSION_1_2) || !gl.isGL2()) ? GL.GL_CLAMP_TO_EDGE : GL2.GL_CLAMP; // REMIND: figure out what to do for GL_TEXTURE_RECTANGLE_ARB if (texTarget != GL2.GL_TEXTURE_RECTANGLE_ARB) { @@ -720,8 +720,8 @@ public class Texture { gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_MAG_FILTER, magFilter); gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_WRAP_S, wrapMode); gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_WRAP_T, wrapMode); - if (this.target == GL2.GL_TEXTURE_CUBE_MAP) { - gl.glTexParameteri(texParamTarget, GL2.GL_TEXTURE_WRAP_R, wrapMode); + if (this.target == GL.GL_TEXTURE_CUBE_MAP) { + gl.glTexParameteri(texParamTarget, GL2ES2.GL_TEXTURE_WRAP_R, wrapMode); } } @@ -758,7 +758,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateSubImage(GL gl, TextureData data, int mipmapLevel, int x, int y) throws GLException { + public void updateSubImage(final GL gl, final TextureData data, final int mipmapLevel, final int x, final int y) throws GLException { if (usingAutoMipmapGeneration && mipmapLevel != 0) { // When we're using mipmap generation via GL_GENERATE_MIPMAP, we // don't need to update other mipmap levels @@ -798,10 +798,10 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void updateSubImage(GL gl, TextureData data, int mipmapLevel, - int dstx, int dsty, - int srcx, int srcy, - int width, int height) throws GLException { + public void updateSubImage(final GL gl, final TextureData data, final int mipmapLevel, + final int dstx, final int dsty, + final int srcx, final int srcy, + final int width, final int height) throws GLException { if (data.isDataCompressed()) { throw new GLException("updateSubImage specifying a sub-rectangle is not supported for compressed TextureData"); } @@ -823,8 +823,8 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void setTexParameterf(GL gl, int parameterName, - float value) { + public void setTexParameterf(final GL gl, final int parameterName, + final float value) { bind(gl); gl.glTexParameterf(target, parameterName, value); } @@ -836,8 +836,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameterfv(GL gl, int parameterName, - FloatBuffer params) { + public void setTexParameterfv(final GL gl, final int parameterName, + final FloatBuffer params) { bind(gl); gl.glTexParameterfv(target, parameterName, params); } @@ -849,8 +849,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameterfv(GL gl, int parameterName, - float[] params, int params_offset) { + public void setTexParameterfv(final GL gl, final int parameterName, + final float[] params, final int params_offset) { bind(gl); gl.glTexParameterfv(target, parameterName, params, params_offset); } @@ -865,8 +865,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteri(GL gl, int parameterName, - int value) { + public void setTexParameteri(final GL gl, final int parameterName, + final int value) { bind(gl); gl.glTexParameteri(target, parameterName, value); } @@ -878,8 +878,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteriv(GL gl, int parameterName, - IntBuffer params) { + public void setTexParameteriv(final GL gl, final int parameterName, + final IntBuffer params) { bind(gl); gl.glTexParameteriv(target, parameterName, params); } @@ -891,8 +891,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteriv(GL gl, int parameterName, - int[] params, int params_offset) { + public void setTexParameteriv(final GL gl, final int parameterName, + final int[] params, final int params_offset) { bind(gl); gl.glTexParameteriv(target, parameterName, params, params_offset); } @@ -908,7 +908,7 @@ public class Texture { * otherwise it may be <code>null</code>. * @see #getTextureObject() */ - public int getTextureObject(GL gl) { + public int getTextureObject(final GL gl) { validateTexID(gl, false); return texID; } @@ -957,7 +957,7 @@ public class Texture { * * @return true if the given value is a power of two, false otherwise */ - private static boolean isPowerOfTwo(int val) { + private static boolean isPowerOfTwo(final int val) { return ((val & (val - 1)) == 0); } @@ -969,7 +969,7 @@ public class Texture { * @param val the value * @return the next power of two */ - private static int nextPowerOfTwo(int val) { + private static int nextPowerOfTwo(final int val) { int ret = 1; while (ret < val) { ret <<= 1; @@ -981,7 +981,7 @@ public class Texture { * Updates the actual image dimensions; usually only called from * <code>updateImage</code>. */ - private void setImageSize(int width, int height, int target) { + private void setImageSize(final int width, final int height, final int target) { imgWidth = width; imgHeight = height; updateTexCoords(); @@ -1010,7 +1010,7 @@ public class Texture { } } - private void updateSubImageImpl(GL gl, TextureData data, int newTarget, int mipmapLevel, + private void updateSubImageImpl(final GL gl, final TextureData data, final int newTarget, final int mipmapLevel, int dstx, int dsty, int srcx, int srcy, int width, int height) throws GLException { data.setHaveEXTABGR(gl.isExtensionAvailable(GLExtensions.EXT_abgr)); @@ -1081,15 +1081,15 @@ public class Texture { data.getInternalFormat(), buffer.remaining(), buffer); } else { - int[] align = { 0 }; - int[] rowLength = { 0 }; - int[] skipRows = { 0 }; - int[] skipPixels = { 0 }; + final int[] align = { 0 }; + final int[] rowLength = { 0 }; + final int[] skipRows = { 0 }; + final int[] skipPixels = { 0 }; gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment if(gl.isGL2GL3()) { - gl.glGetIntegerv(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length - gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows - gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels + gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels } gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment()); if (DEBUG && VERBOSE) { @@ -1102,9 +1102,9 @@ public class Texture { System.out.println("height = " + height); } if(gl.isGL2GL3()) { - gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowlen); - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, srcy); - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, srcx); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlen); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, srcy); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, srcx); } else { if ( rowlen!=0 && rowlen!=width && srcy!=0 && srcx!=0 ) { @@ -1118,14 +1118,14 @@ public class Texture { buffer); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore alignment if(gl.isGL2GL3()) { - gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels } } } - private void checkCompressedTextureExtensions(GL gl, TextureData data) { + private void checkCompressedTextureExtensions(final GL gl, final TextureData data) { if (data.isDataCompressed()) { switch (data.getInternalFormat()) { case GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -1145,10 +1145,10 @@ public class Texture { } } - private boolean validateTexID(GL gl, boolean throwException) { + private boolean validateTexID(final GL gl, final boolean throwException) { if( 0 == texID ) { if( null != gl ) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenTextures(1, tmp, 0); texID = tmp[0]; if ( 0 == texID && throwException ) { @@ -1162,22 +1162,22 @@ public class Texture { } // Helper routines for disabling certain codepaths - private static boolean haveNPOT(GL gl) { + private static boolean haveNPOT(final GL gl) { return !disableNPOT && gl.isNPOTTextureAvailable(); } - private static boolean haveTexRect(GL gl) { + private static boolean haveTexRect(final GL gl) { return (!disableTexRect && TextureIO.isTexRectEnabled() && gl.isExtensionAvailable(GLExtensions.ARB_texture_rectangle)); } - private static boolean preferTexRect(GL gl) { + private static boolean preferTexRect(final GL gl) { // Prefer GL_ARB_texture_rectangle on ATI hardware on Mac OS X // due to software fallbacks if (NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { - String vendor = gl.glGetString(GL.GL_VENDOR); + final String vendor = gl.glGetString(GL.GL_VENDOR); if (vendor != null && vendor.startsWith("ATI")) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java index ba59f89c5..17fcc7016 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java @@ -48,14 +48,14 @@ package com.jogamp.opengl.util.texture; public class TextureCoords { // These represent the lower-left point - private float left; - private float bottom; + private final float left; + private final float bottom; // These represent the upper-right point - private float right; - private float top; + private final float right; + private final float top; - public TextureCoords(float left, float bottom, - float right, float top) { + public TextureCoords(final float left, final float bottom, + final float right, final float top) { this.left = left; this.bottom = bottom; this.right = right; @@ -70,7 +70,7 @@ public class TextureCoords { * right top * </pre> */ - public float[] getST_LB_RB_LT_RT(float[] d, int d_off, float ss, float ts) { + public float[] getST_LB_RB_LT_RT(final float[] d, final int d_off, final float ss, final float ts) { d[0+d_off] = left *ss; d[1+d_off] = bottom*ts; d[2+d_off] = right *ss; d[3+d_off] = bottom*ts; d[4+d_off] = left *ss; d[5+d_off] = top *ts; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index 5d88a76c0..5b2e4fc00 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -41,6 +41,7 @@ import java.nio.Buffer; import javax.media.opengl.GLProfile; +import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLBuffers; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; @@ -123,18 +124,18 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - int pixelFormat, - int pixelType, - boolean mipmap, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer buffer, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final int pixelFormat, + final int pixelType, + final boolean mipmap, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer buffer, + final Flusher flusher) throws IllegalArgumentException { this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), mipmap, dataIsCompressed, mustFlipVertically, buffer, flusher); } @@ -178,17 +179,17 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - GLPixelAttributes pixelAttributes, - boolean mipmap, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer buffer, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final GLPixelAttributes pixelAttributes, + final boolean mipmap, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer buffer, + final Flusher flusher) throws IllegalArgumentException { if (mipmap && dataIsCompressed) { throw new IllegalArgumentException("Can not generate mipmaps for compressed textures"); } @@ -247,17 +248,17 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - int pixelFormat, - int pixelType, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer[] mipmapData, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final int pixelFormat, + final int pixelType, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer[] mipmapData, + final Flusher flusher) throws IllegalArgumentException { this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), dataIsCompressed, mustFlipVertically, mipmapData, flusher); } @@ -300,16 +301,16 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - GLPixelAttributes pixelAttributes, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer[] mipmapData, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final GLPixelAttributes pixelAttributes, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer[] mipmapData, + final Flusher flusher) throws IllegalArgumentException { this.glProfile = glp; this.width = width; this.height = height; @@ -318,7 +319,7 @@ public class TextureData { this.internalFormat = internalFormat; this.dataIsCompressed = dataIsCompressed; this.mustFlipVertically = mustFlipVertically; - this.mipmapData = (Buffer[]) mipmapData.clone(); + this.mipmapData = mipmapData.clone(); this.flusher = flusher; alignment = 1; // FIXME: is this correct enough in all situations? for (int i = 0; i < mipmapData.length; i++) { @@ -336,10 +337,10 @@ public class TextureData { * Set the color space of the pixel data, which defaults to {@link ColorSpace#RGB}. * @see #getColorSpace() */ - public void setColorSpace(ColorSpace cs) { pixelCS = cs; } + public void setColorSpace(final ColorSpace cs) { pixelCS = cs; } /** Used only by subclasses */ - protected TextureData(GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; } + protected TextureData(final GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; } /** Returns the width in pixels of the texture data. */ public int getWidth() { return width; } @@ -399,20 +400,20 @@ public class TextureData { } /** Sets the width in pixels of the texture data. */ - public void setWidth(int width) { this.width = width; } + public void setWidth(final int width) { this.width = width; } /** Sets the height in pixels of the texture data. */ - public void setHeight(int height) { this.height = height; } + public void setHeight(final int height) { this.height = height; } /** Sets the border in pixels of the texture data. */ - public void setBorder(int border) { this.border = border; } + public void setBorder(final int border) { this.border = border; } /** Sets the intended OpenGL pixel format of the texture data. */ - public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } + public void setPixelAttributes(final GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } /** * Sets the intended OpenGL pixel format component of {@link GLPixelAttributes} of the texture data. * <p> * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. * </p> */ - public void setPixelFormat(int pixelFormat) { + public void setPixelFormat(final int pixelFormat) { if( pixelAttributes.format != pixelFormat ) { pixelAttributes = new GLPixelAttributes(pixelFormat, pixelAttributes.type); } @@ -423,42 +424,42 @@ public class TextureData { * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. * </p> */ - public void setPixelType(int pixelType) { + public void setPixelType(final int pixelType) { if( pixelAttributes.type != pixelType) { pixelAttributes = new GLPixelAttributes(pixelAttributes.format, pixelType); } } /** Sets the intended OpenGL internal format of the texture data. */ - public void setInternalFormat(int internalFormat) { this.internalFormat = internalFormat; } + public void setInternalFormat(final int internalFormat) { this.internalFormat = internalFormat; } /** Sets whether mipmaps should be generated for the texture data. */ - public void setMipmap(boolean mipmap) { this.mipmap = mipmap; } + public void setMipmap(final boolean mipmap) { this.mipmap = mipmap; } /** Sets whether the texture data is in compressed form. */ - public void setIsDataCompressed(boolean compressed) { this.dataIsCompressed = compressed; } + public void setIsDataCompressed(final boolean compressed) { this.dataIsCompressed = compressed; } /** Sets whether the texture coordinates must be flipped vertically for proper display. */ - public void setMustFlipVertically(boolean mustFlipVertically) { this.mustFlipVertically = mustFlipVertically; } + public void setMustFlipVertically(final boolean mustFlipVertically) { this.mustFlipVertically = mustFlipVertically; } /** Sets the texture data. */ - public void setBuffer(Buffer buffer) { + public void setBuffer(final Buffer buffer) { this.buffer = buffer; estimatedMemorySize = estimatedMemorySize(buffer); } /** Sets the required byte alignment for the texture data. */ - public void setAlignment(int alignment) { this.alignment = alignment; } + public void setAlignment(final int alignment) { this.alignment = alignment; } /** Sets the row length needed for correct GL_UNPACK_ROW_LENGTH specification. This is currently only supported for non-mipmapped, non-compressed textures. */ - public void setRowLength(int rowLength) { this.rowLength = rowLength; } + public void setRowLength(final int rowLength) { this.rowLength = rowLength; } /** Indicates to this TextureData whether the GL_EXT_abgr extension is available. Used for optimization along some code paths to avoid data copies. */ - public void setHaveEXTABGR(boolean haveEXTABGR) { + public void setHaveEXTABGR(final boolean haveEXTABGR) { this.haveEXTABGR = haveEXTABGR; } /** Indicates to this TextureData whether OpenGL version 1.2 is available. If not, falls back to relatively inefficient code paths for several input data types (several kinds of packed pixel formats, in particular). */ - public void setHaveGL12(boolean haveGL12) { + public void setHaveGL12(final boolean haveGL12) { this.haveGL12 = haveGL12; } @@ -509,10 +510,10 @@ public class TextureData { // Internals only below this point // - protected static int estimatedMemorySize(Buffer buffer) { + protected static int estimatedMemorySize(final Buffer buffer) { if (buffer == null) { return 0; } - return buffer.capacity() * GLBuffers.sizeOfBufferElem(buffer); + return buffer.capacity() * Buffers.sizeOfBufferElem(buffer); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index b2bcd0de3..19f2fc05b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -60,6 +60,7 @@ import javax.media.nativewindow.util.DimensionImmutable; import javax.media.nativewindow.util.PixelFormat; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; @@ -209,8 +210,8 @@ public class TextureIO { * registered texture providers could read the file * @throws IOException if an error occurred while reading the file */ - public static TextureData newTextureData(GLProfile glp, File file, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final File file, + final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(file); @@ -239,9 +240,9 @@ public class TextureIO { * registered texture providers could read the stream * @throws IOException if an error occurred while reading the stream */ - public static TextureData newTextureData(GLProfile glp, InputStream stream, - boolean mipmap, - String fileSuffix) throws IOException { + public static TextureData newTextureData(final GLProfile glp, final InputStream stream, + final boolean mipmap, + final String fileSuffix) throws IOException { return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix); } @@ -266,8 +267,8 @@ public class TextureIO { * registered texture providers could read the URL * @throws IOException if an error occurred while reading the URL */ - public static TextureData newTextureData(GLProfile glp, URL url, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final URL url, + final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); @@ -314,10 +315,10 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the file */ - public static TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); @@ -362,11 +363,11 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the stream */ - public static TextureData newTextureData(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException, IllegalArgumentException { + public static TextureData newTextureData(final GLProfile glp, final InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); } @@ -406,10 +407,10 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the URL */ - public static TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); @@ -435,7 +436,7 @@ public class TextureIO { * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ - public static Texture newTexture(TextureData data) throws GLException, IllegalArgumentException { + public static Texture newTexture(final TextureData data) throws GLException, IllegalArgumentException { return newTexture(GLContext.getCurrentGL(), data); } @@ -448,7 +449,7 @@ public class TextureIO { * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ - public static Texture newTexture(GL gl, TextureData data) throws GLException, IllegalArgumentException { + public static Texture newTexture(final GL gl, final TextureData data) throws GLException, IllegalArgumentException { if (data == null) { throw new IllegalArgumentException("Null TextureData"); } @@ -470,11 +471,11 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(File file, boolean mipmap) throws IOException, GLException { - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); - Texture texture = newTexture(gl, data); + public static Texture newTexture(final File file, final boolean mipmap) throws IOException, GLException { + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -499,11 +500,11 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(InputStream stream, boolean mipmap, String fileSuffix) throws IOException, GLException { - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); - Texture texture = newTexture(gl, data); + public static Texture newTexture(final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException, GLException { + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -528,14 +529,14 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(URL url, boolean mipmap, String fileSuffix) throws IOException, GLException { + public static Texture newTexture(final URL url, final boolean mipmap, String fileSuffix) throws IOException, GLException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); } - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, url, mipmap, fileSuffix); - Texture texture = newTexture(gl, data); + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, url, mipmap, fileSuffix); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -549,7 +550,7 @@ public class TextureIO { * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D, * GL.GL_TEXTURE_RECTANGLE_ARB */ - public static Texture newTexture(int target) { + public static Texture newTexture(final int target) { return new Texture(target); } @@ -579,31 +580,31 @@ public class TextureIO { * @throws GLException if no OpenGL context was current or an * OpenGL-related error occurred */ - public static void write(Texture texture, File file) throws IOException, GLException { + public static void write(final Texture texture, final File file) throws IOException, GLException { if (texture.getTarget() != GL.GL_TEXTURE_2D) { throw new GLException("Only GL_TEXTURE_2D textures are supported"); } // First fetch the texture data - GL _gl = GLContext.getCurrentGL(); + final GL _gl = GLContext.getCurrentGL(); if (!_gl.isGL2GL3()) { throw new GLException("Implementation only supports GL2GL3 (Use GLReadBufferUtil and the TextureData variant), have: " + _gl); } - GL2GL3 gl = _gl.getGL2(); + final GL2GL3 gl = _gl.getGL2(); texture.bind(gl); - int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_INTERNAL_FORMAT); - int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_WIDTH); - int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_HEIGHT); - int border = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_BORDER); + final int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_INTERNAL_FORMAT); + final int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_WIDTH); + final int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_HEIGHT); + final int border = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_BORDER); TextureData data = null; if (internalFormat == GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT3_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) { // Fetch using glGetCompressedTexImage - int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_COMPRESSED_IMAGE_SIZE); - ByteBuffer res = ByteBuffer.allocate(size); + final int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_COMPRESSED_IMAGE_SIZE); + final ByteBuffer res = ByteBuffer.allocate(size); gl.glGetCompressedTexImage(GL.GL_TEXTURE_2D, 0, res); data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE, false, true, true, res, null); @@ -612,7 +613,7 @@ public class TextureIO { int fetchedFormat = 0; switch (internalFormat) { case GL.GL_RGB: - case GL2.GL_BGR: + case GL2GL3.GL_BGR: case GL.GL_RGB8: bytesPerPixel = 3; fetchedFormat = GL.GL_RGB; @@ -629,19 +630,19 @@ public class TextureIO { } // Fetch using glGetTexImage - int packAlignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT); - int packRowLength = glGetInteger(gl, GL2.GL_PACK_ROW_LENGTH); - int packSkipRows = glGetInteger(gl, GL2.GL_PACK_SKIP_ROWS); - int packSkipPixels = glGetInteger(gl, GL2.GL_PACK_SKIP_PIXELS); - int packSwapBytes = glGetInteger(gl, GL2.GL_PACK_SWAP_BYTES); + final int packAlignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT); + final int packRowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH); + final int packSkipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS); + final int packSkipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS); + final int packSwapBytes = glGetInteger(gl, GL2GL3.GL_PACK_SWAP_BYTES); gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - gl.glPixelStorei(GL2.GL_PACK_ROW_LENGTH, 0); - gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, 0); - ByteBuffer res = ByteBuffer.allocate((width + (2 * border)) * + final ByteBuffer res = ByteBuffer.allocate((width + (2 * border)) * (height + (2 * border)) * bytesPerPixel); if (DEBUG) { @@ -651,10 +652,10 @@ public class TextureIO { gl.glGetTexImage(GL.GL_TEXTURE_2D, 0, fetchedFormat, GL.GL_UNSIGNED_BYTE, res); gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment); - gl.glPixelStorei(GL2.GL_PACK_ROW_LENGTH, packRowLength); - gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, packSkipRows); - gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels); - gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes); + gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, packSkipRows); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, packSkipPixels); + gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, packSwapBytes); data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE, false, false, false, res, null); @@ -668,9 +669,9 @@ public class TextureIO { write(data, file); } - public static void write(TextureData data, File file) throws IOException, GLException { - for (Iterator<TextureWriter> iter = textureWriters.iterator(); iter.hasNext(); ) { - TextureWriter writer = iter.next(); + public static void write(final TextureData data, final File file) throws IOException, GLException { + for (final Iterator<TextureWriter> iter = textureWriters.iterator(); iter.hasNext(); ) { + final TextureWriter writer = iter.next(); if (writer.write(file, data)) { return; } @@ -689,7 +690,7 @@ public class TextureIO { * The last provider added, will be the first provider to be tested. * </p> */ - public static void addTextureProvider(TextureProvider provider) { + public static void addTextureProvider(final TextureProvider provider) { // Must always add at the front so the ImageIO provider is last, // so we don't accidentally use it instead of a user's possibly // more optimal provider @@ -702,7 +703,7 @@ public class TextureIO { * The last provider added, will be the first provider to be tested. * </p> */ - public static void addTextureWriter(TextureWriter writer) { + public static void addTextureWriter(final TextureWriter writer) { // Must always add at the front so the ImageIO writer is last, // so we don't accidentally use it instead of a user's possibly // more optimal writer @@ -727,7 +728,7 @@ public class TextureIO { the GL_ARB_texture_rectangle extension to be turned off globally for this purpose. The default is that the use of the extension is enabled. */ - public static void setTexRectEnabled(boolean enabled) { + public static void setTexRectEnabled(final boolean enabled) { texRectEnabled = enabled; } @@ -750,10 +751,10 @@ public class TextureIO { if(GLProfile.isAWTAvailable()) { try { // Use reflection to avoid compile-time dependencies on AWT-related classes - TextureProvider provider = (TextureProvider) + final TextureProvider provider = (TextureProvider) Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance(); addTextureProvider(provider); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } @@ -771,14 +772,14 @@ public class TextureIO { if(GLProfile.isAWTAvailable()) { try { // Use reflection to avoid compile-time dependencies on AWT-related classes - TextureWriter writer = (TextureWriter) + final TextureWriter writer = (TextureWriter) Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance(); addTextureWriter(writer); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } - } catch (Error e) { + } catch (final Error e) { if (DEBUG) { e.printStackTrace(); } @@ -794,10 +795,10 @@ public class TextureIO { } // Implementation methods - private static TextureData newTextureDataImpl(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (file == null) { throw new IOException("File was null"); @@ -805,9 +806,9 @@ public class TextureIO { fileSuffix = toLowerCase(fileSuffix); - for (Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, file, + for (final Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, file, internalFormat, pixelFormat, mipmap, @@ -820,10 +821,10 @@ public class TextureIO { throw new IOException("No suitable reader for given file "+file.getAbsolutePath()); } - private static TextureData newTextureDataImpl(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (stream == null) { throw new IOException("Stream was null"); @@ -836,9 +837,9 @@ public class TextureIO { stream = new BufferedInputStream(stream); } - for (Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, stream, + for (final Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, @@ -851,10 +852,10 @@ public class TextureIO { throw new IOException("No suitable reader for given stream"); } - private static TextureData newTextureDataImpl(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (url == null) { throw new IOException("URL was null"); @@ -862,9 +863,9 @@ public class TextureIO { fileSuffix = toLowerCase(fileSuffix); - for (Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, url, + for (final Iterator<TextureProvider> iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, url, internalFormat, pixelFormat, mipmap, @@ -881,14 +882,14 @@ public class TextureIO { // DDS provider -- supports files only for now static class DDSTextureProvider implements TextureProvider { @Override - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + public TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { if (DDS.equals(fileSuffix) || DDS.equals(IOUtil.getFileSuffix(file))) { - DDSImage image = DDSImage.read(file); + final DDSImage image = DDSImage.read(file); return newTextureData(glp, image, internalFormat, pixelFormat, mipmap); } @@ -896,16 +897,16 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + public TextureData newTextureData(final GLProfile glp, final InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { if (DDS.equals(fileSuffix) || DDSImage.isDDSImage(stream)) { - byte[] data = IOUtil.copyStream2ByteArray(stream); - ByteBuffer buf = ByteBuffer.wrap(data); - DDSImage image = DDSImage.read(buf); + final byte[] data = IOUtil.copyStream2ByteArray(stream); + final ByteBuffer buf = ByteBuffer.wrap(data); + final DDSImage image = DDSImage.read(buf); return newTextureData(glp, image, internalFormat, pixelFormat, mipmap); } @@ -913,12 +914,12 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream stream = new BufferedInputStream(url.openStream()); + public TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream stream = new BufferedInputStream(url.openStream()); try { return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } finally { @@ -926,11 +927,11 @@ public class TextureIO { } } - private TextureData newTextureData(GLProfile glp, final DDSImage image, + private TextureData newTextureData(final GLProfile glp, final DDSImage image, int internalFormat, int pixelFormat, boolean mipmap) { - DDSImage.ImageInfo info = image.getMipMap(0); + final DDSImage.ImageInfo info = image.getMipMap(0); if (pixelFormat == 0) { switch (image.getPixelFormat()) { case DDSImage.D3DFMT_R8G8B8: @@ -967,7 +968,7 @@ public class TextureIO { break; } } - TextureData.Flusher flusher = new TextureData.Flusher() { + final TextureData.Flusher flusher = new TextureData.Flusher() { @Override public void flush() { image.close(); @@ -975,7 +976,7 @@ public class TextureIO { }; TextureData data; if (mipmap && image.getNumMipMaps() > 0) { - Buffer[] mipmapData = new Buffer[image.getNumMipMaps()]; + final Buffer[] mipmapData = new Buffer[image.getNumMipMaps()]; for (int i = 0; i < image.getNumMipMaps(); i++) { mipmapData[i] = image.getMipMap(i).getData(); } @@ -1013,12 +1014,12 @@ public class TextureIO { // Base class for SGI RGB and TGA image providers static abstract class StreamBasedTextureProvider implements TextureProvider { @Override - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream inStream = new BufferedInputStream(new FileInputStream(file)); + public TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream inStream = new BufferedInputStream(new FileInputStream(file)); try { // The SGIImage and TGAImage implementations use InputStreams // anyway so there isn't much point in having a separate code @@ -1034,12 +1035,12 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream stream = new BufferedInputStream(url.openStream()); + public TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream stream = new BufferedInputStream(url.openStream()); try { return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } finally { @@ -1052,15 +1053,15 @@ public class TextureIO { // SGI RGB image provider static class SGITextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (SGI.equals(fileSuffix) || SGI_RGB.equals(fileSuffix) || SGIImage.isSGIImage(stream)) { - SGIImage image = SGIImage.read(stream); + final SGIImage image = SGIImage.read(stream); if (pixelFormat == 0) { pixelFormat = image.getFormat(); } @@ -1088,13 +1089,13 @@ public class TextureIO { // TGA (Targa) image provider static class TGATextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (TGA.equals(fileSuffix)) { - TGAImage image = TGAImage.read(glp, stream); + final TGAImage image = TGAImage.read(glp, stream); if (pixelFormat == 0) { pixelFormat = image.getGLFormat(); } @@ -1126,11 +1127,11 @@ public class TextureIO { // PNG image provider static class PNGTextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (PNG.equals(fileSuffix)) { final PNGPixelRect image = PNGPixelRect.read(stream, null, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */); final GLPixelAttributes glpa = GLPixelAttributes.convert(image.getPixelformat(), glp); @@ -1166,13 +1167,13 @@ public class TextureIO { // JPEG image provider static class JPGTextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (JPG.equals(fileSuffix)) { - JPEGImage image = JPEGImage.read(/*glp, */ stream); + final JPEGImage image = JPEGImage.read(/*glp, */ stream); if (pixelFormat == 0) { pixelFormat = image.getGLFormat(); } @@ -1205,8 +1206,8 @@ public class TextureIO { // static class DDSTextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { + public boolean write(final File file, + final TextureData data) throws IOException { if (DDS.equals(IOUtil.getFileSuffix(file))) { // See whether the DDS writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1239,7 +1240,7 @@ public class TextureIO { mipmaps = new ByteBuffer[] { (ByteBuffer) data.getBuffer() }; } - DDSImage image = DDSImage.createFromData(d3dFormat, + final DDSImage image = DDSImage.createFromData(d3dFormat, data.getWidth(), data.getHeight(), mipmaps); @@ -1256,9 +1257,9 @@ public class TextureIO { // static class SGITextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { - String fileSuffix = IOUtil.getFileSuffix(file); + public boolean write(final File file, + final TextureData data) throws IOException { + final String fileSuffix = IOUtil.getFileSuffix(file); if (SGI.equals(fileSuffix) || SGI_RGB.equals(fileSuffix)) { // See whether the SGI writer can handle this TextureData @@ -1269,7 +1270,7 @@ public class TextureIO { pixelFormat == GL.GL_RGBA) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { - ByteBuffer buf = ((data.getBuffer() != null) ? + final ByteBuffer buf = ((data.getBuffer() != null) ? (ByteBuffer) data.getBuffer() : (ByteBuffer) data.getMipmapData()[0]); byte[] bytes; @@ -1282,7 +1283,7 @@ public class TextureIO { buf.rewind(); } - SGIImage image = SGIImage.createFromData(data.getWidth(), + final SGIImage image = SGIImage.createFromData(data.getWidth(), data.getHeight(), (pixelFormat == GL.GL_RGBA), bytes); @@ -1302,8 +1303,8 @@ public class TextureIO { static class TGATextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { + public boolean write(final File file, + final TextureData data) throws IOException { if (TGA.equals(IOUtil.getFileSuffix(file))) { // See whether the TGA writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1311,7 +1312,7 @@ public class TextureIO { final int pixelType = pixelAttribs.type; if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2.GL_BGR || + pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { @@ -1324,16 +1325,16 @@ public class TextureIO { if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) { // Must reverse order of red and blue channels to get correct results - int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4); + final int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4); for (int i = 0; i < buf.remaining(); i += skip) { - byte red = buf.get(i + 0); - byte blue = buf.get(i + 2); + final byte red = buf.get(i + 0); + final byte blue = buf.get(i + 2); buf.put(i + 0, blue); buf.put(i + 2, red); } } - TGAImage image = TGAImage.createFromData(data.getWidth(), + final TGAImage image = TGAImage.createFromData(data.getWidth(), data.getHeight(), (pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA), false, buf); @@ -1353,7 +1354,7 @@ public class TextureIO { static class PNGTextureWriter implements TextureWriter { @Override - public boolean write(File file, TextureData data) throws IOException { + public boolean write(final File file, final TextureData data) throws IOException { if (PNG.equals(IOUtil.getFileSuffix(file))) { // See whether the PNG writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1403,19 +1404,19 @@ public class TextureIO { // Helper routines // - private static int glGetInteger(GL gl, int pname) { - int[] tmp = new int[1]; + private static int glGetInteger(final GL gl, final int pname) { + final int[] tmp = new int[1]; gl.glGetIntegerv(pname, tmp, 0); return tmp[0]; } - private static int glGetTexLevelParameteri(GL2GL3 gl, int target, int level, int pname) { - int[] tmp = new int[1]; + private static int glGetTexLevelParameteri(final GL2GL3 gl, final int target, final int level, final int pname) { + final int[] tmp = new int[1]; gl.glGetTexLevelParameteriv(target, 0, pname, tmp, 0); return tmp[0]; } - private static String toLowerCase(String arg) { + private static String toLowerCase(final String arg) { if (arg == null) { return null; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java index ee3b600a5..5add4f695 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java @@ -114,11 +114,11 @@ public interface TextureSequence { * to associated related data. */ public static class TextureFrame extends TimeFrameI { - public TextureFrame(Texture t, int pts, int duration) { + public TextureFrame(final Texture t, final int pts, final int duration) { super(pts, duration); texture = t; } - public TextureFrame(Texture t) { + public TextureFrame(final Texture t) { texture = t; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java index d8320c690..467ab41c5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java @@ -53,7 +53,7 @@ public class TextureState { * Returns <code>0</code> is <code>textureTarget</code> is not supported. * </p> */ - public static final int getTextureTargetQueryName(int textureTarget) { + public static final int getTextureTargetQueryName(final int textureTarget) { final int texBindQName; switch(textureTarget) { case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break; @@ -61,7 +61,7 @@ public class TextureState { case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break; case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break; case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break; - case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break; + case GL.GL_TEXTURE_2D_ARRAY: texBindQName = GL.GL_TEXTURE_BINDING_2D_ARRAY; break; case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break; case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break; case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; @@ -84,9 +84,9 @@ public class TextureState { */ private final int[] state = new int[] { 0, 0, 0, 0, 0, 0 }; - private static final String toHexString(int i) { return "0x"+Integer.toHexString(i); } + private static final String toHexString(final int i) { return "0x"+Integer.toHexString(i); } - private static final int activeTexture(GL gl) { + private static final int activeTexture(final GL gl) { final int[] vi = { 0 }; gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, vi, 0); return vi[0]; @@ -99,7 +99,7 @@ public class TextureState { * @param textureTarget * @throws GLException if textureTarget is not supported */ - public TextureState(GL gl, int textureTarget) throws GLException { + public TextureState(final GL gl, final int textureTarget) throws GLException { this(gl, activeTexture(gl), textureTarget); } @@ -111,7 +111,7 @@ public class TextureState { * @param textureTarget * @throws GLException if textureTarget is not supported */ - public TextureState(GL gl, int textureUnit, int textureTarget) throws GLException { + public TextureState(final GL gl, final int textureUnit, final int textureTarget) throws GLException { target = textureTarget; state[0] = textureUnit; final int texBindQName = getTextureTargetQueryName(textureTarget); @@ -132,7 +132,7 @@ public class TextureState { * </p> * @param gl current GL context's GL object */ - public final void restore(GL gl) { + public final void restore(final GL gl) { gl.glActiveTexture(state[0]); gl.glBindTexture(target, state[1]); gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, state[2]); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index 202c08e4e..ccb3ecc3c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -113,11 +113,11 @@ public class AWTTextureData extends TextureData { * texture * @param image the image containing the texture data */ - public AWTTextureData(GLProfile glp, - int internalFormat, - int pixelFormat, - boolean mipmap, - BufferedImage image) { + public AWTTextureData(final GLProfile glp, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final BufferedImage image) { super(glp); if (internalFormat == 0) { this.internalFormat = image.getColorModel().hasAlpha() ? GL.GL_RGBA : GL.GL_RGB; @@ -176,7 +176,7 @@ public class AWTTextureData extends TextureData { return buffer; } - private void createFromImage(GLProfile glp, BufferedImage image) { + private void createFromImage(final GLProfile glp, final BufferedImage image) { pixelAttributes = GLPixelAttributes.UNDEF; // Determine from image mustFlipVertically = true; @@ -185,7 +185,7 @@ public class AWTTextureData extends TextureData { int scanlineStride; - SampleModel sm = image.getRaster().getSampleModel(); + final SampleModel sm = image.getRaster().getSampleModel(); if (sm instanceof SinglePixelPackedSampleModel) { scanlineStride = ((SinglePixelPackedSampleModel)sm).getScanlineStride(); @@ -300,7 +300,7 @@ public class AWTTextureData extends TextureData { case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_CUSTOM: default: - java.awt.image.ColorModel cm = image.getColorModel(); + final java.awt.image.ColorModel cm = image.getColorModel(); if (cm.equals(rgbColorModel)) { pixelAttributes = new GLPixelAttributes(GL.GL_RGB, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 3; @@ -362,7 +362,7 @@ public class AWTTextureData extends TextureData { case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_CUSTOM: default: - java.awt.image.ColorModel cm = image.getColorModel(); + final java.awt.image.ColorModel cm = image.getColorModel(); if (cm.equals(rgbColorModel)) { pixelAttributes = new GLPixelAttributes(GL.GL_RGB, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 3; @@ -382,9 +382,9 @@ public class AWTTextureData extends TextureData { createNIOBufferFromImage(image); } - private void setupLazyCustomConversion(BufferedImage image) { + private void setupLazyCustomConversion(final BufferedImage image) { imageForLazyCustomConversion = image; - boolean hasAlpha = image.getColorModel().hasAlpha(); + final boolean hasAlpha = image.getColorModel().hasAlpha(); int pixelFormat = pixelAttributes.format; int pixelType = pixelAttributes.type; if (pixelFormat == 0) { @@ -395,7 +395,7 @@ public class AWTTextureData extends TextureData { // Allow previously-selected pixelType (if any) to override that // we can infer from the DataBuffer - DataBuffer data = image.getRaster().getDataBuffer(); + final DataBuffer data = image.getRaster().getDataBuffer(); if (data instanceof DataBufferByte || isPackedInt(image)) { // Don't use GL_UNSIGNED_INT for BufferedImage packed int images if (pixelType == 0) pixelType = GL.GL_UNSIGNED_BYTE; @@ -405,7 +405,7 @@ public class AWTTextureData extends TextureData { if (pixelType == 0) pixelType = GL.GL_FLOAT; } else if (data instanceof DataBufferInt) { // FIXME: should we support signed ints? - if (pixelType == 0) pixelType = GL2GL3.GL_UNSIGNED_INT; + if (pixelType == 0) pixelType = GL.GL_UNSIGNED_INT; } else if (data instanceof DataBufferShort) { if (pixelType == 0) pixelType = GL.GL_SHORT; } else if (data instanceof DataBufferUShort) { @@ -416,12 +416,12 @@ public class AWTTextureData extends TextureData { pixelAttributes = new GLPixelAttributes(pixelFormat, pixelType); } - private void createFromCustom(BufferedImage image) { - int width = image.getWidth(); - int height = image.getHeight(); + private void createFromCustom(final BufferedImage image) { + final int width = image.getWidth(); + final int height = image.getHeight(); // create a temporary image that is compatible with OpenGL - boolean hasAlpha = image.getColorModel().hasAlpha(); + final boolean hasAlpha = image.getColorModel().hasAlpha(); java.awt.image.ColorModel cm = null; int dataBufferType = image.getRaster().getDataBuffer().getDataType(); // Don't use integer components for packed int images @@ -444,13 +444,13 @@ public class AWTTextureData extends TextureData { } } - boolean premult = cm.isAlphaPremultiplied(); - WritableRaster raster = + final boolean premult = cm.isAlphaPremultiplied(); + final WritableRaster raster = cm.createCompatibleWritableRaster(width, height); - BufferedImage texImage = new BufferedImage(cm, raster, premult, null); + final BufferedImage texImage = new BufferedImage(cm, raster, premult, null); // copy the source image into the temporary image - Graphics2D g = texImage.createGraphics(); + final Graphics2D g = texImage.createGraphics(); g.setComposite(AlphaComposite.Src); g.drawImage(image, 0, 0, null); g.dispose(); @@ -459,8 +459,8 @@ public class AWTTextureData extends TextureData { createNIOBufferFromImage(texImage); } - private boolean isPackedInt(BufferedImage image) { - int imgType = image.getType(); + private boolean isPackedInt(final BufferedImage image) { + final int imgType = image.getType(); return (imgType == BufferedImage.TYPE_INT_RGB || imgType == BufferedImage.TYPE_INT_BGR || imgType == BufferedImage.TYPE_INT_ARGB || @@ -476,11 +476,11 @@ public class AWTTextureData extends TextureData { setupLazyCustomConversion(imageForLazyCustomConversion); } - private void createNIOBufferFromImage(BufferedImage image) { + private void createNIOBufferFromImage(final BufferedImage image) { buffer = wrapImageDataBuffer(image); } - private Buffer wrapImageDataBuffer(BufferedImage image) { + private Buffer wrapImageDataBuffer(final BufferedImage image) { // // Note: Grabbing the DataBuffer will defeat Java2D's image // management mechanism (as of JDK 5/6, at least). This shouldn't @@ -490,7 +490,7 @@ public class AWTTextureData extends TextureData { // it could be. // - DataBuffer data = image.getRaster().getDataBuffer(); + final DataBuffer data = image.getRaster().getDataBuffer(); if (data instanceof DataBufferByte) { return ByteBuffer.wrap(((DataBufferByte) data).getData()); } else if (data instanceof DataBufferDouble) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java index c70f5d0f3..c3b3adc75 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java @@ -59,8 +59,8 @@ public class AWTTextureIO extends TextureIO { * * @see #newTextureData(GLProfile, BufferedImage, boolean) */ - public static TextureData newTextureData(GLProfile glp, BufferedImage image, - boolean mipmap) { + public static TextureData newTextureData(final GLProfile glp, final BufferedImage image, + final boolean mipmap) { return newTextureDataImpl(glp, image, 0, 0, mipmap); } @@ -89,10 +89,10 @@ public class AWTTextureIO extends TextureIO { * @throws IllegalArgumentException if either internalFormat or * pixelFormat was 0 */ - public static TextureData newTextureData(GLProfile glp, BufferedImage image, - int internalFormat, - int pixelFormat, - boolean mipmap) throws IllegalArgumentException { + public static TextureData newTextureData(final GLProfile glp, final BufferedImage image, + final int internalFormat, + final int pixelFormat, + final boolean mipmap) throws IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); } @@ -112,18 +112,18 @@ public class AWTTextureIO extends TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(GLProfile glp, BufferedImage image, boolean mipmap) throws GLException { - TextureData data = newTextureData(glp, image, mipmap); - Texture texture = newTexture(data); + public static Texture newTexture(final GLProfile glp, final BufferedImage image, final boolean mipmap) throws GLException { + final TextureData data = newTextureData(glp, image, mipmap); + final Texture texture = newTexture(data); data.flush(); return texture; } - private static TextureData newTextureDataImpl(GLProfile glp, - BufferedImage image, - int internalFormat, - int pixelFormat, - boolean mipmap) { + private static TextureData newTextureDataImpl(final GLProfile glp, + final BufferedImage image, + final int internalFormat, + final int pixelFormat, + final boolean mipmap) { return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, image); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java index 7311f20b3..20fc92819 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java @@ -52,6 +52,7 @@ import java.nio.channels.FileChannel; import javax.media.opengl.GL; +import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.GLBuffers; @@ -67,13 +68,13 @@ public class DDSImage { that information in another way. */ public static class ImageInfo { - private ByteBuffer data; - private int width; - private int height; - private boolean isCompressed; - private int compressionFormat; + private final ByteBuffer data; + private final int width; + private final int height; + private final boolean isCompressed; + private final int compressionFormat; - public ImageInfo(ByteBuffer data, int width, int height, boolean compressed, int compressionFormat) { + public ImageInfo(final ByteBuffer data, final int width, final int height, final boolean compressed, final int compressionFormat) { this.data = data; this.width = width; this.height = height; this.isCompressed = compressed; this.compressionFormat = compressionFormat; } @@ -163,7 +164,7 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(String filename) throws IOException { + public static DDSImage read(final String filename) throws IOException { return read(new File(filename)); } @@ -174,8 +175,8 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(File file) throws IOException { - DDSImage image = new DDSImage(); + public static DDSImage read(final File file) throws IOException { + final DDSImage image = new DDSImage(); image.readFromFile(file); return image; } @@ -187,8 +188,8 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(ByteBuffer buf) throws IOException { - DDSImage image = new DDSImage(); + public static DDSImage read(final ByteBuffer buf) throws IOException { + final DDSImage image = new DDSImage(); image.readFromBuffer(buf); return image; } @@ -207,7 +208,7 @@ public class DDSImage { fis = null; } buf = null; - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -228,11 +229,11 @@ public class DDSImage { * specified arguments * @return DDS image object */ - public static DDSImage createFromData(int d3dFormat, - int width, - int height, - ByteBuffer[] mipmapData) throws IllegalArgumentException { - DDSImage image = new DDSImage(); + public static DDSImage createFromData(final int d3dFormat, + final int width, + final int height, + final ByteBuffer[] mipmapData) throws IllegalArgumentException { + final DDSImage image = new DDSImage(); image.initFromData(d3dFormat, width, height, mipmapData); return image; } @@ -256,7 +257,7 @@ public class DDSImage { in.mark(4); int magic = 0; for (int i = 0; i < 4; i++) { - int tmp = in.read(); + final int tmp = in.read(); if (tmp < 0) { in.reset(); return false; @@ -272,7 +273,7 @@ public class DDSImage { * @param filename File name to write to * @throws java.io.IOException if an I/O exception occurred */ - public void write(String filename) throws IOException { + public void write(final String filename) throws IOException { write(new File(filename)); } @@ -281,12 +282,12 @@ public class DDSImage { * @param file File object to write to * @throws java.io.IOException if an I/O exception occurred */ - public void write(File file) throws IOException { - FileOutputStream stream = IOUtil.getFileOutputStream(file, true); - FileChannel chan = stream.getChannel(); + public void write(final File file) throws IOException { + final FileOutputStream stream = IOUtil.getFileOutputStream(file, true); + final FileChannel chan = stream.getChannel(); // Create ByteBuffer for header in case the start of our // ByteBuffer isn't actually memory-mapped - ByteBuffer hdr = ByteBuffer.allocate(Header.writtenSize()); + final ByteBuffer hdr = ByteBuffer.allocate(Header.writtenSize()); hdr.order(ByteOrder.LITTLE_ENDIAN); header.write(hdr); hdr.rewind(); @@ -302,12 +303,12 @@ public class DDSImage { * @param flag DDSD_* flags set to test * @return true if flag present or false otherwise */ - public boolean isSurfaceDescFlagSet(int flag) { + public boolean isSurfaceDescFlagSet(final int flag) { return ((header.flags & flag) != 0); } /** Test for presence/absence of pixel format flags (DDPF_*) */ - public boolean isPixelFormatFlagSet(int flag) { + public boolean isPixelFormatFlagSet(final int flag) { return ((header.pfFlags & flag) != 0); } @@ -357,7 +358,7 @@ public class DDSImage { * @param side Side to test * @return true if side present or false otherwise */ - public boolean isCubemapSidePresent(int side) { + public boolean isCubemapSidePresent(final int side) { return isCubemap() && (header.ddsCaps2 & side) != 0; } @@ -402,7 +403,7 @@ public class DDSImage { * @param map Mipmap index * @return Image object */ - public ImageInfo getMipMap(int map) { + public ImageInfo getMipMap(final int map) { return getMipMap( 0, map ); } @@ -412,7 +413,7 @@ public class DDSImage { * @param map Mipmap index * @return Image object */ - public ImageInfo getMipMap(int side, int map) { + public ImageInfo getMipMap(final int side, final int map) { if (!isCubemap() && (side != 0)) { throw new RuntimeException( "Illegal side for 2D texture: " + side ); } @@ -434,7 +435,7 @@ public class DDSImage { } buf.limit(seek + mipMapSizeInBytes(map)); buf.position(seek); - ByteBuffer next = buf.slice(); + final ByteBuffer next = buf.slice(); buf.position(0); buf.limit(buf.capacity()); return new ImageInfo(next, mipMapWidth(map), mipMapHeight(map), isCompressed(), getCompressionFormat()); @@ -454,12 +455,12 @@ public class DDSImage { * @param side Cubemap side or 0 for 2D texture * @return Mipmap image objects set */ - public ImageInfo[] getAllMipMaps( int side ) { + public ImageInfo[] getAllMipMaps( final int side ) { int numLevels = getNumMipMaps(); if (numLevels == 0) { numLevels = 1; } - ImageInfo[] result = new ImageInfo[numLevels]; + final ImageInfo[] result = new ImageInfo[numLevels]; for (int i = 0; i < numLevels; i++) { result[i] = getMipMap(side, i); } @@ -472,9 +473,9 @@ public class DDSImage { @return String format code */ public static String getCompressionFormatName(int compressionFormat) { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < 4; i++) { - char c = (char) (compressionFormat & 0xFF); + final char c = (char) (compressionFormat & 0xFF); buf.append(c); compressionFormat = compressionFormat >> 8; } @@ -491,9 +492,9 @@ public class DDSImage { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, or GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. */ - public static ByteBuffer allocateBlankBuffer(int width, - int height, - int openGLInternalFormat) { + public static ByteBuffer allocateBlankBuffer(final int width, + final int height, + final int openGLInternalFormat) { int size = width * height; switch (openGLInternalFormat) { case GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -511,15 +512,15 @@ public class DDSImage { } if (size == 0) size = 1; - return GLBuffers.newDirectByteBuffer(size); + return Buffers.newDirectByteBuffer(size); } public void debugPrint() { - PrintStream tty = System.err; + final PrintStream tty = System.err; tty.println("Compressed texture: " + isCompressed()); if (isCompressed()) { - int fmt = getCompressionFormat(); - String name = getCompressionFormatName(fmt); + final int fmt = getCompressionFormat(); + final String name = getCompressionFormatName(fmt); tty.println("Compression format: 0x" + Integer.toHexString(fmt) + " (" + name + ")"); } tty.println("Width: " + header.width + " Height: " + header.height); @@ -567,7 +568,7 @@ public class DDSImage { tty.println("Raw pixel format flags: 0x" + Integer.toHexString(header.pfFlags)); tty.println("Depth: " + getDepth()); tty.println("Number of mip maps: " + getNumMipMaps()); - int fmt = getPixelFormat(); + final int fmt = getPixelFormat(); tty.print("Pixel format: "); switch (fmt) { case D3DFMT_R8G8B8: tty.println("D3DFMT_R8G8B8"); break; @@ -629,8 +630,8 @@ public class DDSImage { int ddsCapsReserved2; int textureStage; // stage in multitexture cascade - void read(ByteBuffer buf) throws IOException { - int magic = buf.getInt(); + void read(final ByteBuffer buf) throws IOException { + final int magic = buf.getInt(); if (magic != MAGIC) { throw new IOException("Incorrect magic number 0x" + Integer.toHexString(magic) + @@ -671,7 +672,7 @@ public class DDSImage { } // buf must be in little-endian byte order - void write(ByteBuffer buf) { + void write(final ByteBuffer buf) { buf.putInt(MAGIC); buf.putInt(size); buf.putInt(flags); @@ -722,15 +723,15 @@ public class DDSImage { private DDSImage() { } - private void readFromFile(File file) throws IOException { + private void readFromFile(final File file) throws IOException { fis = new FileInputStream(file); chan = fis.getChannel(); - ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, + final ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, 0, (int) file.length()); readFromBuffer(buf); } - private void readFromBuffer(ByteBuffer buf) throws IOException { + private void readFromBuffer(final ByteBuffer buf) throws IOException { this.buf = buf; buf.order(ByteOrder.LITTLE_ENDIAN); header = new Header(); @@ -738,10 +739,10 @@ public class DDSImage { fixupHeader(); } - private void initFromData(int d3dFormat, - int width, - int height, - ByteBuffer[] mipmapData) throws IllegalArgumentException { + private void initFromData(final int d3dFormat, + final int width, + final int height, + final ByteBuffer[] mipmapData) throws IllegalArgumentException { // Check size of mipmap data compared against format, width and // height int topmostMipmapSize = width * height; @@ -784,7 +785,7 @@ public class DDSImage { // OK, create one large ByteBuffer to hold all of the mipmap data totalSize += Header.writtenSize(); - ByteBuffer buf = ByteBuffer.allocate(totalSize); + final ByteBuffer buf = ByteBuffer.allocate(totalSize); buf.position(Header.writtenSize()); for (int i = 0; i < mipmapData.length; i++) { buf.put(mipmapData[i]); @@ -845,10 +846,10 @@ public class DDSImage { } } - private static int computeCompressedBlockSize(int width, - int height, - int depth, - int compressionFormat) { + private static int computeCompressedBlockSize(final int width, + final int height, + final int depth, + final int compressionFormat) { int blockSize = ((width + 3)/4) * ((height + 3)/4) * ((depth + 3)/4); switch (compressionFormat) { case D3DFMT_DXT1: blockSize *= 8; break; @@ -857,10 +858,10 @@ public class DDSImage { return blockSize; } - private static int computeBlockSize(int width, - int height, - int depth, - int pixelFormat) { + private static int computeBlockSize(final int width, + final int height, + final int depth, + final int pixelFormat) { int blocksize; switch (pixelFormat) { case D3DFMT_R8G8B8: @@ -883,7 +884,7 @@ public class DDSImage { return blocksize; } - private int mipMapWidth(int map) { + private int mipMapWidth(final int map) { int width = getWidth(); for (int i = 0; i < map; i++) { width >>= 1; @@ -891,7 +892,7 @@ public class DDSImage { return Math.max(width, 1); } - private int mipMapHeight(int map) { + private int mipMapHeight(final int map) { int height = getHeight(); for (int i = 0; i < map; i++) { height >>= 1; @@ -899,11 +900,11 @@ public class DDSImage { return Math.max(height, 1); } - private int mipMapSizeInBytes(int map) { - int width = mipMapWidth(map); - int height = mipMapHeight(map); + private int mipMapSizeInBytes(final int map) { + final int width = mipMapWidth(map); + final int height = mipMapHeight(map); if (isCompressed()) { - int blockSize = (getCompressionFormat() == D3DFMT_DXT1 ? 8 : 16); + final int blockSize = (getCompressionFormat() == D3DFMT_DXT1 ? 8 : 16); return ((width+3)/4)*((height+3)/4)*blockSize; } else { return width * height * (getDepth() / 8); @@ -924,8 +925,8 @@ public class DDSImage { return size; } - private int sideShiftInBytes(int side) { - int[] sides = { + private int sideShiftInBytes(final int side) { + final int[] sides = { DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, @@ -935,9 +936,9 @@ public class DDSImage { }; int shift = 0; - int sideSize = sideSizeInBytes(); + final int sideSize = sideSizeInBytes(); for (int i = 0; i < sides.length; i++) { - int temp = sides[i]; + final int temp = sides[i]; if ((temp & side) != 0) { return shift; } @@ -948,7 +949,7 @@ public class DDSImage { throw new RuntimeException("Illegal side: " + side); } - private boolean printIfRecognized(PrintStream tty, int flags, int flag, String what) { + private boolean printIfRecognized(final PrintStream tty, final int flags, final int flag, final String what) { if ((flags & flag) != 0) { tty.println(what); return true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java index 2081788ba..66a486f9b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java @@ -51,12 +51,12 @@ public class JPEGImage { * @return * @throws IOException */ - public static JPEGImage read(InputStream in, ColorSpace cs) throws IOException { + public static JPEGImage read(final InputStream in, final ColorSpace cs) throws IOException { return new JPEGImage(in, cs); } /** Reads a JPEG image from the specified InputStream, using the {@link ColorSpace#RGB}. */ - public static JPEGImage read(InputStream in) throws IOException { + public static JPEGImage read(final InputStream in) throws IOException { return new JPEGImage(in, ColorSpace.RGB); } @@ -68,7 +68,7 @@ public class JPEGImage { final ColorSpace storageCS; ByteBuffer data = null; - JPEGColorSink(ColorSpace storageCM) { + JPEGColorSink(final ColorSpace storageCM) { this.storageCS = storageCM; switch(storageCS) { case RGB: @@ -81,7 +81,7 @@ public class JPEGImage { } @Override - public final ColorSpace allocate(int width, int height, ColorSpace sourceCM, int sourceComponents) throws RuntimeException { + public final ColorSpace allocate(final int width, final int height, final ColorSpace sourceCM, final int sourceComponents) throws RuntimeException { this.width = width; this.height = height; this.sourceComponents = sourceComponents; @@ -91,7 +91,7 @@ public class JPEGImage { } @Override - public final void storeRGB(int x, int y, byte r, byte g, byte b) { + public final void storeRGB(final int x, final int y, final byte r, final byte g, final byte b) { int i = ( ( height - y - 1 ) * width + x ) * storageComponents; data.put(i++, r); data.put(i++, g); @@ -100,12 +100,12 @@ public class JPEGImage { } @Override - public final void store2(int x, int y, byte c1, byte c2) { + public final void store2(final int x, final int y, final byte c1, final byte c2) { throw new RuntimeException("not supported yet"); } @Override - public final void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr) { + public final void storeYCbCr(final int x, final int y, final byte Y, final byte Cb, final byte Cr) { int i = ( ( height - y - 1 ) * width + x ) * storageComponents; data.put(i++, Y); data.put(i++, Cb); @@ -118,7 +118,7 @@ public class JPEGImage { } }; - private JPEGImage(InputStream in, ColorSpace cs) throws IOException { + private JPEGImage(final InputStream in, final ColorSpace cs) throws IOException { pixelStorage = new JPEGColorSink(cs); final JPEGDecoder decoder = new JPEGDecoder(); decoder.parse(in); @@ -139,9 +139,9 @@ public class JPEGImage { } decoder.clear(null); } - private JPEGColorSink pixelStorage; + private final JPEGColorSink pixelStorage; private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel; - private boolean reversedChannels; + private final boolean reversedChannels; private final ByteBuffer data; /** Returns the color space of the pixel data */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java index 3c90d96e4..f121478e7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java @@ -76,7 +76,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput */ DataInputStream dataIn; - public LEDataInputStream(InputStream in) + public LEDataInputStream(final InputStream in) { super(in); dataIn = new DataInputStream(in); @@ -90,32 +90,32 @@ public class LEDataInputStream extends FilterInputStream implements DataInput } @Override - public synchronized final int read(byte b[]) throws IOException + public synchronized final int read(final byte b[]) throws IOException { return dataIn.read(b, 0, b.length); } @Override - public synchronized final int read(byte b[], int off, int len) throws IOException + public synchronized final int read(final byte b[], final int off, final int len) throws IOException { - int rl = dataIn.read(b, off, len); + final int rl = dataIn.read(b, off, len); return rl; } @Override - public final void readFully(byte b[]) throws IOException + public final void readFully(final byte b[]) throws IOException { dataIn.readFully(b, 0, b.length); } @Override - public final void readFully(byte b[], int off, int len) throws IOException + public final void readFully(final byte b[], final int off, final int len) throws IOException { dataIn.readFully(b, off, len); } @Override - public final int skipBytes(int n) throws IOException + public final int skipBytes(final int n) throws IOException { return dataIn.skipBytes(n); } @@ -123,7 +123,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final boolean readBoolean() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return (ch != 0); @@ -132,7 +132,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final byte readByte() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); @@ -141,7 +141,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readUnsignedByte() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return ch; @@ -150,8 +150,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final short readShort() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 0) + (ch2 << 8)); @@ -160,8 +160,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readUnsignedShort() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 0) + (ch2 << 8); @@ -170,8 +170,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final char readChar() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 0) + (ch2 << 8)); @@ -180,10 +180,10 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readInt() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); - int ch3 = dataIn.read(); - int ch4 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); + final int ch3 = dataIn.read(); + final int ch4 = dataIn.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24)); @@ -192,9 +192,9 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final long readLong() throws IOException { - int i1 = readInt(); - int i2 = readInt(); - return ((long)i1 & 0xFFFFFFFFL) + ((long)i2 << 32); + final int i1 = readInt(); + final int i2 = readInt(); + return (i1 & 0xFFFFFFFFL) + ((long)i2 << 32); } @Override @@ -233,7 +233,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput * dont call this it is not implemented * @return empty new string **/ - public final static String readUTF(DataInput in) throws IOException + public final static String readUTF(final DataInput in) throws IOException { return new String(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java index 93b097500..add177546 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java @@ -72,7 +72,7 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput */ DataOutputStream dataOut; - public LEDataOutputStream(OutputStream out) + public LEDataOutputStream(final OutputStream out) { super(out); dataOut = new DataOutputStream(out); @@ -86,44 +86,44 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput } @Override - public synchronized final void write(byte b[]) throws IOException + public synchronized final void write(final byte b[]) throws IOException { dataOut.write(b, 0, b.length); } @Override - public synchronized final void write(byte b[], int off, int len) throws IOException + public synchronized final void write(final byte b[], final int off, final int len) throws IOException { dataOut.write(b, off, len); } @Override - public final void write(int b) throws IOException + public final void write(final int b) throws IOException { dataOut.write(b); } @Override - public final void writeBoolean(boolean v) throws IOException + public final void writeBoolean(final boolean v) throws IOException { dataOut.writeBoolean(v); } @Override - public final void writeByte(int v) throws IOException + public final void writeByte(final int v) throws IOException { dataOut.writeByte(v); } /** Don't call this -- not implemented */ @Override - public final void writeBytes(String s) throws IOException + public final void writeBytes(final String s) throws IOException { throw new UnsupportedOperationException(); } @Override - public final void writeChar(int v) throws IOException + public final void writeChar(final int v) throws IOException { dataOut.writeChar(((v >> 8) & 0xff) | ((v & 0xff) << 8)); @@ -131,25 +131,25 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput /** Don't call this -- not implemented */ @Override - public final void writeChars(String s) throws IOException + public final void writeChars(final String s) throws IOException { throw new UnsupportedOperationException(); } @Override - public final void writeDouble(double v) throws IOException + public final void writeDouble(final double v) throws IOException { writeLong(Double.doubleToRawLongBits(v)); } @Override - public final void writeFloat(float v) throws IOException + public final void writeFloat(final float v) throws IOException { writeInt(Float.floatToRawIntBits(v)); } @Override - public final void writeInt(int v) throws IOException + public final void writeInt(final int v) throws IOException { dataOut.writeInt((v >>> 24) | ((v >>> 8) & 0xff00) | @@ -158,14 +158,14 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput } @Override - public final void writeLong(long v) throws IOException + public final void writeLong(final long v) throws IOException { writeInt((int) v); writeInt((int) (v >>> 32)); } @Override - public final void writeShort(int v) throws IOException + public final void writeShort(final int v) throws IOException { dataOut.writeShort(((v >> 8) & 0xff) | ((v & 0xff) << 8)); @@ -173,7 +173,7 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput /** Don't call this -- not implemented */ @Override - public final void writeUTF(String s) throws IOException + public final void writeUTF(final String s) throws IOException { throw new UnsupportedOperationException(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java index cabf4ebc5..461ddceb8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -63,7 +63,7 @@ public class NetPbmTextureWriter implements TextureWriter { * magic 7 - PAM binary RGB or RGBA * </pre> */ - public NetPbmTextureWriter(int magic) { + public NetPbmTextureWriter(final int magic) { switch(magic) { case 0: case 6: @@ -85,7 +85,7 @@ public class NetPbmTextureWriter implements TextureWriter { public String getSuffix() { return (magic==6)?PPM:PAM; } @Override - public boolean write(File file, TextureData data) throws IOException { + public boolean write(final File file, final TextureData data) throws IOException { boolean res; final int magic_old = magic; @@ -107,12 +107,12 @@ public class NetPbmTextureWriter implements TextureWriter { return res; } - private boolean writeImpl(File file, TextureData data) throws IOException { + private boolean writeImpl(final File file, final TextureData data) throws IOException { int pixelFormat = data.getPixelFormat(); final int pixelType = data.getPixelType(); if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2.GL_BGR || + pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { @@ -123,13 +123,13 @@ public class NetPbmTextureWriter implements TextureWriter { } buf.rewind(); - int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; + final int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; - if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) { + if( pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) { // Must reverse order of red and blue channels to get correct results for (int i = 0; i < buf.remaining(); i += comps) { - byte red = buf.get(i + 0); - byte blue = buf.get(i + 2); + final byte red = buf.get(i + 0); + final byte blue = buf.get(i + 2); buf.put(i + 0, blue); buf.put(i + 2, red); } @@ -141,9 +141,9 @@ public class NetPbmTextureWriter implements TextureWriter { throw new IOException("NetPbmTextureWriter magic 6 (PPM) doesn't RGBA pixel format, use magic 7 (PAM)"); } - FileOutputStream fos = IOUtil.getFileOutputStream(file, true); + final FileOutputStream fos = IOUtil.getFileOutputStream(file, true); - StringBuilder header = new StringBuilder(); + final StringBuilder header = new StringBuilder(); header.append("P"); header.append(magic); header.append("\n"); @@ -173,7 +173,7 @@ public class NetPbmTextureWriter implements TextureWriter { fos.write(header.toString().getBytes()); - FileChannel fosc = fos.getChannel(); + final FileChannel fosc = fos.getChannel(); fosc.write(buf); fosc.force(true); fosc.close(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java index cbc8e652f..27549dfe3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java @@ -54,7 +54,7 @@ import com.jogamp.common.util.IOUtil; */ public class SGIImage { - private Header header; + private final Header header; private int format; private byte[] data; // Used for decoding RLE-compressed images @@ -105,7 +105,7 @@ public class SGIImage { magic = MAGIC; } - Header(DataInputStream in) throws IOException { + Header(final DataInputStream in) throws IOException { magic = in.readShort(); storage = in.readByte(); bpc = in.readByte(); @@ -116,13 +116,13 @@ public class SGIImage { pixmin = in.readInt(); pixmax = in.readInt(); dummy = in.readInt(); - byte[] tmpname = new byte[80]; + final byte[] tmpname = new byte[80]; in.read(tmpname); int numChars = 0; while (tmpname[numChars++] != 0); imagename = new String(tmpname, 0, numChars); colormap = in.readInt(); - byte[] tmp = new byte[404]; + final byte[] tmp = new byte[404]; in.read(tmp); } @@ -142,21 +142,21 @@ public class SGIImage { } } - private SGIImage(Header header) { + private SGIImage(final Header header) { this.header = header; } /** Reads an SGI image from the specified file. */ - public static SGIImage read(String filename) throws IOException { + public static SGIImage read(final String filename) throws IOException { return read(new FileInputStream(filename)); } /** Reads an SGI image from the specified InputStream. */ - public static SGIImage read(InputStream in) throws IOException { - DataInputStream dIn = new DataInputStream(new BufferedInputStream(in)); + public static SGIImage read(final InputStream in) throws IOException { + final DataInputStream dIn = new DataInputStream(new BufferedInputStream(in)); - Header header = new Header(dIn); - SGIImage res = new SGIImage(header); + final Header header = new Header(dIn); + final SGIImage res = new SGIImage(header); res.decodeImage(dIn); return res; } @@ -164,28 +164,28 @@ public class SGIImage { /** Writes this SGIImage to the specified file name. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order. */ - public void write(String filename, boolean flipVertically) throws IOException { + public void write(final String filename, final boolean flipVertically) throws IOException { write(new File(filename), flipVertically); } /** Writes this SGIImage to the specified file. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order. */ - public void write(File file, boolean flipVertically) throws IOException { + public void write(final File file, final boolean flipVertically) throws IOException { writeImage(file, data, header.xsize, header.ysize, header.zsize, flipVertically); } /** Creates an SGIImage from the specified data in either RGB or RGBA format. */ - public static SGIImage createFromData(int width, - int height, - boolean hasAlpha, - byte[] data) { - Header header = new Header(); + public static SGIImage createFromData(final int width, + final int height, + final boolean hasAlpha, + final byte[] data) { + final Header header = new Header(); header.xsize = (short) width; header.ysize = (short) height; header.zsize = (short) (hasAlpha ? 4 : 3); - SGIImage image = new SGIImage(header); + final SGIImage image = new SGIImage(header); image.data = data; return image; } @@ -201,9 +201,9 @@ public class SGIImage { if (!in.markSupported()) { throw new IOException("Can not test non-destructively whether given InputStream is an SGI RGB image"); } - DataInputStream dIn = new DataInputStream(in); + final DataInputStream dIn = new DataInputStream(in); dIn.mark(4); - short magic = dIn.readShort(); + final short magic = dIn.readShort(); dIn.reset(); return (magic == MAGIC); } @@ -236,10 +236,10 @@ public class SGIImage { // Internals only below this point // - private void decodeImage(DataInputStream in) throws IOException { + private void decodeImage(final DataInputStream in) throws IOException { if (header.storage == 1) { // Read RLE compression data; row starts and sizes - int x = header.ysize * header.zsize; + final int x = header.ysize * header.zsize; rowStart = new int[x]; rowSize = new int[x]; rleEnd = 4 * 2 * x + 512; @@ -253,16 +253,16 @@ public class SGIImage { } tmpData = readAll(in); - int xsize = header.xsize; - int ysize = header.ysize; - int zsize = header.zsize; + final int xsize = header.xsize; + final int ysize = header.ysize; + final int zsize = header.zsize; int lptr = 0; data = new byte[xsize * ysize * 4]; - byte[] rbuf = new byte[xsize]; - byte[] gbuf = new byte[xsize]; - byte[] bbuf = new byte[xsize]; - byte[] abuf = new byte[xsize]; + final byte[] rbuf = new byte[xsize]; + final byte[] gbuf = new byte[xsize]; + final byte[] bbuf = new byte[xsize]; + final byte[] abuf = new byte[xsize]; for (int y = 0; y < ysize; y++) { if (zsize >= 4) { getRow(rbuf, y, 0); @@ -293,15 +293,15 @@ public class SGIImage { header.zsize = 4; } - private void getRow(byte[] buf, int y, int z) { + private void getRow(final byte[] buf, final int y, final int z) { if (header.storage == 1) { - int offs = rowStart[y + z * header.ysize] - rleEnd; + final int offs = rowStart[y + z * header.ysize] - rleEnd; System.arraycopy(tmpData, offs, tmpRead, 0, rowSize[y + z * header.ysize]); int iPtr = 0; int oPtr = 0; for (;;) { byte pixel = tmpRead[iPtr++]; - int count = (int) (pixel & 0x7F); + int count = pixel & 0x7F; if (count == 0) { return; } @@ -317,12 +317,12 @@ public class SGIImage { } } } else { - int offs = (y * header.xsize) + (z * header.xsize * header.ysize); + final int offs = (y * header.xsize) + (z * header.xsize * header.ysize); System.arraycopy(tmpData, offs, buf, 0, header.xsize); } } - private void bwtorgba(byte[] b, byte[] dest, int lptr) { + private void bwtorgba(final byte[] b, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = b[i]; dest[4 * i + lptr + 1] = b[i]; @@ -331,7 +331,7 @@ public class SGIImage { } } - private void latorgba(byte[] b, byte[] a, byte[] dest, int lptr) { + private void latorgba(final byte[] b, final byte[] a, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = b[i]; dest[4 * i + lptr + 1] = b[i]; @@ -340,7 +340,7 @@ public class SGIImage { } } - private void rgbtorgba(byte[] r, byte[] g, byte[] b, byte[] dest, int lptr) { + private void rgbtorgba(final byte[] r, final byte[] g, final byte[] b, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = r[i]; dest[4 * i + lptr + 1] = g[i]; @@ -349,7 +349,7 @@ public class SGIImage { } } - private void rgbatorgba(byte[] r, byte[] g, byte[] b, byte[] a, byte[] dest, int lptr) { + private void rgbatorgba(final byte[] r, final byte[] g, final byte[] b, final byte[] a, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = r[i]; dest[4 * i + lptr + 1] = g[i]; @@ -358,19 +358,19 @@ public class SGIImage { } } - private static byte imgref(byte[] i, - int x, - int y, - int z, - int xs, - int ys, - int zs) { + private static byte imgref(final byte[] i, + final int x, + final int y, + final int z, + final int xs, + final int ys, + final int zs) { return i[(xs*ys*z)+(xs*y)+x]; } - private void writeHeader(DataOutputStream stream, - int xsize, int ysize, int zsize, boolean rle) throws IOException { + private void writeHeader(final DataOutputStream stream, + final int xsize, final int ysize, final int zsize, final boolean rle) throws IOException { // effects: outputs the 512-byte IRIS RGB header to STREAM, using xsize, // ysize, and depth as the dimensions of the image. NOTE that // the following defaults are used: @@ -415,14 +415,14 @@ public class SGIImage { stream.write(0); } - private void writeImage(File file, + private void writeImage(final File file, byte[] data, - int xsize, - int ysize, - int zsize, - boolean yflip) throws IOException { + final int xsize, + final int ysize, + final int zsize, + final boolean yflip) throws IOException { // Input data is in RGBRGBRGB or RGBARGBARGBA format; first unswizzle it - byte[] tmpData = new byte[xsize * ysize * zsize]; + final byte[] tmpData = new byte[xsize * ysize * zsize]; int dest = 0; for (int i = 0; i < zsize; i++) { for (int j = i; j < (xsize * ysize * zsize); j += zsize) { @@ -447,8 +447,8 @@ public class SGIImage { // x axis). // Build the offset tables - int[] starttab = new int[ysize * zsize]; - int[] lengthtab = new int[ysize * zsize]; + final int[] starttab = new int[ysize * zsize]; + final int[] lengthtab = new int[ysize * zsize]; // Temporary buffer for holding RLE data. // Note that this makes the assumption that RLE-compressed data will @@ -459,8 +459,8 @@ public class SGIImage { // empirical evidence here; the break-even point seems to be a look- // ahead of 3. (That is, if the three values following this one are all // the same as the current value, switch to repeat mode.) - int lookahead = 3; - byte[] rlebuf = new byte[2 * xsize * ysize * zsize]; + final int lookahead = 3; + final byte[] rlebuf = new byte[2 * xsize * ysize * zsize]; int cur_loc = 0; // current offset location. int ptr = 0; @@ -475,7 +475,7 @@ public class SGIImage { yincr = -1; } - boolean DEBUG = false; + final boolean DEBUG = false; for (int z = 0; z < zsize; z++) { for (int y = ystart; y != yend; y += yincr) { @@ -485,7 +485,7 @@ public class SGIImage { byte count = 0; boolean repeat_mode = false; boolean should_switch = false; - int start_ptr = ptr; + final int start_ptr = ptr; int num_ptr = ptr++; byte repeat_val = 0; @@ -566,7 +566,7 @@ public class SGIImage { x++; } // output this row's length into the length table - int rowlen = ptr - start_ptr; + final int rowlen = ptr - start_ptr; if (yflip) lengthtab[ysize*z+(ysize-y-1)] = rowlen; else @@ -587,11 +587,11 @@ public class SGIImage { if (DEBUG) System.err.println("total_size was " + total_size); - DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true))); + final DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true))); writeHeader(stream, xsize, ysize, zsize, true); - int SIZEOF_INT = 4; + final int SIZEOF_INT = 4; for (int i = 0; i < (ysize * zsize); i++) stream.writeInt(starttab[i] + 512 + (2 * ysize * zsize * SIZEOF_INT)); for (int i = 0; i < (ysize * zsize); i++) @@ -602,7 +602,7 @@ public class SGIImage { stream.close(); } - private byte[] readAll(DataInputStream in) throws IOException { + private byte[] readAll(final DataInputStream in) throws IOException { byte[] dest = new byte[16384]; int pos = 0; int numRead = 0; @@ -613,7 +613,7 @@ public class SGIImage { numRead = in.read(dest, pos, dest.length - pos); if (pos == dest.length) { // Resize destination buffer - byte[] newDest = new byte[2 * dest.length]; + final byte[] newDest = new byte[2 * dest.length]; System.arraycopy(dest, 0, newDest, 0, pos); dest = newDest; } @@ -626,7 +626,7 @@ public class SGIImage { // Trim destination buffer if (pos != dest.length) { - byte[] finalDest = new byte[pos]; + final byte[] finalDest = new byte[pos]; System.arraycopy(dest, 0, finalDest, 0, pos); dest = finalDest; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java index 15cd63eb3..28823abb3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java @@ -71,12 +71,12 @@ import com.jogamp.common.util.IOUtil; */ public class TGAImage { - private Header header; + private final Header header; private int format; private int bpp; private ByteBuffer data; - private TGAImage(Header header) { + private TGAImage(final Header header) { this.header = header; } @@ -114,7 +114,7 @@ public class TGAImage { public final static int I_FOURWAY = 2; /** Type of this TGA file format */ - private int tgaType; + private final int tgaType; /** initial TGA image data fields */ private int idLength; // byte value @@ -142,7 +142,7 @@ public class TGAImage { tgaType = TYPE_OLD; // dont try and get footer. } - Header(LEDataInputStream in) throws IOException { + Header(final LEDataInputStream in) throws IOException { tgaType = TYPE_OLD; // dont try and get footer. // initial header fields @@ -220,24 +220,24 @@ public class TGAImage { public int size() { return 18 + idLength; } // buf must be in little-endian byte order - private void write(ByteBuffer buf) { + private void write(final ByteBuffer buf) { buf.put((byte) idLength); buf.put((byte) colorMapType); buf.put((byte) imageType); buf.putShort((short) firstEntryIndex); buf.putShort((short) colorMapLength); - buf.put((byte) colorMapEntrySize); + buf.put(colorMapEntrySize); buf.putShort((short) xOrigin); buf.putShort((short) yOrigin); buf.putShort((short) width); buf.putShort((short) height); - buf.put((byte) pixelDepth); - buf.put((byte) imageDescriptor); + buf.put(pixelDepth); + buf.put(imageDescriptor); if (idLength > 0) { try { - byte[] chars = imageID.getBytes("US-ASCII"); + final byte[] chars = imageID.getBytes("US-ASCII"); buf.put(chars); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } } @@ -250,7 +250,7 @@ public class TGAImage { * it into the JimiImage structure. This was taken from the * prototype and modified for the new Jimi structure */ - private void decodeImage(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeImage(final GLProfile glp, final LEDataInputStream dIn) throws IOException { switch (header.imageType()) { case Header.UCOLORMAPPED: throw new IOException("TGADecoder Uncompressed Colormapped images not supported"); @@ -294,14 +294,14 @@ public class TGAImage { * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ - private void decodeRGBImageU24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeRGBImageU24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException { setupImage24_32(glp); int i; // row index int y; // output row index - int rawWidth = header.width() * bpp; - byte[] rawBuf = new byte[rawWidth]; - byte[] tmpData = new byte[rawWidth * header.height()]; + final int rawWidth = header.width() * bpp; + final byte[] rawBuf = new byte[rawWidth]; + final byte[] tmpData = new byte[rawWidth * header.height()]; for (i = 0; i < header.height(); ++i) { dIn.readFully(rawBuf, 0, rawWidth); @@ -323,12 +323,12 @@ public class TGAImage { * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ - private void decodeRGBImageRLE24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeRGBImageRLE24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException { setupImage24_32(glp); - byte[] pixel = new byte[bpp]; - int rawWidth = header.width() * bpp; - byte[] tmpData = new byte[rawWidth * header.height()]; + final byte[] pixel = new byte[bpp]; + final int rawWidth = header.width() * bpp; + final byte[] tmpData = new byte[rawWidth * header.height()]; int i = 0, j; int packet, len; while (i < tmpData.length) { @@ -348,7 +348,7 @@ public class TGAImage { data = ByteBuffer.wrap(tmpData); } - private void setupImage24_32(GLProfile glp) { + private void setupImage24_32(final GLProfile glp) { bpp = header.pixelDepth / 8; switch (header.pixelDepth) { case 24: @@ -367,7 +367,7 @@ public class TGAImage { } } - private static void swapBGR(byte[] data, int bWidth, int height, int bpp) { + private static void swapBGR(final byte[] data, final int bWidth, final int height, final int bpp) { byte r,b; int k; for(int i=0; i<height; ++i) { @@ -398,30 +398,30 @@ public class TGAImage { public ByteBuffer getData() { return data; } /** Reads a Targa image from the specified file. */ - public static TGAImage read(GLProfile glp, String filename) throws IOException { + public static TGAImage read(final GLProfile glp, final String filename) throws IOException { return read(glp, new FileInputStream(filename)); } /** Reads a Targa image from the specified InputStream. */ - public static TGAImage read(GLProfile glp, InputStream in) throws IOException { - LEDataInputStream dIn = new LEDataInputStream(new BufferedInputStream(in)); + public static TGAImage read(final GLProfile glp, final InputStream in) throws IOException { + final LEDataInputStream dIn = new LEDataInputStream(new BufferedInputStream(in)); - Header header = new Header(dIn); - TGAImage res = new TGAImage(header); + final Header header = new Header(dIn); + final TGAImage res = new TGAImage(header); res.decodeImage(glp, dIn); return res; } /** Writes the image in Targa format to the specified file name. */ - public void write(String filename) throws IOException { + public void write(final String filename) throws IOException { write(new File(filename)); } /** Writes the image in Targa format to the specified file. */ - public void write(File file) throws IOException { - FileOutputStream stream = IOUtil.getFileOutputStream(file, true); - FileChannel chan = stream.getChannel(); - ByteBuffer buf = ByteBuffer.allocate(header.size()); + public void write(final File file) throws IOException { + final FileOutputStream stream = IOUtil.getFileOutputStream(file, true); + final FileChannel chan = stream.getChannel(); + final ByteBuffer buf = ByteBuffer.allocate(header.size()); buf.order(ByteOrder.LITTLE_ENDIAN); header.write(buf); buf.rewind(); @@ -437,19 +437,19 @@ public class TGAImage { data with the passed ByteBuffer. Assumes the data is already in the correct byte order for writing to disk, i.e., BGR or BGRA. */ - public static TGAImage createFromData(int width, - int height, - boolean hasAlpha, - boolean topToBottom, - ByteBuffer data) { - Header header = new Header(); + public static TGAImage createFromData(final int width, + final int height, + final boolean hasAlpha, + final boolean topToBottom, + final ByteBuffer data) { + final Header header = new Header(); header.imageType = Header.UTRUECOLOR; header.width = width; header.height = height; header.pixelDepth = (byte) (hasAlpha ? 32 : 24); header.imageDescriptor = (byte) (topToBottom ? Header.ID_TOPTOBOTTOM : 0); // Note ID not supported - TGAImage ret = new TGAImage(header); + final TGAImage ret = new TGAImage(header); ret.data = data; return ret; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java index 18ad429d2..4174adf52 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java @@ -55,12 +55,12 @@ public class IIOTextureProvider implements TextureProvider { private static final boolean DEBUG = Debug.debug("TextureIO"); @Override - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - BufferedImage img = ImageIO.read(file); + public TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final BufferedImage img = ImageIO.read(file); if (img == null) { return null; } @@ -72,12 +72,12 @@ public class IIOTextureProvider implements TextureProvider { } @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - BufferedImage img = ImageIO.read(stream); + public TextureData newTextureData(final GLProfile glp, final InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final BufferedImage img = ImageIO.read(stream); if (img == null) { return null; } @@ -89,12 +89,12 @@ public class IIOTextureProvider implements TextureProvider { } @Override - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream stream = url.openStream(); + public TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream stream = url.openStream(); try { return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } finally { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java index be82e4fb8..60ac5680e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java @@ -54,10 +54,10 @@ import com.jogamp.opengl.util.texture.spi.*; public class IIOTextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { - int pixelFormat = data.getPixelFormat(); - int pixelType = data.getPixelType(); + public boolean write(final File file, + final TextureData data) throws IOException { + final int pixelFormat = data.getPixelFormat(); + final int pixelType = data.getPixelType(); if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA) && (pixelType == GL.GL_BYTE || @@ -68,7 +68,7 @@ public class IIOTextureWriter implements TextureWriter { (pixelFormat == GL.GL_RGB) ? BufferedImage.TYPE_3BYTE_BGR : BufferedImage.TYPE_4BYTE_ABGR); - byte[] imageData = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); + final byte[] imageData = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); ByteBuffer buf = (ByteBuffer) data.getBuffer(); if (buf == null) { buf = (ByteBuffer) data.getMipmapData()[0]; @@ -80,17 +80,17 @@ public class IIOTextureWriter implements TextureWriter { // Swizzle image components to be correct if (pixelFormat == GL.GL_RGB) { for (int i = 0; i < imageData.length; i += 3) { - byte red = imageData[i + 0]; - byte blue = imageData[i + 2]; + final byte red = imageData[i + 0]; + final byte blue = imageData[i + 2]; imageData[i + 0] = blue; imageData[i + 2] = red; } } else { for (int i = 0; i < imageData.length; i += 4) { - byte red = imageData[i + 0]; - byte green = imageData[i + 1]; - byte blue = imageData[i + 2]; - byte alpha = imageData[i + 3]; + final byte red = imageData[i + 0]; + final byte green = imageData[i + 1]; + final byte blue = imageData[i + 2]; + final byte alpha = imageData[i + 3]; imageData[i + 0] = alpha; imageData[i + 1] = blue; imageData[i + 2] = green; @@ -104,9 +104,9 @@ public class IIOTextureWriter implements TextureWriter { // Happened to notice that writing RGBA images to JPEGS is broken if (TextureIO.JPG.equals(IOUtil.getFileSuffix(file)) && image.getType() == BufferedImage.TYPE_4BYTE_ABGR) { - BufferedImage tmpImage = new BufferedImage(image.getWidth(), image.getHeight(), + final BufferedImage tmpImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); - Graphics g = tmpImage.getGraphics(); + final Graphics g = tmpImage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); image = tmpImage; |