summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
committerSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
commit556d92b63555a085b25e32b1cd55afce24edd07a (patch)
tree6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/util
parenta90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/AudioSampleFormat.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java117
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java51
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java148
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java135
-rw-r--r--src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java109
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java94
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java108
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java114
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java102
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java64
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java36
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java45
74 files changed, 960 insertions, 953 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
index 89e01edd8..3119b96ca 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
@@ -42,30 +42,30 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
public class GLArrayHandlerInterleaved extends GLVBOArrayHandler {
private final List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
- public GLArrayHandlerInterleaved(GLArrayDataEditable ad) {
+ public GLArrayHandlerInterleaved(final GLArrayDataEditable ad) {
super(ad);
}
@Override
- public final void setSubArrayVBOName(int vboName) {
+ public final void setSubArrayVBOName(final int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
}
}
@Override
- public final void addSubHandler(GLArrayHandlerFlat handler) {
+ public final void addSubHandler(final GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
- private final void syncSubData(GL gl, Object ext) {
+ private final void syncSubData(final GL gl, final Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
}
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
if(enable) {
final boolean vboBound = bindBuffer(gl, true);
syncSubData(gl, ext);
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
index 8a587980d..66be98215 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
@@ -40,22 +40,22 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
*/
public class GLDataArrayHandler extends GLVBOArrayHandler {
- public GLDataArrayHandler(GLArrayDataEditable ad) {
+ public GLDataArrayHandler(final GLArrayDataEditable ad) {
super(ad);
}
@Override
- public final void setSubArrayVBOName(int vboName) {
+ public final void setSubArrayVBOName(final int vboName) {
throw new UnsupportedOperationException();
}
@Override
- public final void addSubHandler(GLArrayHandlerFlat handler) {
+ public final void addSubHandler(final GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
if(enable) {
if(!ad.isVBO()) {
// makes no sense otherwise
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
index 7f7a99a2d..f5869c6ba 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
@@ -39,22 +39,22 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
* represents this array only.
*/
public class GLFixedArrayHandler extends GLVBOArrayHandler {
- public GLFixedArrayHandler(GLArrayDataEditable ad) {
+ public GLFixedArrayHandler(final GLArrayDataEditable ad) {
super(ad);
}
@Override
- public final void setSubArrayVBOName(int vboName) {
+ public final void setSubArrayVBOName(final int vboName) {
throw new UnsupportedOperationException();
}
@Override
- public final void addSubHandler(GLArrayHandlerFlat handler) {
+ public final void addSubHandler(final GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
final boolean vboBound = bindBuffer(gl, true);
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
index acec0510f..b5fa2f0e5 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
@@ -39,9 +39,9 @@ import com.jogamp.opengl.util.GLArrayDataWrapper;
* separately and interleaves many arrays.
*/
public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
- private GLArrayDataWrapper ad;
+ private final GLArrayDataWrapper ad;
- public GLFixedArrayHandlerFlat(GLArrayDataWrapper ad) {
+ public GLFixedArrayHandlerFlat(final GLArrayDataWrapper ad) {
this.ad = ad;
}
@@ -51,7 +51,7 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
}
@Override
- public final void syncData(GL gl, Object ext) {
+ public final void syncData(final GL gl, final Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
switch(ad.getIndex()) {
case GLPointerFunc.GL_VERTEX_ARRAY:
@@ -72,7 +72,7 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
glp.glEnableClientState(ad.getIndex());
diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
index 5198cacfa..7bc1ef1ef 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
@@ -41,12 +41,12 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
public abstract class GLVBOArrayHandler implements GLArrayHandler {
protected GLArrayDataEditable ad;
- public GLVBOArrayHandler(GLArrayDataEditable ad) {
+ public GLVBOArrayHandler(final GLArrayDataEditable ad) {
this.ad = ad;
}
@Override
- public final boolean bindBuffer(GL gl, boolean bind) {
+ public final boolean bindBuffer(final GL gl, final boolean bind) {
if( !ad.isVBO() ) {
return false;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/AudioSampleFormat.java b/src/jogl/classes/jogamp/opengl/util/av/AudioSampleFormat.java
index fdbcc9864..4c48b90e8 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/AudioSampleFormat.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/AudioSampleFormat.java
@@ -54,7 +54,7 @@ public enum AudioSampleFormat {
* </pre>
* @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. SampleFormat.values().length-1 ]
*/
- public static AudioSampleFormat valueOf(int ordinal) throws IllegalArgumentException {
+ public static AudioSampleFormat valueOf(final int ordinal) throws IllegalArgumentException {
final AudioSampleFormat[] all = AudioSampleFormat.values();
if( 0 <= ordinal && ordinal < all.length ) {
return all[ordinal];
diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
index 25686a170..f9df9153f 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
@@ -50,14 +50,14 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
public final int id;
- TextureType(int id){
+ TextureType(final int id){
this.id = id;
}
}
public static class EGLTextureFrame extends TextureSequence.TextureFrame {
- public EGLTextureFrame(Buffer clientBuffer, Texture t, long khrImage, long khrSync) {
+ public EGLTextureFrame(final Buffer clientBuffer, final Texture t, final long khrImage, final long khrSync) {
super(t);
this.clientBuffer = clientBuffer;
this.image = khrImage;
@@ -78,14 +78,14 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
- protected EGLMediaPlayerImpl(TextureType texType, boolean useKHRSync) {
+ protected EGLMediaPlayerImpl(final TextureType texType, final boolean useKHRSync) {
super();
this.texType = texType;
this.useKHRSync = useKHRSync;
}
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ protected TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) {
final Texture texture = super.createTexImageImpl(gl, texName, getWidth(), getHeight());
final Buffer clientBuffer;
final long image;
@@ -106,7 +106,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
if(TextureType.KHRImage == texType) {
- IntBuffer nioTmp = Buffers.newDirectIntBuffer(1);
+ final IntBuffer nioTmp = Buffers.newDirectIntBuffer(1);
// create EGLImage from texture
clientBuffer = null; // FIXME
nioTmp.put(0, EGL.EGL_NONE);
@@ -122,7 +122,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
if(useKHRSync) {
- IntBuffer tmp = Buffers.newDirectIntBuffer(1);
+ final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
// Create sync object so that we can be sure that gl has finished
// rendering the EGLImage texture before we tell OpenMAX to fill
// it with a new frame.
@@ -138,7 +138,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
@Override
- protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
+ protected void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) {
final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
final EGLContext eglCtx;
final EGLExt eglExt;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 73b14b3d1..9cfa94a60 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -37,6 +37,7 @@ import java.util.Map;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
+import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLDrawableFactory;
@@ -201,7 +202,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final void setTextureUnit(int u) { texUnit = u; }
+ public final void setTextureUnit(final int u) { texUnit = u; }
@Override
public final int getTextureUnit() { return texUnit; }
@@ -216,20 +217,20 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
@Override
public final int getTextureCount() { return textureCount; }
- protected final void setTextureTarget(int target) { textureTarget=target; }
- protected final void setTextureFormat(int internalFormat, int format) {
+ protected final void setTextureTarget(final int target) { textureTarget=target; }
+ protected final void setTextureFormat(final int internalFormat, final int format) {
textureInternalFormat=internalFormat;
textureFormat=format;
}
- protected final void setTextureType(int t) { textureType=t; }
+ protected final void setTextureType(final int t) { textureType=t; }
@Override
- public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];}
+ public final void setTextureMinMagFilter(final int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];}
@Override
public final int[] getTextureMinMagFilter() { return texMinMagFilter; }
@Override
- public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];}
+ public final void setTextureWrapST(final int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];}
@Override
public final int[] getTextureWrapST() { return texWrapST; }
@@ -253,7 +254,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
checkGLInit();
switch(textureTarget) {
case GL.GL_TEXTURE_2D:
- case GL2.GL_TEXTURE_RECTANGLE:
+ case GL2GL3.GL_TEXTURE_RECTANGLE:
return TextureSequence.sampler2D;
case GLES2.GL_TEXTURE_EXTERNAL_OES:
return TextureSequence.samplerExternalOES;
@@ -269,7 +270,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* if not overridden by specialization.
*/
@Override
- public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
+ public String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException {
checkGLInit();
return "texture2D";
}
@@ -355,10 +356,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected abstract boolean playImpl();
@Override
- public final State pause(boolean flush) {
+ public final State pause(final boolean flush) {
return pauseImpl(flush, 0);
}
- private final State pauseImpl(boolean flush, int event_mask) {
+ private final State pauseImpl(final boolean flush, int event_mask) {
synchronized( stateLock ) {
final State preState = state;
if( State.Playing == state ) {
@@ -384,10 +385,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected abstract boolean pauseImpl();
@Override
- public final State destroy(GL gl) {
+ public final State destroy(final GL gl) {
return destroyImpl(gl, 0);
}
- private final State destroyImpl(GL gl, int event_mask) {
+ private final State destroyImpl(final GL gl, final int event_mask) {
synchronized( stateLock ) {
if( null != streamWorker ) {
streamWorker.doStop();
@@ -475,7 +476,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* at {@link AudioSink#enqueueData(com.jogamp.opengl.util.av.AudioSink.AudioFrame)}.
* </p>
*/
- protected boolean setPlaySpeedImpl(float rate) {
+ protected boolean setPlaySpeedImpl(final float rate) {
if( null != audioSink ) {
audioSinkPlaySpeedSet = audioSink.setPlaySpeed(rate);
}
@@ -521,7 +522,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
/**
* Override if not using AudioSink, or AudioSink's {@link AudioSink#setVolume(float)} is not sufficient!
*/
- protected boolean setAudioVolumeImpl(float v) {
+ protected boolean setAudioVolumeImpl(final float v) {
if( null != audioSink ) {
return audioSink.setVolume(v);
}
@@ -530,7 +531,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final void initStream(URI streamLoc, final int vid, final int aid, int reqTextureCount) throws IllegalStateException, IllegalArgumentException {
+ public final void initStream(final URI streamLoc, final int vid, final int aid, final int reqTextureCount) throws IllegalStateException, IllegalArgumentException {
synchronized( stateLock ) {
if(State.Uninitialized != state) {
throw new IllegalStateException("Instance not in state unintialized: "+this);
@@ -577,7 +578,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
try {
// StreamWorker may be used, see API-doc of StreamWorker
initStreamImpl(vid, aid);
- } catch (Throwable t) {
+ } catch (final Throwable t) {
streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
} // also initializes width, height, .. etc
@@ -612,7 +613,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final void initGL(GL gl) throws IllegalStateException, StreamException, GLException {
+ public final void initGL(final GL gl) throws IllegalStateException, StreamException, GLException {
synchronized( stateLock ) {
if(State.Initialized != state ) {
throw new IllegalStateException("Stream not in state initialized: "+this);
@@ -656,7 +657,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
lastFrame = null;
}
changeState(0, State.Paused);
- } catch (Throwable t) {
+ } catch (final Throwable t) {
destroyImpl(gl, GLMediaEventListener.EVENT_CHANGE_ERR); // -> GLMediaPlayer.State.Uninitialized
throw new GLException("Error initializing GL resources", t);
}
@@ -683,11 +684,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* Implementation must at least return a texture count of {@link #TEXTURE_COUNT_MIN}, <i>two</i>, the last texture and the decoding texture.
* </p>
*/
- protected int validateTextureCount(int desiredTextureCount) {
+ protected int validateTextureCount(final int desiredTextureCount) {
return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount;
}
- protected TextureFrame[] createTexFrames(GL gl, final int count) {
+ protected TextureFrame[] createTexFrames(final GL gl, final int count) {
final int[] texNames = new int[count];
gl.glGenTextures(count, texNames, 0);
final int err = gl.glGetError();
@@ -702,7 +703,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
protected abstract TextureFrame createTexImage(GL gl, int texName);
- protected final Texture createTexImageImpl(GL gl, int texName, int tWidth, int tHeight) {
+ protected final Texture createTexImageImpl(final GL gl, final int texName, final int tWidth, final int tHeight) {
if( 0 > texName ) {
throw new RuntimeException("TextureName "+toHexString(texName)+" invalid.");
}
@@ -749,7 +750,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
tWidth, tHeight, width, height, !isInGLOrientation);
}
- protected void destroyTexFrame(GL gl, TextureFrame frame) {
+ protected void destroyTexFrame(final GL gl, final TextureFrame frame) {
frame.getTexture().destroy(gl);
}
@@ -766,7 +767,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return lastFrame;
}
- private final void removeAllTextureFrames(GL gl) {
+ private final void removeAllTextureFrames(final GL gl) {
final TextureFrame[] texFrames = videoFramesOrig;
videoFramesOrig = null;
videoFramesFree = null;
@@ -794,7 +795,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private final boolean[] stGotVFrame = { false };
@Override
- public final TextureFrame getNextTexture(GL gl) throws IllegalStateException {
+ public final TextureFrame getNextTexture(final GL gl) throws IllegalStateException {
synchronized( stateLock ) {
if( State.Paused != state && State.Playing != state ) {
throw new IllegalStateException("Instance not paused or playing: "+this);
@@ -940,7 +941,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
lastTimeMillis = currentTimeMillis;
} while( dropFrame );
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
@@ -948,8 +949,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return lastFrame;
}
}
- protected void preNextTextureImpl(GL gl) {}
- protected void postNextTextureImpl(GL gl) {}
+ protected void preNextTextureImpl(final GL gl) {}
+ protected void postNextTextureImpl(final GL gl) {}
/**
* Process stream until the next video frame, i.e. {@link TextureFrame}, has been reached.
* Audio frames, i.e. {@link AudioSink.AudioFrame}, shall be handled in the process.
@@ -973,7 +974,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
*/
protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame);
- protected final int getNextSingleThreaded(final GL gl, final TextureFrame nextFrame, boolean[] gotVFrame) throws InterruptedException {
+ protected final int getNextSingleThreaded(final GL gl, final TextureFrame nextFrame, final boolean[] gotVFrame) throws InterruptedException {
final int pts;
if( STREAM_ID_NONE != vid ) {
preNextTextureImpl(gl);
@@ -1013,7 +1014,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* w/ current pts value in milliseconds.
* @param audio_scr_t0
*/
- protected void setFirstAudioPTS2SCR(int pts) {
+ protected void setFirstAudioPTS2SCR(final int pts) {
if( audioSCR_reset ) {
audio_scr_t0 = Platform.currentTimeMillis() - pts;
audioSCR_reset = false;
@@ -1049,13 +1050,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return (int) ( video_dpts_cum * (1.0f - VIDEO_DPTS_COEFF) + 0.5f );
}
- private final void newFrameAvailable(TextureFrame frame, long currentTimeMillis) {
+ private final void newFrameAvailable(final TextureFrame frame, final long currentTimeMillis) {
decodedFrameCount++;
if( 0 == frame.getDuration() ) { // patch frame duration if not set already
frame.setDuration( (int) frame_duration );
}
synchronized(eventListenersLock) {
- for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
+ for(final Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
i.next().newFrameAvailable(this, frame, currentTimeMillis);
}
}
@@ -1092,14 +1093,14 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.notifyAll(); // wake-up startup-block
try {
this.wait(); // wait until started
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
}
- private void makeCurrent(GLContext ctx) {
+ private void makeCurrent(final GLContext ctx) {
if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) {
throw new GLException("Couldn't make ctx current: "+ctx);
}
@@ -1112,7 +1113,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
// so we can continue with the destruction.
try {
sharedGLCtx.destroy();
- } catch (GLException gle) {
+ } catch (final GLException gle) {
gle.printStackTrace();
}
}
@@ -1126,7 +1127,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
- public final synchronized void initGL(GL gl) {
+ public final synchronized void initGL(final GL gl) {
final GLContext glCtx = gl.getContext();
final boolean glCtxCurrent = glCtx.isCurrent();
final GLProfile glp = gl.getGLProfile();
@@ -1152,7 +1153,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
while( isActive && isRunning ) {
try {
this.wait(); // wait until paused
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
@@ -1167,7 +1168,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.notifyAll(); // wake-up pause-block
try {
this.wait(); // wait until resumed
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
@@ -1185,7 +1186,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.notifyAll(); // wake-up pause-block (opt)
try {
this.wait(); // wait until stopped
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
@@ -1217,7 +1218,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.notifyAll(); // wake-up doPause()
try {
this.wait(); // wait until resumed
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
if( !shallPause ) {
e.printStackTrace();
}
@@ -1296,12 +1297,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
isBlocked = false;
if( !shallStop && !shallPause ) {
streamErr = new StreamException("InterruptedException while decoding: "+GLMediaPlayerImpl.this.toString(), e);
}
- } catch (Throwable t) {
+ } catch (final Throwable t) {
streamErr = new StreamException(t.getClass().getSimpleName()+" while decoding: "+GLMediaPlayerImpl.this.toString(), t);
} finally {
if( null != nextFrame ) { // put back
@@ -1339,7 +1340,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private volatile StreamWorker streamWorker = null;
private volatile StreamException streamErr = null;
- protected final int addStateEventMask(int event_mask, State newState) {
+ protected final int addStateEventMask(int event_mask, final State newState) {
if( state != newState ) {
switch( newState ) {
case Uninitialized:
@@ -1359,18 +1360,18 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return event_mask;
}
- protected final void attributesUpdated(int event_mask) {
+ protected final void attributesUpdated(final int event_mask) {
if( 0 != event_mask ) {
final long now = Platform.currentTimeMillis();
synchronized(eventListenersLock) {
- for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
+ for(final Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
i.next().attributesChanged(this, event_mask, now);
}
}
}
}
- protected final void changeState(int event_mask, State newState) {
+ protected final void changeState(int event_mask, final State newState) {
event_mask = addStateEventMask(event_mask, newState);
if( 0 != event_mask ) {
setState( newState );
@@ -1381,9 +1382,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
- protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream,
- int bps_video, int bps_audio, float fps,
- int videoFrames, int audioFrames, int duration, String vcodec, String acodec) {
+ protected final void updateAttributes(int vid, final int aid, final int width, final int height, final int bps_stream,
+ final int bps_video, final int bps_audio, final float fps,
+ final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) {
int event_mask = 0;
final boolean wasUninitialized = state == State.Uninitialized;
@@ -1458,7 +1459,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
attributesUpdated(event_mask);
}
- protected void setIsGLOriented(boolean isGLOriented) {
+ protected void setIsGLOriented(final boolean isGLOriented) {
if( isInGLOrientation != isGLOriented ) {
if( DEBUG ) {
System.err.println("XXX gl-orient "+isInGLOrientation+" -> "+isGLOriented);
@@ -1569,7 +1570,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final void addEventListener(GLMediaEventListener l) {
+ public final void addEventListener(final GLMediaEventListener l) {
if(l == null) {
return;
}
@@ -1579,7 +1580,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final void removeEventListener(GLMediaEventListener l) {
+ public final void removeEventListener(final GLMediaEventListener l) {
if (l == null) {
return;
}
@@ -1598,33 +1599,33 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private final Object eventListenersLock = new Object();
@Override
- public final Object getAttachedObject(String name) {
+ public final Object getAttachedObject(final String name) {
return attachedObjects.get(name);
}
@Override
- public final Object attachObject(String name, Object obj) {
+ public final Object attachObject(final String name, final Object obj) {
return attachedObjects.put(name, obj);
}
@Override
- public final Object detachObject(String name) {
+ public final Object detachObject(final String name) {
return attachedObjects.remove(name);
}
private final HashMap<String, Object> attachedObjects = new HashMap<String, Object>();
- protected static final String toHexString(long v) {
+ protected static final String toHexString(final long v) {
return "0x"+Long.toHexString(v);
}
- protected static final String toHexString(int v) {
+ protected static final String toHexString(final int v) {
return "0x"+Integer.toHexString(v);
}
- protected static final int getPropIntVal(Map<String, String> props, String key) {
+ protected static final int getPropIntVal(final Map<String, String> props, final String key) {
final String val = props.get(key);
try {
return Integer.valueOf(val).intValue();
- } catch (NumberFormatException nfe) {
+ } catch (final NumberFormatException nfe) {
if(DEBUG) {
System.err.println("Not a valid integer for <"+key+">: <"+val+">");
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index f5b2dd8ea..a24e77b7d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -43,7 +43,7 @@ public class JavaSoundAudioSink implements AudioSink {
try {
AudioSystem.getAudioFileTypes();
ok = true;
- } catch (Throwable t) {
+ } catch (final Throwable t) {
}
staticAvailable=ok;
@@ -59,7 +59,7 @@ public class JavaSoundAudioSink implements AudioSink {
public final float getPlaySpeed() { return 1.0f; } // FIXME
@Override
- public final boolean setPlaySpeed(float rate) {
+ public final boolean setPlaySpeed(final float rate) {
return false; // FIXME
}
@@ -70,7 +70,7 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public final boolean setVolume(float v) {
+ public final boolean setVolume(final float v) {
// FIXME
volume = v;
return true;
@@ -87,12 +87,12 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public final boolean isSupported(AudioSink.AudioFormat format) {
+ public final boolean isSupported(final AudioSink.AudioFormat format) {
return true;
}
@Override
- public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ public boolean init(final AudioSink.AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) {
if( !staticAvailable ) {
return false;
}
@@ -112,7 +112,7 @@ public class JavaSoundAudioSink implements AudioSink {
System.out.println("JavaSound audio sink");
initialized=true;
chosenFormat = requestedFormat;
- } catch (Exception e) {
+ } catch (final Exception e) {
initialized=false;
}
return true;
@@ -186,7 +186,7 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
+ public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) {
int byteSize = audioDataFrame.getByteSize();
final ByteBuffer byteBuffer = audioDataFrame.getData();
final byte[] bytes = new byte[byteSize];
@@ -206,7 +206,7 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
+ public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) {
return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount));
}
@@ -224,7 +224,7 @@ public class JavaSoundAudioSink implements AudioSink {
public int getQueuedTime() {
return getQueuedTimeImpl( getQueuedByteCount() );
}
- private final int getQueuedTimeImpl(int byteCount) {
+ private final int getQueuedTimeImpl(final int byteCount) {
final int bytesPerSample = chosenFormat.sampleSize >>> 3; // /8
return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) );
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index 4ab90322d..3aa9d7ab6 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -70,7 +70,7 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public final boolean setVolume(float v) {
+ public final boolean setVolume(final float v) {
// FIXME
volume = v;
return true;
@@ -87,7 +87,7 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public final boolean isSupported(AudioFormat format) {
+ public final boolean isSupported(final AudioFormat format) {
/**
* If we like to emulate constraints ..
*
@@ -102,7 +102,7 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ public boolean init(final AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) {
chosenFormat = requestedFormat;
return true;
}
@@ -171,12 +171,12 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
+ public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) {
return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize());
}
@Override
- public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
+ public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) {
if( !initialized || null == chosenFormat ) {
return null;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index 2b4a386d4..4a15c7422 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -61,7 +61,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final boolean setPlaySpeedImpl(float rate) {
+ protected final boolean setPlaySpeedImpl(final float rate) {
return false;
}
@@ -77,14 +77,14 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final int seekImpl(int msec) {
+ protected final int seekImpl(final int msec) {
pos_ms = msec;
validatePos();
return pos_ms;
}
@Override
- protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
+ protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) {
final int pts = getAudioPTSImpl();
nextFrame.setPTS( pts );
return pts;
@@ -98,7 +98,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void destroyImpl(GL gl) {
+ protected final void destroyImpl(final GL gl) {
if(null != texData) {
texData.destroy();
texData = null;
@@ -108,17 +108,17 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
public final static TextureData createTestTextureData() {
TextureData res = null;
try {
- URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-28x16.png", NullGLMediaPlayer.class.getClassLoader());
+ final URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-28x16.png", NullGLMediaPlayer.class.getClassLoader());
if(null != urlConn) {
res = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
if(null == res) {
final int w = 160;
final int h = 90;
- ByteBuffer buffer = Buffers.newDirectByteBuffer(w*h*4);
+ final ByteBuffer buffer = Buffers.newDirectByteBuffer(w*h*4);
while(buffer.hasRemaining()) {
buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA);
}
@@ -132,7 +132,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void initStreamImpl(int vid, int aid) throws IOException {
+ protected final void initStreamImpl(final int vid, final int aid) throws IOException {
texData = createTestTextureData();
final float _fps = 24f;
final int _duration = 10*60*1000; // msec
@@ -143,7 +143,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
_totalFrames, 0, _duration, "png-static", null);
}
@Override
- protected final void initGLImpl(GL gl) throws IOException, GLException {
+ protected final void initGLImpl(final GL gl) throws IOException, GLException {
setIsGLOriented(true);
}
@@ -154,12 +154,12 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
* </p>
*/
@Override
- protected int validateTextureCount(int desiredTextureCount) {
+ protected int validateTextureCount(final int desiredTextureCount) {
return TEXTURE_COUNT_MIN;
}
@Override
- protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ protected final TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) {
final Texture texture = super.createTexImageImpl(gl, texName, getWidth(), getHeight());
if(null != texData) {
texture.updateImage(gl, texData);
@@ -168,7 +168,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
+ protected final void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) {
super.destroyTexFrame(gl, frame);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java b/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java
index 380ff9ea8..44d83e78d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java
@@ -181,7 +181,7 @@ public enum VideoPixelFormat {
* </pre>
* @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. PixelFormat.values().length-1 ]
*/
- public static VideoPixelFormat valueOf(int ordinal) throws IllegalArgumentException {
+ public static VideoPixelFormat valueOf(final int ordinal) throws IllegalArgumentException {
final VideoPixelFormat[] all = VideoPixelFormat.values();
if( 0 <= ordinal && ordinal < all.length ) {
return all[ordinal];
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
index e7a425a54..42a908f93 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -188,12 +188,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
GLProfile.initSingleton();
boolean _ready = false;
/** util, format, codec, device, avresample, swresample */
- boolean[] _loaded= new boolean[6];
+ final boolean[] _loaded= new boolean[6];
/** util, format, codec, avresample, swresample */
- VersionNumber[] _versions = new VersionNumber[5];
+ final VersionNumber[] _versions = new VersionNumber[5];
try {
_ready = initSymbols(_loaded, _versions);
- } catch (Throwable t) {
+ } catch (final Throwable t) {
t.printStackTrace();
}
libsUFCLoaded = _loaded[LIB_IDX_UTI] && _loaded[LIB_IDX_FMT] && _loaded[LIB_IDX_COD];
@@ -250,7 +250,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
* @param versions 5: util, format, codec, avresample, swresample
* @return
*/
- private static final boolean initSymbols(boolean[] loaded, VersionNumber[] versions) {
+ private static final boolean initSymbols(final boolean[] loaded, final VersionNumber[] versions) {
for(int i=0; i<6; i++) {
loaded[i] = false;
}
@@ -331,7 +331,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
@Override
public final List<List<String>> getToolLibNames() {
- List<List<String>> libsList = new ArrayList<List<String>>();
+ final List<List<String>> libsList = new ArrayList<List<String>>();
// 6: util, format, codec, device, avresample, swresample
@@ -424,12 +424,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
}
@Override
- public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) {
return 0;
}
@Override
- public final boolean useToolGetProcAdressFirst(String funcName) {
+ public final boolean useToolGetProcAdressFirst(final String funcName) {
return false;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
index 9cfd3d80e..8ac1232b5 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -49,6 +49,7 @@ import com.jogamp.opengl.util.av.AudioSinkFactory;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.texture.Texture;
+import jogamp.common.os.PlatformPropsImpl;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.util.av.AudioSampleFormat;
import jogamp.opengl.util.av.GLMediaPlayerImpl;
@@ -265,7 +266,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void destroyImpl(GL gl) {
+ protected final void destroyImpl(final GL gl) {
if (moviePtr != 0) {
natives.destroyInstance0(moviePtr);
moviePtr = 0;
@@ -283,7 +284,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
public static final String dev_video_linux = "/dev/video";
@Override
- protected final void initStreamImpl(int vid, int aid) throws IOException {
+ protected final void initStreamImpl(final int vid, final int aid) throws IOException {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
}
@@ -309,7 +310,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
int rw=-1, rh=-1, rr=-1;
String sizes = null;
if( isCameraInput ) {
- switch(Platform.OS_TYPE) {
+ switch(PlatformPropsImpl.OS_TYPE) {
case ANDROID:
// ??
case FREEBSD:
@@ -351,7 +352,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void initGLImpl(GL gl) throws IOException, GLException {
+ protected final void initGLImpl(final GL gl) throws IOException, GLException {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
}
@@ -406,7 +407,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if( null != gl && STREAM_ID_NONE != getVID() ) {
int tf, tif=GL.GL_RGBA; // texture format and internal format
- int tt = GL.GL_UNSIGNED_BYTE;
+ final int tt = GL.GL_UNSIGNED_BYTE;
switch(vBytesPerPixelPerPlane) {
case 1:
if( gl.isGL3ES3() ) {
@@ -414,22 +415,22 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
tf = GL2ES2.GL_RED; tif=GL2ES2.GL_RED; singleTexComp = "r";
} else {
// ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
- tf = GL2ES2.GL_ALPHA; tif=GL2ES2.GL_ALPHA; singleTexComp = "a";
+ tf = GL.GL_ALPHA; tif=GL.GL_ALPHA; singleTexComp = "a";
}
break;
case 2: if( vPixelFmt == VideoPixelFormat.YUYV422 ) {
// YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr
// Stuffed into RGBA half width texture
- tf = GL2ES2.GL_RGBA; tif=GL2ES2.GL_RGBA; break;
+ tf = GL.GL_RGBA; tif=GL.GL_RGBA; break;
} else {
tf = GL2ES2.GL_RG; tif=GL2ES2.GL_RG; break;
}
- case 3: tf = GL2ES2.GL_RGB; tif=GL.GL_RGB; break;
+ case 3: tf = GL.GL_RGB; tif=GL.GL_RGB; break;
case 4: if( vPixelFmt == VideoPixelFormat.BGRA ) {
- tf = GL2ES2.GL_BGRA; tif=GL.GL_RGBA; break;
+ tf = GL.GL_BGRA; tif=GL.GL_RGBA; break;
} else {
- tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break;
+ tf = GL.GL_RGBA; tif=GL.GL_RGBA; break;
}
default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane);
}
@@ -442,7 +443,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
}
@Override
- protected final TextureFrame createTexImage(GL gl, int texName) {
+ protected final TextureFrame createTexImage(final GL gl, final int texName) {
return new TextureFrame( createTexImageImpl(gl, texName, texWidth, texHeight) );
}
@@ -464,7 +465,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
*/
- final boolean isAudioFormatSupported(int audioSampleFmt, int audioSampleRate, int audioChannels) {
+ final boolean isAudioFormatSupported(final int audioSampleFmt, final int audioSampleRate, final int audioChannels) {
final AudioSampleFormat avFmt = AudioSampleFormat.valueOf(audioSampleFmt);
final AudioFormat audioFormat = avAudioFormat2Local(avFmt, audioSampleRate, audioChannels);
final boolean res = audioSink.isSupported(audioFormat);
@@ -480,7 +481,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
*/
- private final AudioFormat avAudioFormat2Local(AudioSampleFormat audioSampleFmt, int audioSampleRate, int audioChannels) {
+ private final AudioFormat avAudioFormat2Local(final AudioSampleFormat audioSampleFmt, final int audioSampleRate, final int audioChannels) {
final int sampleSize;
boolean planar = true;
boolean fixedP = true;
@@ -540,10 +541,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param audioChannels
* @param audioSamplesPerFrameAndChannel in audio samples per frame and channel
*/
- void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
- int tWd0, int tWd1, int tWd2, int vW, int vH,
- int aid, int audioSampleFmt, int audioSampleRate,
- int audioChannels, int audioSamplesPerFrameAndChannel) {
+ void setupFFAttributes(final int vid, final int pixFmt, final int planes, final int bitsPerPixel, final int bytesPerPixelPerPlane,
+ final int tWd0, final int tWd1, final int tWd2, final int vW, final int vH,
+ final int aid, final int audioSampleFmt, final int audioSampleRate,
+ final int audioChannels, final int audioSamplesPerFrameAndChannel) {
// defaults ..
vPixelFmt = null;
vPlanes = 0;
@@ -641,8 +642,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param tWd1
* @param tWd2
*/
- void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
- int tWd0, int tWd1, int tWd2, int vW, int vH) {
+ void updateVidAttributes(final boolean isInGLOrientation, final int pixFmt, final int planes, final int bitsPerPixel, final int bytesPerPixelPerPlane,
+ final int tWd0, final int tWd1, final int tWd2, final int vW, final int vH) {
}
/**
@@ -653,7 +654,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* Otherwise the call is delegated to it's super class.
*/
@Override
- public final String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
+ public final String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException {
if( State.Uninitialized == getState() ) {
throw new IllegalStateException("Instance not initialized: "+this);
}
@@ -785,7 +786,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final synchronized int seekImpl(int msec) {
+ protected final synchronized int seekImpl(final int msec) {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
}
@@ -793,18 +794,18 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected void preNextTextureImpl(GL gl) {
+ protected void preNextTextureImpl(final GL gl) {
psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1
gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit());
}
@Override
- protected void postNextTextureImpl(GL gl) {
+ protected void postNextTextureImpl(final GL gl) {
psm.restore(gl);
}
@Override
- protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
+ protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
}
@@ -825,7 +826,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
return vPTS;
}
- final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) {
+ final void pushSound(final ByteBuffer sampleData, final int data_size, final int audio_pts) {
setFirstAudioPTS2SCR( audio_pts );
if( 1.0f == getPlaySpeed() || audioSinkPlaySpeedSet ) {
audioSink.enqueueData( audio_pts, sampleData, data_size);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
index 99e5a805b..8fd439082 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
@@ -33,7 +33,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
private static final Object mutex_avcodec_openclose_jni = new Object();
- final boolean initSymbols0(long[] symbols, int count) {
+ final boolean initSymbols0(final long[] symbols, final int count) {
return initSymbols0(mutex_avcodec_openclose_jni, symbols, count);
}
abstract boolean initSymbols0(Object mutex_avcodec_openclose, long[] symbols, int count);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
index 22a045825..65a7e3618 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
@@ -30,7 +30,7 @@ package jogamp.opengl.util.av.impl;
import com.jogamp.common.util.VersionNumber;
class FFMPEGStaticNatives {
- static VersionNumber getAVVersion(int vers) {
+ static VersionNumber getAVVersion(final int vers) {
return new VersionNumber( ( vers >> 16 ) & 0xFF,
( vers >> 8 ) & 0xFF,
( vers >> 0 ) & 0xFF );
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
index ecf91124e..0eeb54bf6 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
@@ -74,19 +74,19 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ protected TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) {
final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, texName);
_setStreamEGLImageTexture2D(moviePtr, texName, eglTex.getImage(), eglTex.getSync());
return eglTex;
}
@Override
- protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame imgTex) {
+ protected void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame imgTex) {
super.destroyTexFrame(gl, imgTex);
}
@Override
- protected void destroyImpl(GL gl) {
+ protected void destroyImpl(final GL gl) {
if (moviePtr != 0) {
_stop(moviePtr);
_detachVideoRenderer(moviePtr);
@@ -96,7 +96,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- protected void initStreamImpl(int vid, int aid) throws IOException {
+ protected void initStreamImpl(final int vid, final int aid) throws IOException {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
@@ -117,7 +117,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
}
@Override
- protected final void initGLImpl(GL gl) throws IOException, GLException {
+ protected final void initGLImpl(final GL gl) throws IOException, GLException {
// NOP
setIsGLOriented(true);
}
@@ -128,7 +128,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- protected boolean setPlaySpeedImpl(float rate) {
+ protected boolean setPlaySpeedImpl(final float rate) {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
@@ -157,7 +157,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
/** @return time position after issuing the command */
@Override
- protected int seekImpl(int msec) {
+ protected int seekImpl(final int msec) {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
@@ -165,7 +165,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- protected int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
+ protected int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
@@ -182,8 +182,8 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
return 0; // FIXME: return pts
}
- private String replaceAll(String orig, String search, String repl) {
- StringBuilder dest = new StringBuilder();
+ private String replaceAll(final String orig, final String search, final String repl) {
+ final StringBuilder dest = new StringBuilder();
// In case replaceAll / java.util.regex.* is not supported (-> CVM)
int i=0,j;
while((j=orig.indexOf(search, i))>=0) {
@@ -194,7 +194,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
return dest.append(orig.substring(i, orig.length())).toString();
}
- private void errorCheckEGL(String s) {
+ private void errorCheckEGL(final String s) {
int e;
if( (e=EGL.eglGetError()) != EGL.EGL_SUCCESS ) {
System.out.println("EGL Error: ("+s+"): 0x"+Integer.toHexString(e));
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index e9fb91086..5a78f514d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -45,22 +45,22 @@ import com.jogamp.opengl.util.glsl.ShaderState;
*/
public class GLSLArrayHandler extends GLVBOArrayHandler {
- public GLSLArrayHandler(GLArrayDataEditable ad) {
+ public GLSLArrayHandler(final GLArrayDataEditable ad) {
super(ad);
}
@Override
- public final void setSubArrayVBOName(int vboName) {
+ public final void setSubArrayVBOName(final int vboName) {
throw new UnsupportedOperationException();
}
@Override
- public final void addSubHandler(GLArrayHandlerFlat handler) {
+ public final void addSubHandler(final GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
enableShaderState(glsl, enable, (ShaderState)ext);
@@ -71,7 +71,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler {
private final int[] tempI = new int[1];
- private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) {
+ private final void enableShaderState(final GL2ES2 glsl, final boolean enable, final ShaderState st) {
if(enable) {
/*
* This would be the non optimized code path:
@@ -118,7 +118,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler {
}
}
- private final void enableSimple(GL2ES2 glsl, boolean enable) {
+ private final void enableSimple(final GL2ES2 glsl, final boolean enable) {
final int location = ad.getLocation();
if( 0 > location ) {
return;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
index 34a381d7d..85fcabdd9 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
@@ -41,9 +41,9 @@ import com.jogamp.opengl.util.glsl.ShaderState;
* separately and interleaves many arrays.
*/
public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
- private GLArrayDataWrapper ad;
+ private final GLArrayDataWrapper ad;
- public GLSLArrayHandlerFlat(GLArrayDataWrapper ad) {
+ public GLSLArrayHandlerFlat(final GLArrayDataWrapper ad) {
this.ad = ad;
}
@@ -53,7 +53,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}
@Override
- public final void syncData(GL gl, Object ext) {
+ public final void syncData(final GL gl, final Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
((ShaderState)ext).vertexAttribPointer(glsl, ad);
@@ -80,7 +80,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
final ShaderState st = (ShaderState)ext;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
index e153082e0..0169b0747 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
@@ -45,30 +45,30 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler {
private final List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
- public GLSLArrayHandlerInterleaved(GLArrayDataEditable ad) {
+ public GLSLArrayHandlerInterleaved(final GLArrayDataEditable ad) {
super(ad);
}
@Override
- public final void setSubArrayVBOName(int vboName) {
+ public final void setSubArrayVBOName(final int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
}
}
@Override
- public final void addSubHandler(GLArrayHandlerFlat handler) {
+ public final void addSubHandler(final GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
- private final void syncSubData(GL gl, Object ext) {
+ private final void syncSubData(final GL gl, final Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
}
}
@Override
- public final void enableState(GL gl, boolean enable, Object ext) {
+ public final void enableState(final GL gl, final boolean enable, final Object ext) {
if(enable) {
if(!ad.isVBO()) {
throw new InternalError("Interleaved handle is not VBO: "+ad);
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
index 09da8c9ee..d5d0020c5 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
@@ -52,7 +52,7 @@ public class GLSLTextureRaster {
private GLUniformData activeTexUniform;
private GLArrayDataServer interleavedVBO;
- public GLSLTextureRaster(int textureUnit, boolean textureVertFlipped) {
+ public GLSLTextureRaster(final int textureUnit, final boolean textureVertFlipped) {
this.textureVertFlipped = textureVertFlipped;
this.textureUnit = textureUnit;
}
@@ -63,7 +63,7 @@ public class GLSLTextureRaster {
static final String shaderSrcPath = "../../shader";
static final String shaderBinPath = "../../shader/bin";
- public void init(GL2ES2 gl) {
+ public void init(final GL2ES2 gl) {
// Create & Compile the shader objects
final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
shaderSrcPath, shaderBinPath, shaderBasename, true);
@@ -83,9 +83,9 @@ public class GLSLTextureRaster {
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
- pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) {
@@ -128,7 +128,7 @@ public class GLSLTextureRaster {
sp.useProgram(gl, false);
}
- public void reshape(GL2ES2 gl, int x, int y, int width, int height) {
+ public void reshape(final GL2ES2 gl, final int x, final int y, final int width, final int height) {
if(null != sp) {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
@@ -143,7 +143,7 @@ public class GLSLTextureRaster {
}
}
- public void dispose(GL2ES2 gl) {
+ public void dispose(final GL2ES2 gl) {
if(null != pmvMatrixUniform) {
pmvMatrixUniform = null;
}
@@ -158,7 +158,7 @@ public class GLSLTextureRaster {
}
}
- public void display(GL2ES2 gl) {
+ public void display(final GL2ES2 gl) {
if(null != sp) {
sp.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
index ff8006cf8..a9848f899 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -60,7 +60,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
* @param mode TODO
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
*/
- public FixedFuncHook (GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+ public FixedFuncHook (final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) {
this.gl = gl;
if(null != pmvMatrix) {
this.ownsPMVMatrix = false;
@@ -77,10 +77,10 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
* @param mode TODO
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
*/
- public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
- Class<?> shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
- String vertexColorFile, String vertexColorLightFile,
- String fragmentColorFile, String fragmentColorTextureFile) {
+ public FixedFuncHook(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix,
+ final Class<?> shaderRootClass, final String shaderSrcRoot, final String shaderBinRoot,
+ final String vertexColorFile, final String vertexColorLightFile,
+ final String fragmentColorFile, final String fragmentColorTextureFile) {
this.gl = gl;
if(null != pmvMatrix) {
this.ownsPMVMatrix = false;
@@ -96,7 +96,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
public boolean verbose() { return fixedFunction.verbose(); }
- public void setVerbose(boolean v) { fixedFunction.setVerbose(v); }
+ public void setVerbose(final boolean v) { fixedFunction.setVerbose(v); }
public void destroy() {
fixedFunction.destroy(gl);
@@ -110,32 +110,32 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
//
// FixedFuncHookIf - hooks
//
- public void glDrawArrays(int mode, int first, int count) {
+ public void glDrawArrays(final int mode, final int first, final int count) {
fixedFunction.glDrawArrays(gl, mode, first, count);
}
- public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) {
+ public void glDrawElements(final int mode, final int count, final int type, final java.nio.Buffer indices) {
fixedFunction.glDrawElements(gl, mode, count, type, indices);
}
- public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) {
+ public void glDrawElements(final int mode, final int count, final int type, final long indices_buffer_offset) {
fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset);
}
- public void glActiveTexture(int texture) {
+ public void glActiveTexture(final int texture) {
fixedFunction.glActiveTexture(texture);
gl.glActiveTexture(texture);
}
- public void glEnable(int cap) {
+ public void glEnable(final int cap) {
if(fixedFunction.glEnable(cap, true)) {
gl.glEnable(cap);
}
}
- public void glDisable(int cap) {
+ public void glDisable(final int cap) {
if(fixedFunction.glEnable(cap, false)) {
gl.glDisable(cap);
}
}
@Override
- public void glGetFloatv(int pname, java.nio.FloatBuffer params) {
+ public void glGetFloatv(final int pname, final java.nio.FloatBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params);
return;
@@ -143,7 +143,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
gl.glGetFloatv(pname, params);
}
@Override
- public void glGetFloatv(int pname, float[] params, int params_offset) {
+ public void glGetFloatv(final int pname, final float[] params, final int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params, params_offset);
return;
@@ -151,7 +151,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
gl.glGetFloatv(pname, params, params_offset);
}
@Override
- public void glGetIntegerv(int pname, IntBuffer params) {
+ public void glGetIntegerv(final int pname, final IntBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params);
return;
@@ -159,7 +159,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
gl.glGetIntegerv(pname, params);
}
@Override
- public void glGetIntegerv(int pname, int[] params, int params_offset) {
+ public void glGetIntegerv(final int pname, final int[] params, final int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params, params_offset);
return;
@@ -167,21 +167,21 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
gl.glGetIntegerv(pname, params, params_offset);
}
- public void glTexEnvi(int target, int pname, int value) {
+ public void glTexEnvi(final int target, final int pname, final int value) {
fixedFunction.glTexEnvi(target, pname, value);
}
- public void glGetTexEnviv(int target, int pname, IntBuffer params) {
+ public void glGetTexEnviv(final int target, final int pname, final IntBuffer params) {
fixedFunction.glGetTexEnviv(target, pname, params);
}
- public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) {
+ public void glGetTexEnviv(final int target, final int pname, final int[] params, final int params_offset) {
fixedFunction.glGetTexEnviv(target, pname, params, params_offset);
}
- public void glBindTexture(int target, int texture) {
+ public void glBindTexture(final int target, final int texture) {
fixedFunction.glBindTexture(target, texture);
gl.glBindTexture(target, texture);
}
- public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
- int format, int type, Buffer pixels) {
+ public void glTexImage2D(final int target, final int level, int internalformat, final int width, final int height, final int border,
+ final int format, final int type, final Buffer pixels) {
// align internalformat w/ format, an ES2 requirement
switch(internalformat) {
case 3: internalformat= ( GL.GL_RGBA == format ) ? GL.GL_RGBA : GL.GL_RGB; break;
@@ -190,8 +190,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glTexImage2D(target, /* level, */ internalformat, /*width, height, border, */ format /*, type, pixels*/);
gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}
- public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
- int format, int type, long pixels_buffer_offset) {
+ public void glTexImage2D(final int target, final int level, int internalformat, final int width, final int height, final int border,
+ final int format, final int type, final long pixels_buffer_offset) {
// align internalformat w/ format, an ES2 requirement
switch(internalformat) {
case 3: internalformat= ( GL.GL_RGBA == format ) ? GL.GL_RGBA : GL.GL_RGB; break;
@@ -201,16 +201,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels_buffer_offset);
}
- public void glPointSize(float size) {
+ public void glPointSize(final float size) {
fixedFunction.glPointSize(size);
}
- public void glPointParameterf(int pname, float param) {
+ public void glPointParameterf(final int pname, final float param) {
fixedFunction.glPointParameterf(pname, param);
}
- public void glPointParameterfv(int pname, float[] params, int params_offset) {
+ public void glPointParameterfv(final int pname, final float[] params, final int params_offset) {
fixedFunction.glPointParameterfv(pname, params, params_offset);
}
- public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
+ public void glPointParameterfv(final int pname, final java.nio.FloatBuffer params) {
fixedFunction.glPointParameterfv(pname, params);
}
@@ -221,16 +221,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
return pmvMatrix.glGetMatrixMode();
}
@Override
- public void glMatrixMode(int mode) {
+ public void glMatrixMode(final int mode) {
pmvMatrix.glMatrixMode(mode);
}
@Override
- public void glLoadMatrixf(java.nio.FloatBuffer m) {
+ public void glLoadMatrixf(final java.nio.FloatBuffer m) {
pmvMatrix.glLoadMatrixf(m);
}
@Override
- public void glLoadMatrixf(float[] m, int m_offset) {
- glLoadMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
+ public void glLoadMatrixf(final float[] m, final int m_offset) {
+ glLoadMatrixf(Buffers.newDirectFloatBuffer(m, m_offset));
}
@Override
public void glPopMatrix() {
@@ -245,37 +245,37 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
pmvMatrix.glLoadIdentity();
}
@Override
- public void glMultMatrixf(java.nio.FloatBuffer m) {
+ public void glMultMatrixf(final java.nio.FloatBuffer m) {
pmvMatrix.glMultMatrixf(m);
}
@Override
- public void glMultMatrixf(float[] m, int m_offset) {
- glMultMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
+ public void glMultMatrixf(final float[] m, final int m_offset) {
+ glMultMatrixf(Buffers.newDirectFloatBuffer(m, m_offset));
}
@Override
- public void glTranslatef(float x, float y, float z) {
+ public void glTranslatef(final float x, final float y, final float z) {
pmvMatrix.glTranslatef(x, y, z);
}
@Override
- public void glRotatef(float angdeg, float x, float y, float z) {
+ public void glRotatef(final float angdeg, final float x, final float y, final float z) {
pmvMatrix.glRotatef(angdeg, x, y, z);
}
@Override
- public void glScalef(float x, float y, float z) {
+ public void glScalef(final float x, final float y, final float z) {
pmvMatrix.glScalef(x, y, z);
}
- public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) {
+ public void glOrtho(final double left, final double right, final double bottom, final double top, final double near_val, final double far_val) {
glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val);
}
@Override
- public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
+ public void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar);
}
- public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) {
+ public void glFrustum(final double left, final double right, final double bottom, final double top, final double zNear, final double zFar) {
glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
}
@Override
- public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
+ public void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar);
}
@@ -283,45 +283,45 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
// LightingIf
//
@Override
- public void glColor4f(float red, float green, float blue, float alpha) {
+ public void glColor4f(final float red, final float green, final float blue, final float alpha) {
fixedFunction.glColor4f(gl, red, green, blue, alpha);
}
- public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
+ public void glColor4ub(final byte red, final byte green, final byte blue, final byte alpha) {
glColor4f(ValueConv.byte_to_float(red, false),
ValueConv.byte_to_float(green, false),
ValueConv.byte_to_float(blue, false),
ValueConv.byte_to_float(alpha, false) );
}
@Override
- public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
+ public void glLightfv(final int light, final int pname, final java.nio.FloatBuffer params) {
fixedFunction.glLightfv(gl, light, pname, params);
}
@Override
- public void glLightfv(int light, int pname, float[] params, int params_offset) {
- glLightfv(light, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
+ public void glLightfv(final int light, final int pname, final float[] params, final int params_offset) {
+ glLightfv(light, pname, Buffers.newDirectFloatBuffer(params, params_offset));
}
@Override
- public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
+ public void glMaterialfv(final int face, final int pname, final java.nio.FloatBuffer params) {
fixedFunction.glMaterialfv(gl, face, pname, params);
}
@Override
- public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
- glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
+ public void glMaterialfv(final int face, final int pname, final float[] params, final int params_offset) {
+ glMaterialfv(face, pname, Buffers.newDirectFloatBuffer(params, params_offset));
}
@Override
- public void glMaterialf(int face, int pname, float param) {
- glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param }));
+ public void glMaterialf(final int face, final int pname, final float param) {
+ glMaterialfv(face, pname, Buffers.newDirectFloatBuffer(new float[] { param }));
}
//
// Misc Simple States
//
@Override
- public void glShadeModel(int mode) {
+ public void glShadeModel(final int mode) {
fixedFunction.glShadeModel(gl, mode);
}
- public void glAlphaFunc(int func, float ref) {
+ public void glAlphaFunc(final int func, final float ref) {
fixedFunction.glAlphaFunc(func, ref);
}
@@ -334,20 +334,20 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
//
// PointerIf
//
- public void glClientActiveTexture(int textureUnit) {
+ public void glClientActiveTexture(final int textureUnit) {
fixedFunction.glClientActiveTexture(textureUnit);
}
@Override
- public void glEnableClientState(int glArrayIndex) {
+ public void glEnableClientState(final int glArrayIndex) {
fixedFunction.glEnableClientState(gl, glArrayIndex);
}
@Override
- public void glDisableClientState(int glArrayIndex) {
+ public void glDisableClientState(final int glArrayIndex) {
fixedFunction.glDisableClientState(gl, glArrayIndex);
}
@Override
- public void glVertexPointer(GLArrayData array) {
+ public void glVertexPointer(final GLArrayData array) {
if(array.isVBO()) {
if(!gl.isVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
@@ -364,13 +364,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
@Override
- public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ public void glVertexPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) {
glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
@Override
- public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
+ public void glVertexPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) {
+ final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
@@ -379,7 +379,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
@Override
- public void glColorPointer(GLArrayData array) {
+ public void glColorPointer(final GLArrayData array) {
if(array.isVBO()) {
if(!gl.isVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
@@ -395,13 +395,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glColorPointer(gl, array);
}
@Override
- public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ public void glColorPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) {
glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
@Override
- public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
+ public void glColorPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) {
+ final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
@@ -410,7 +410,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
@Override
- public void glNormalPointer(GLArrayData array) {
+ public void glNormalPointer(final GLArrayData array) {
if(array.getComponentCount()!=3) {
throw new GLException("Only 3 components per normal allowed");
}
@@ -429,13 +429,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glNormalPointer(gl, array);
}
@Override
- public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
+ public void glNormalPointer(final int type, final int stride, final java.nio.Buffer pointer) {
glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
@Override
- public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
- int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
+ public void glNormalPointer(final int type, final int stride, final long pointer_buffer_offset) {
+ final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
@@ -444,7 +444,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
@Override
- public void glTexCoordPointer(GLArrayData array) {
+ public void glTexCoordPointer(final GLArrayData array) {
if(array.isVBO()) {
if(!gl.isVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
@@ -460,14 +460,14 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glTexCoordPointer(gl, array);
}
@Override
- public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ public void glTexCoordPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) {
glTexCoordPointer(
GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
@Override
- public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
+ public void glTexCoordPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) {
+ final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
@@ -478,7 +478,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
@Override
public final String toString() {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append(getClass().getName()+" (");
if(null!=pmvMatrix) {
buf.append(", matrixDirty: "+ (0 != pmvMatrix.getModifiedBits(false)));
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
index 42269588d..c65ed084d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -52,6 +52,7 @@ import jogamp.opengl.Debug;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IntIntHashMap;
+import com.jogamp.common.util.PropertyAccess;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
@@ -71,14 +72,14 @@ public class FixedFuncPipeline {
static {
Debug.initSingleton();
- DEBUG = Debug.isPropertyDefined("jogl.debug.FixedFuncPipeline", true);
+ DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.FixedFuncPipeline", true);
}
/** The maximum texture units which could be used, depending on {@link ShaderSelectionMode}. */
public static final int MAX_TEXTURE_UNITS = 8;
public static final int MAX_LIGHTS = 8;
- public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+ public FixedFuncPipeline(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) {
shaderRootClass = FixedFuncPipeline.class;
shaderSrcRoot = shaderSrcRootDef;
shaderBinRoot = shaderBinRootDef;
@@ -88,11 +89,11 @@ public class FixedFuncPipeline {
fragmentColorTextureFile = fragmentColorTextureFileDef;
init(gl, mode, pmvMatrix);
}
- public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
- Class<?> shaderRootClass, String shaderSrcRoot,
- String shaderBinRoot,
- String vertexColorFile, String vertexColorLightFile,
- String fragmentColorFile, String fragmentColorTextureFile) {
+ public FixedFuncPipeline(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix,
+ final Class<?> shaderRootClass, final String shaderSrcRoot,
+ final String shaderBinRoot,
+ final String vertexColorFile, final String vertexColorLightFile,
+ final String fragmentColorFile, final String fragmentColorTextureFile) {
this.shaderRootClass = shaderRootClass;
this.shaderSrcRoot = shaderSrcRoot;
this.shaderBinRoot = shaderBinRoot;
@@ -104,12 +105,12 @@ public class FixedFuncPipeline {
}
public ShaderSelectionMode getShaderSelectionMode() { return requestedShaderSelectionMode; }
- public void setShaderSelectionMode(ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; }
+ public void setShaderSelectionMode(final ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; }
public ShaderSelectionMode getCurrentShaderSelectionMode() { return currentShaderSelectionMode; }
public boolean verbose() { return verbose; }
- public void setVerbose(boolean v) { verbose = DEBUG || v; }
+ public void setVerbose(final boolean v) { verbose = DEBUG || v; }
public boolean isValid() {
return shaderState.linked();
@@ -123,7 +124,7 @@ public class FixedFuncPipeline {
return activeTextureUnit;
}
- public void destroy(GL2ES2 gl) {
+ public void destroy(final GL2ES2 gl) {
if(null != shaderProgramColor) {
shaderProgramColor.release(gl, true);
}
@@ -148,7 +149,7 @@ public class FixedFuncPipeline {
//
// Simple Globals
//
- public void glColor4f(GL2ES2 gl, float red, float green, float blue, float alpha) {
+ public void glColor4f(final GL2ES2 gl, final float red, final float green, final float blue, final float alpha) {
colorStatic.put(0, red);
colorStatic.put(1, green);
colorStatic.put(2, blue);
@@ -168,15 +169,15 @@ public class FixedFuncPipeline {
// Arrays / States
//
- public void glEnableClientState(GL2ES2 gl, int glArrayIndex) {
+ public void glEnableClientState(final GL2ES2 gl, final int glArrayIndex) {
glToggleClientState(gl, glArrayIndex, true);
}
- public void glDisableClientState(GL2ES2 gl, int glArrayIndex) {
+ public void glDisableClientState(final GL2ES2 gl, final int glArrayIndex) {
glToggleClientState(gl, glArrayIndex, false);
}
- private void glToggleClientState(GL2ES2 gl, int glArrayIndex, boolean enable) {
+ private void glToggleClientState(final GL2ES2 gl, final int glArrayIndex, final boolean enable) {
final String arrayName = GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex, clientActiveTextureUnit);
if(null == arrayName) {
throw new GLException("arrayIndex "+toHexString(glArrayIndex)+" unknown");
@@ -203,17 +204,17 @@ public class FixedFuncPipeline {
}
}
- public void glVertexPointer(GL2ES2 gl, GLArrayData data) {
+ public void glVertexPointer(final GL2ES2 gl, final GLArrayData data) {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
}
- public void glColorPointer(GL2ES2 gl, GLArrayData data) {
+ public void glColorPointer(final GL2ES2 gl, final GLArrayData data) {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
}
- public void glNormalPointer(GL2ES2 gl, GLArrayData data) {
+ public void glNormalPointer(final GL2ES2 gl, final GLArrayData data) {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
}
@@ -223,7 +224,7 @@ public class FixedFuncPipeline {
//
/** Enables/Disables the named texture unit (if changed), returns previous state */
- private boolean glEnableTexture(boolean enable, int unit) {
+ private boolean glEnableTexture(final boolean enable, final int unit) {
final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) );
if( isEnabled != enable ) {
if(enable) {
@@ -256,7 +257,7 @@ public class FixedFuncPipeline {
}
}
- public void glTexCoordPointer(GL2ES2 gl, GLArrayData data) {
+ public void glTexCoordPointer(final GL2ES2 gl, final GLArrayData data) {
if( GLPointerFunc.GL_TEXTURE_COORD_ARRAY != data.getIndex() ) {
throw new GLException("Invalid GLArrayData Index "+toHexString(data.getIndex())+", "+data);
}
@@ -265,7 +266,7 @@ public class FixedFuncPipeline {
shaderState.vertexAttribPointer(gl, data);
}
- public void glBindTexture(int target, int texture) {
+ public void glBindTexture(final int target, final int texture) {
if(GL.GL_TEXTURE_2D == target) {
if( texture != boundTextureObject[activeTextureUnit] ) {
boundTextureObject[activeTextureUnit] = texture;
@@ -276,8 +277,8 @@ public class FixedFuncPipeline {
}
}
- public void glTexImage2D(int target, /* int level, */ int internalformat, /*, int width, int height, int border, */
- int format /*, int type, Buffer pixels */) {
+ public void glTexImage2D(final int target, /* int level, */ final int internalformat, /*, int width, int height, int border, */
+ final int format /*, int type, Buffer pixels */) {
final int ifmt;
if(GL.GL_TEXTURE_2D == target) {
switch(internalformat) {
@@ -316,7 +317,7 @@ public class FixedFuncPipeline {
textureFormatDirty = true;
}*/
- public void glTexEnvi(int target, int pname, int value) {
+ public void glTexEnvi(final int target, final int pname, final int value) {
if(GL2ES1.GL_TEXTURE_ENV == target && GL2ES1.GL_TEXTURE_ENV_MODE == pname) {
final int mode;
switch( value ) {
@@ -329,10 +330,10 @@ public class FixedFuncPipeline {
case GL2ES1.GL_DECAL:
mode = 3;
break;
- case GL2ES1.GL_BLEND:
+ case GL.GL_BLEND:
mode = 4;
break;
- case GL2ES1.GL_REPLACE:
+ case GL.GL_REPLACE:
mode = 5;
break;
case GL2ES1.GL_COMBINE:
@@ -347,27 +348,27 @@ public class FixedFuncPipeline {
System.err.println("FixedFuncPipeline: Unimplemented TexEnv: target "+toHexString(target)+", pname "+toHexString(pname)+", mode: "+toHexString(value));
}
}
- private void setTextureEnvMode(int value) {
+ private void setTextureEnvMode(final int value) {
if( value != textureEnvMode.get(activeTextureUnit) ) {
textureEnvMode.put(activeTextureUnit, value);
textureEnvModeDirty = true;
}
}
- public void glGetTexEnviv(int target, int pname, IntBuffer params) { // FIXME
+ public void glGetTexEnviv(final int target, final int pname, final IntBuffer params) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
}
- public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { // FIXME
+ public void glGetTexEnviv(final int target, final int pname, final int[] params, final int params_offset) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
}
//
// Point Sprites
//
- public void glPointSize(float size) {
+ public void glPointSize(final float size) {
pointParams.put(0, size);
pointParamsDirty = true;
}
- public void glPointParameterf(int pname, float param) {
+ public void glPointParameterf(final int pname, final float param) {
switch(pname) {
case GL2ES1.GL_POINT_SIZE_MIN:
pointParams.put(2, param);
@@ -375,13 +376,13 @@ public class FixedFuncPipeline {
case GL2ES1.GL_POINT_SIZE_MAX:
pointParams.put(3, param);
break;
- case GL2ES2.GL_POINT_FADE_THRESHOLD_SIZE:
+ case GL.GL_POINT_FADE_THRESHOLD_SIZE:
pointParams.put(4+3, param);
break;
}
pointParamsDirty = true;
}
- public void glPointParameterfv(int pname, float[] params, int params_offset) {
+ public void glPointParameterfv(final int pname, final float[] params, final int params_offset) {
switch(pname) {
case GL2ES1.GL_POINT_DISTANCE_ATTENUATION:
pointParams.put(4+0, params[params_offset + 0]);
@@ -391,7 +392,7 @@ public class FixedFuncPipeline {
}
pointParamsDirty = true;
}
- public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
+ public void glPointParameterfv(final int pname, final java.nio.FloatBuffer params) {
final int o = params.position();
switch(pname) {
case GL2ES1.GL_POINT_DISTANCE_ATTENUATION:
@@ -405,7 +406,7 @@ public class FixedFuncPipeline {
// private int[] pointTexObj = new int[] { 0 };
- private void glDrawPoints(GL2ES2 gl, GLRunnable2<Object,Object> glDrawAction, Object args) {
+ private void glDrawPoints(final GL2ES2 gl, final GLRunnable2<Object,Object> glDrawAction, final Object args) {
if(gl.isGL2GL3()) {
gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE);
}
@@ -428,13 +429,13 @@ public class FixedFuncPipeline {
}
private static final GLRunnable2<Object, Object> glDrawArraysAction = new GLRunnable2<Object,Object>() {
@Override
- public Object run(GL gl, Object args) {
- int[] _args = (int[])args;
+ public Object run(final GL gl, final Object args) {
+ final int[] _args = (int[])args;
gl.glDrawArrays(GL.GL_POINTS, _args[0], _args[1]);
return null;
}
};
- private final void glDrawPointArrays(GL2ES2 gl, int first, int count) {
+ private final void glDrawPointArrays(final GL2ES2 gl, final int first, final int count) {
glDrawPoints(gl, glDrawArraysAction, new int[] { first, count });
}
@@ -442,7 +443,7 @@ public class FixedFuncPipeline {
// Lighting
//
- public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
+ public void glLightfv(final GL2ES2 gl, int light, final int pname, final java.nio.FloatBuffer params) {
shaderState.useProgram(gl, true);
light -=GLLightingFunc.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
@@ -490,7 +491,7 @@ public class FixedFuncPipeline {
}
}
- public void glMaterialfv(GL2ES2 gl, int face, int pname, java.nio.FloatBuffer params) {
+ public void glMaterialfv(final GL2ES2 gl, final int face, final int pname, final java.nio.FloatBuffer params) {
shaderState.useProgram(gl, true);
switch (face) {
@@ -544,9 +545,9 @@ public class FixedFuncPipeline {
// Misc States
//
- public void glShadeModel(GL2ES2 gl, int mode) {
+ public void glShadeModel(final GL2ES2 gl, final int mode) {
shaderState.useProgram(gl, true);
- GLUniformData ud = shaderState.getUniform(mgl_ShadeModel);
+ final GLUniformData ud = shaderState.getUniform(mgl_ShadeModel);
if(null!=ud) {
ud.setData(mode);
shaderState.uniform(gl, ud);
@@ -580,7 +581,7 @@ public class FixedFuncPipeline {
}
} */
- public void glAlphaFunc(int func, float ref) {
+ public void glAlphaFunc(final int func, final float ref) {
int _func;
switch(func) {
case GL.GL_NEVER:
@@ -627,7 +628,7 @@ public class FixedFuncPipeline {
* eg this call must not be passed to an underlying ES2 implementation.
* true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well.
*/
- public boolean glEnable(int cap, boolean enable) {
+ public boolean glEnable(final int cap, final boolean enable) {
switch(cap) {
case GL.GL_BLEND:
case GL.GL_DEPTH_TEST:
@@ -684,7 +685,7 @@ public class FixedFuncPipeline {
return false;
}
- int light = cap - GLLightingFunc.GL_LIGHT0;
+ final int light = cap - GLLightingFunc.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
if ( (lightsEnabled.get(light)==1) != enable ) {
lightsEnabled.put(light, enable?1:0);
@@ -700,7 +701,7 @@ public class FixedFuncPipeline {
// Draw
//
- public void glDrawArrays(GL2ES2 gl, int mode, int first, int count) {
+ public void glDrawArrays(final GL2ES2 gl, int mode, final int first, final int count) {
switch(mode) {
case GL2.GL_QUAD_STRIP:
mode=GL.GL_TRIANGLE_STRIP;
@@ -708,12 +709,12 @@ public class FixedFuncPipeline {
case GL2.GL_POLYGON:
mode=GL.GL_TRIANGLE_FAN;
break;
- case GL2ES1.GL_POINTS:
+ case GL.GL_POINTS:
glDrawPointArrays(gl, first, count);
return;
}
validate(gl, true);
- if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
for (int j = first; j < count - 3; j += 4) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4);
}
@@ -721,25 +722,25 @@ public class FixedFuncPipeline {
gl.glDrawArrays(mode, first, count);
}
}
- public void glDrawElements(GL2ES2 gl, int mode, int count, int type, java.nio.Buffer indices) {
+ public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final java.nio.Buffer indices) {
validate(gl, true);
- if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
final int idx0 = indices.position();
if( GL.GL_UNSIGNED_BYTE == type ) {
final ByteBuffer b = (ByteBuffer) indices;
for (int j = 0; j < count; 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 < count; 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 < count; 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 {
@@ -747,7 +748,7 @@ public class FixedFuncPipeline {
if( !gl.getContext().isCPUDataSourcingAvail() ) {
throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
}
- if( GL2ES1.GL_POINTS != mode ) {
+ if( GL.GL_POINTS != mode ) {
((GLES2)gl).glDrawElements(mode, count, type, indices);
} else {
// FIXME GL_POINTS !
@@ -755,11 +756,11 @@ public class FixedFuncPipeline {
}
}
}
- public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) {
+ public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final long indices_buffer_offset) {
validate(gl, true);
- if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access");
- } else if( GL2ES1.GL_POINTS != mode ) {
+ } else if( GL.GL_POINTS != mode ) {
// FIXME GL_POINTS !
gl.glDrawElements(mode, count, type, indices_buffer_offset);
} else {
@@ -777,7 +778,7 @@ public class FixedFuncPipeline {
return n;
}
- public void validate(GL2ES2 gl, boolean selectShader) {
+ public void validate(final GL2ES2 gl, final boolean selectShader) {
if( selectShader ) {
if( ShaderSelectionMode.AUTO == requestedShaderSelectionMode) {
final ShaderSelectionMode newMode;
@@ -832,7 +833,7 @@ public class FixedFuncPipeline {
if(colorVAEnabledDirty) {
ud = shaderState.getUniform(mgl_ColorEnabled);
if(null!=ud) {
- int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ;
+ final int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ;
if(ca!=ud.intValue()) {
ud.setData(ca);
shaderState.uniform(gl, ud);
@@ -926,7 +927,7 @@ public class FixedFuncPipeline {
}
}
- public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) {
+ public StringBuilder toString(StringBuilder sb, final boolean alsoUnlocated) {
if(null == sb) {
sb = new StringBuilder();
}
@@ -956,14 +957,14 @@ public class FixedFuncPipeline {
private static final String constMaxTextures4 = "#define MAX_TEXTURE_UNITS 4\n";
private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n";
- private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) {
- int rsVpPos = vp.defaultShaderCustomization(gl, true, true);
- int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
+ private final void customizeShader(final GL2ES2 gl, final ShaderCode vp, final ShaderCode fp, final String maxTextureDefine) {
+ final int rsVpPos = vp.defaultShaderCustomization(gl, true, true);
+ final int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
vp.insertShaderSource(0, rsVpPos, maxTextureDefine);
fp.insertShaderSource(0, rsFpPos, maxTextureDefine);
}
- private final void loadShaderPoints(GL2ES2 gl) {
+ private final void loadShaderPoints(final GL2ES2 gl) {
if( null != shaderProgramPoints ) {
return;
}
@@ -981,7 +982,7 @@ public class FixedFuncPipeline {
}
}
- private final void loadShader(GL2ES2 gl, ShaderSelectionMode mode) {
+ private final void loadShader(final GL2ES2 gl, final ShaderSelectionMode mode) {
final boolean loadColor = ShaderSelectionMode.COLOR == mode;
final boolean loadColorTexture2 = ShaderSelectionMode.COLOR_TEXTURE2 == mode;
final boolean loadColorTexture4 = ShaderSelectionMode.COLOR_TEXTURE4 == mode;
@@ -1068,7 +1069,7 @@ public class FixedFuncPipeline {
}
}
- private ShaderProgram selectShaderProgram(GL2ES2 gl, ShaderSelectionMode newMode) {
+ private ShaderProgram selectShaderProgram(final GL2ES2 gl, ShaderSelectionMode newMode) {
if(ShaderSelectionMode.AUTO == newMode) {
newMode = ShaderSelectionMode.COLOR;
}
@@ -1098,7 +1099,7 @@ public class FixedFuncPipeline {
return sp;
}
- private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+ private void init(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) {
if(null==pmvMatrix) {
throw new GLException("PMVMatrix is null");
}
@@ -1157,7 +1158,7 @@ public class FixedFuncPipeline {
}
}
- private String toHexString(int i) {
+ private String toHexString(final int i) {
return "0x"+Integer.toHexString(i);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
index 078965301..f73de75c5 100644
--- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
+++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
@@ -200,14 +200,14 @@ public class JPEGDecoder {
@SuppressWarnings("serial")
public static class CodecException extends RuntimeException {
- CodecException(String message) {
+ CodecException(final String message) {
super(message);
}
}
@SuppressWarnings("serial")
public static class MarkerException extends CodecException {
final int marker;
- MarkerException(int marker, String message) {
+ MarkerException(final int marker, final String message) {
super(message+" - Marker "+toHexString(marker));
this.marker = marker;
}
@@ -312,7 +312,7 @@ public class JPEGDecoder {
int mcusPerLine;
int mcusPerColumn;
- Frame(boolean progressive, int precision, int scanLines, int samplesPerLine, int componentsCount, int[][] qtt) {
+ Frame(final boolean progressive, final int precision, final int scanLines, final int samplesPerLine, final int componentsCount, final int[][] qtt) {
this.progressive = progressive;
this.precision = precision;
this.scanLines = scanLines;
@@ -323,7 +323,7 @@ public class JPEGDecoder {
this.qtt = qtt;
}
- private final void checkBounds(int idx) {
+ private final void checkBounds(final int idx) {
if( 0 > idx || idx >= compCount ) {
throw new CodecException("Idx out of bounds "+idx+", "+this);
}
@@ -343,7 +343,7 @@ public class JPEGDecoder {
public final int getCompCount() { return compCount; }
public final int getMaxCompID() { return maxCompID; }
- public final void putOrdered(int compID, ComponentIn component) {
+ public final void putOrdered(final int compID, final ComponentIn component) {
if( maxCompID < compID ) {
maxCompID = compID;
}
@@ -352,17 +352,17 @@ public class JPEGDecoder {
compIDs.add(compID);
comps[idx] = component;
}
- public final ComponentIn getCompByIndex(int i) {
+ public final ComponentIn getCompByIndex(final int i) {
checkBounds(i);
return comps[i];
}
- public final ComponentIn getCompByID(int componentID) {
+ public final ComponentIn getCompByID(final int componentID) {
return getCompByIndex( compIDs.indexOf(componentID) );
}
- public final int getCompID(int idx) {
+ public final int getCompID(final int idx) {
return compIDs.get(idx);
}
- public final boolean hasCompID(int componentID) {
+ public final boolean hasCompID(final int componentID) {
return compIDs.contains(componentID);
}
@Override
@@ -387,20 +387,20 @@ public class JPEGDecoder {
BinObj huffmanTableAC;
BinObj huffmanTableDC;
- ComponentIn(int h, int v, int qttIdx) {
+ ComponentIn(final int h, final int v, final int qttIdx) {
this.h = h;
this.v = v;
this.qttIdx = qttIdx;
}
- public final void allocateBlocks(int blocksPerColumn, int blocksPerColumnForMcu, int blocksPerLine, int blocksPerLineForMcu) {
+ public final void allocateBlocks(final int blocksPerColumn, final int blocksPerColumnForMcu, final int blocksPerLine, final int blocksPerLineForMcu) {
this.blocksPerColumn = blocksPerColumn;
this.blocksPerColumnForMcu = blocksPerColumnForMcu;
this.blocksPerLine = blocksPerLine;
this.blocksPerLineForMcu = blocksPerLineForMcu;
this.blocks = new int[blocksPerColumnForMcu][blocksPerLineForMcu][64];
}
- public final int[] getBlock(int row, int col) {
+ public final int[] getBlock(final int row, final int col) {
if( row >= blocksPerColumnForMcu || col >= blocksPerLineForMcu ) {
throw new CodecException("Out of bounds given ["+row+"]["+col+"] - "+this);
}
@@ -419,14 +419,14 @@ public class JPEGDecoder {
final float scaleX;
final float scaleY;
- ComponentOut(ArrayList<byte[]> lines, float scaleX, float scaleY) {
+ ComponentOut(final ArrayList<byte[]> lines, final float scaleX, final float scaleY) {
this.lines = lines;
this.scaleX = scaleX;
this.scaleY = scaleY;
}
/** Safely returning a line, if index exceeds number of lines, last line is returned. */
- public final byte[] getLine(int i) {
+ public final byte[] getLine(final int i) {
final int sz = lines.size();
return lines.get( i < sz ? i : sz - 1);
}
@@ -461,10 +461,10 @@ public class JPEGDecoder {
public final int getWidth() { return width; }
public final int getHeight() { return height; }
- private final void setStream(InputStream is) {
+ private final void setStream(final InputStream is) {
try {
bstream.setStream(is, false /* outputMode */);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e); // should not happen, no flush()
}
}
@@ -488,14 +488,14 @@ public class JPEGDecoder {
private final byte[] readDataBlock() throws IOException {
int count=0, i=0;
final int len=readUInt16(); count+=2;
- byte[] data = new byte[len-2];
+ final byte[] data = new byte[len-2];
while(count<len){
data[i++] = (byte)readUInt8(); count++;
}
if(DEBUG_IN) { System.err.println("JPEG.readDataBlock: net-len "+(len-2)+", "+this); dumpData(data, 0, len-2); }
return data;
}
- static final void dumpData(byte[] data, int offset, int len) {
+ static final void dumpData(final byte[] data, final int offset, final int len) {
for(int i=0; i<len; ) {
System.err.print(i%8+": ");
for(int j=0; j<8 && i<len; j++, i++) {
@@ -505,7 +505,7 @@ public class JPEGDecoder {
}
}
- public synchronized void clear(InputStream inputStream) {
+ public synchronized void clear(final InputStream inputStream) {
setStream(inputStream);
width = 0;
height = 0;
@@ -673,7 +673,7 @@ public class JPEGDecoder {
int count = 0;
final int sosLen = readUInt16(); count+=2;
final int selectorsCount = readUInt8(); count++;
- ArrayList<ComponentIn> components = new ArrayList<ComponentIn>();
+ final ArrayList<ComponentIn> components = new ArrayList<ComponentIn>();
if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); }
for (int i = 0; i < selectorsCount; i++) {
final int compID = readUInt8(); count++;
@@ -734,7 +734,7 @@ public class JPEGDecoder {
return this;
}
- private void prepareComponents(Frame frame) {
+ private void prepareComponents(final Frame frame) {
int maxH = 0, maxV = 0;
// for (componentId in frame.components) {
final int compCount = frame.getCompCount();
@@ -743,8 +743,8 @@ public class JPEGDecoder {
if (maxH < component.h) maxH = component.h;
if (maxV < component.v) maxV = component.v;
}
- int mcusPerLine = (int) Math.ceil(frame.samplesPerLine / 8f / maxH);
- int mcusPerColumn = (int) Math.ceil(frame.scanLines / 8f / maxV);
+ final int mcusPerLine = (int) Math.ceil(frame.samplesPerLine / 8f / maxH);
+ final int mcusPerColumn = (int) Math.ceil(frame.scanLines / 8f / maxV);
// for (componentId in frame.components) {
for (int i=0; i<compCount; i++) {
final ComponentIn component = frame.getCompByIndex(i);
@@ -773,7 +773,7 @@ public class JPEGDecoder {
final BinObj[] tree;
final byte b;
- BinObj(byte b) {
+ BinObj(final byte b) {
this.isValue= true;
this.b = b;
this.tree = null;
@@ -784,12 +784,12 @@ public class JPEGDecoder {
this.tree = new BinObj[2];
}
final byte getValue() { return b; }
- final BinObj get(int i) { return tree[i]; }
- final void set(byte i, byte v) { tree[i] = new BinObj(v); }
- final void set(byte i, BinObj v) { tree[i] = v; }
+ final BinObj get(final int i) { return tree[i]; }
+ final void set(final byte i, final byte v) { tree[i] = new BinObj(v); }
+ final void set(final byte i, final BinObj v) { tree[i] = v; }
}
- private BinObj buildHuffmanTable(int[] codeLengths, byte[] values) {
+ private BinObj buildHuffmanTable(final int[] codeLengths, final byte[] values) {
int k = 0;
int length = 16;
final ArrayList<BinObjIdxed> code = new ArrayList<BinObjIdxed>();
@@ -832,8 +832,8 @@ public class JPEGDecoder {
private int blocksPerColumn;
private int samplesPerLine;
- private ArrayList<byte[]> buildComponentData(Frame frame, ComponentIn component) {
- ArrayList<byte[]> lines = new ArrayList<byte[]>();
+ private ArrayList<byte[]> buildComponentData(final Frame frame, final ComponentIn component) {
+ final ArrayList<byte[]> lines = new ArrayList<byte[]>();
blocksPerLine = component.blocksPerLine;
blocksPerColumn = component.blocksPerColumn;
samplesPerLine = blocksPerLine << 3;
@@ -867,9 +867,9 @@ public class JPEGDecoder {
// "Practical Fast 1-D DCT Algorithms with 11 Multiplications",
// IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,
// 988-991.
- private void quantizeAndInverse(int[] zz, byte[] dataOut, int[] dataIn, int[] qt) {
+ private void quantizeAndInverse(final int[] zz, final byte[] dataOut, final int[] dataIn, final int[] qt) {
int v0, v1, v2, v3, v4, v5, v6, v7, t;
- int[] p = dataIn;
+ final int[] p = dataIn;
int i;
// dequant
@@ -879,7 +879,7 @@ public class JPEGDecoder {
// inverse DCT on rows
for (i = 0; i < 8; ++i) {
- int row = 8 * i;
+ final int row = 8 * i;
// check for all-zero AC coefficients
if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 &&
@@ -948,7 +948,7 @@ public class JPEGDecoder {
// inverse DCT on columns
for (i = 0; i < 8; ++i) {
- int col = i;
+ final int col = i;
// check for all-zero AC coefficients
if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 &&
@@ -1017,7 +1017,7 @@ public class JPEGDecoder {
// convert to 8-bit integers
for (i = 0; i < 64; ++i) {
- int sample = 128 + ((p[i] + 8) >> 4);
+ final int sample = 128 + ((p[i] + 8) >> 4);
dataOut[i] = (byte) ( sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample );
}
}
@@ -1039,8 +1039,8 @@ public class JPEGDecoder {
private int eobrun;
private int successiveACState, successiveACNextValue;
- private int decodeScan(Frame frame, ArrayList<ComponentIn> components, int resetInterval,
- int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException {
+ private int decodeScan(final Frame frame, final ArrayList<ComponentIn> components, int resetInterval,
+ final int spectralStart, final int spectralEnd, final int successivePrev, final int successive) throws IOException {
// this.precision = frame.precision;
// this.samplesPerLine = frame.samplesPerLine;
// this.scanLines = frame.scanLines;
@@ -1110,10 +1110,10 @@ public class JPEGDecoder {
mcu++;
}
}
- } catch (MarkerException markerException) {
+ } catch (final MarkerException markerException) {
if(DEBUG) { System.err.println("JPEG.decodeScan: Marker exception: "+markerException.getMessage()); markerException.printStackTrace(); }
return markerException.getMarker();
- } catch (CodecException codecException) {
+ } catch (final CodecException codecException) {
if(DEBUG) { System.err.println("JPEG.decodeScan: Codec exception: "+codecException.getMessage()); codecException.printStackTrace(); }
bstream.skip( bstream.getBitCount() ); // align to next byte
return M_EOI; // force end !
@@ -1159,7 +1159,7 @@ public class JPEGDecoder {
return bit;
}
- private int decodeHuffman(BinObj tree) throws IOException {
+ private int decodeHuffman(final BinObj tree) throws IOException {
BinObj node = tree;
int bit;
while ( ( bit = readBit() ) != -1 ) {
@@ -1182,7 +1182,7 @@ public class JPEGDecoder {
}
return n;
}
- private int receiveAndExtend(int length) throws IOException {
+ private int receiveAndExtend(final int length) throws IOException {
final int n = receive(length);
if (n >= 1 << (length - 1)) {
return n;
@@ -1198,7 +1198,7 @@ public class JPEGDecoder {
class BaselineDecoder implements DecoderFunction {
@Override
- public void decode(ComponentIn component, int[] zz) throws IOException {
+ public void decode(final ComponentIn component, final int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : receiveAndExtend(t);
zz[0] = ( component.pred += diff );
@@ -1222,7 +1222,7 @@ public class JPEGDecoder {
}
class DCFirstDecoder implements DecoderFunction {
@Override
- public void decode(ComponentIn component, int[] zz) throws IOException {
+ public void decode(final ComponentIn component, final int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : (receiveAndExtend(t) << successive);
zz[0] = ( component.pred += diff );
@@ -1230,19 +1230,20 @@ public class JPEGDecoder {
}
class DCSuccessiveDecoder implements DecoderFunction {
@Override
- public void decode(ComponentIn component, int[] zz) throws IOException {
+ public void decode(final ComponentIn component, final int[] zz) throws IOException {
zz[0] |= readBit() << successive;
}
}
class ACFirstDecoder implements DecoderFunction {
@Override
- public void decode(ComponentIn component, int[] zz) throws IOException {
+ public void decode(final ComponentIn component, final int[] zz) throws IOException {
if (eobrun > 0) {
eobrun--;
return;
}
- int k = spectralStart, e = spectralEnd;
+ int k = spectralStart;
+ final int e = spectralEnd;
while (k <= e) {
final int rs = decodeHuffman(component.huffmanTableAC);
final int s = rs & 15, r = rs >> 4;
@@ -1263,8 +1264,10 @@ public class JPEGDecoder {
}
class ACSuccessiveDecoder implements DecoderFunction {
@Override
- public void decode(ComponentIn component, int[] zz) throws IOException {
- int k = spectralStart, e = spectralEnd, r = 0;
+ public void decode(final ComponentIn component, final int[] zz) throws IOException {
+ int k = spectralStart;
+ final int e = spectralEnd;
+ int r = 0;
while (k <= e) {
final int z = dctZigZag[k];
switch (successiveACState) {
@@ -1324,14 +1327,14 @@ public class JPEGDecoder {
}
}
}
- void decodeMcu(ComponentIn component, DecoderFunction decoder, int mcu, int row, int col) throws IOException {
+ void decodeMcu(final ComponentIn component, final DecoderFunction decoder, final int mcu, final int row, final int col) throws IOException {
final int mcuRow = (mcu / mcusPerLine) | 0;
final int mcuCol = mcu % mcusPerLine;
final int blockRow = mcuRow * component.v + row;
final int blockCol = mcuCol * component.h + col;
decoder.decode(component, component.getBlock(blockRow, blockCol));
}
- void decodeBlock(ComponentIn component, DecoderFunction decoder, int mcu) throws IOException {
+ void decodeBlock(final ComponentIn component, final DecoderFunction decoder, final int mcu) throws IOException {
final int blockRow = (mcu / component.blocksPerLine) | 0;
final int blockCol = mcu % component.blocksPerLine;
decoder.decode(component, component.getBlock(blockRow, blockCol));
@@ -1359,7 +1362,7 @@ public class JPEGDecoder {
pixelStorage.storeRGB(x, y, (byte)R, (byte)G, (byte)B);
} */
- public synchronized void getPixel(JPEGDecoder.ColorSink pixelStorage, int width, int height) {
+ public synchronized void getPixel(final JPEGDecoder.ColorSink pixelStorage, final int width, final int height) {
final int scaleX = this.width / width, scaleY = this.height / height;
final int componentCount = this.components.length;
@@ -1507,11 +1510,11 @@ public class JPEGDecoder {
}
}
- private static byte clampTo8bit(float a) {
+ private static byte clampTo8bit(final float a) {
return (byte) ( a < 0f ? 0 : a > 255f ? 255 : a );
}
- private static String toHexString(int v) {
+ private static String toHexString(final int v) {
return "0x"+Integer.toHexString(v);
}
} \ No newline at end of file
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
index 5e177b8c3..c577c4fd5 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
@@ -53,7 +53,7 @@ public enum FilterType {
FILTER_UNKNOWN(-100), ;
public final int val;
- private FilterType(int val) {
+ private FilterType(final int val) {
this.val = val;
}
@@ -61,12 +61,12 @@ public enum FilterType {
static {
byVal = new HashMap<Integer, FilterType>();
- for (FilterType ft : values()) {
+ for (final FilterType ft : values()) {
byVal.put(ft.val, ft);
}
}
- public static FilterType getByVal(int i) {
+ public static FilterType getByVal(final int i) {
return byVal.get(i);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java
index 79eed8f85..63f456347 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java
@@ -11,15 +11,15 @@ class FilterWriteStrategy {
private FilterType currentType; // 0-4
private int lastRowTested = -1000000;
// performance of each filter (less is better) (can be negative)
- private double[] lastSums = new double[5];
+ private final double[] lastSums = new double[5];
// performance of each filter (less is better) (can be negative)
- private double[] lastEntropies = new double[5];
+ private final double[] lastEntropies = new double[5];
// a priori preference (NONE SUB UP AVERAGE PAETH)
private double[] preference = new double[] { 1.1, 1.1, 1.1, 1.1, 1.2 };
private int discoverEachLines = -1;
- private double[] histogram1 = new double[256];
+ private final double[] histogram1 = new double[256];
- FilterWriteStrategy(ImageInfo imgInfo, FilterType configuredType) {
+ FilterWriteStrategy(final ImageInfo imgInfo, final FilterType configuredType) {
this.imgInfo = imgInfo;
this.configuredType = configuredType;
if (configuredType.val < 0) { // first guess
@@ -36,7 +36,7 @@ class FilterWriteStrategy {
discoverEachLines = 1;
}
- boolean shouldTestAll(int rown) {
+ boolean shouldTestAll(final int rown) {
if (discoverEachLines > 0 && lastRowTested + discoverEachLines <= rown) {
currentType = null;
return true;
@@ -44,7 +44,7 @@ class FilterWriteStrategy {
return false;
}
- public void setPreference(double none, double sub, double up, double ave, double paeth) {
+ public void setPreference(final double none, final double sub, final double up, final double ave, final double paeth) {
preference = new double[] { none, sub, up, ave, paeth };
}
@@ -52,7 +52,7 @@ class FilterWriteStrategy {
return (discoverEachLines > 0);
}
- void fillResultsForFilter(int rown, FilterType type, double sum, int[] histo, boolean tentative) {
+ void fillResultsForFilter(final int rown, final FilterType type, final double sum, final int[] histo, final boolean tentative) {
lastRowTested = rown;
lastSums[type.val] = sum;
if (histo != null) {
@@ -72,7 +72,7 @@ class FilterWriteStrategy {
}
}
- FilterType gimmeFilterType(int rown, boolean useEntropy) {
+ FilterType gimmeFilterType(final int rown, final boolean useEntropy) {
if (currentType == null) { // get better
if (rown == 0)
currentType = FilterType.FILTER_SUB;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
index ac7b858e1..cdd17a291 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
@@ -92,7 +92,7 @@ public class ImageInfo {
/**
* Short constructor: assumes truecolor (RGB/RGBA)
*/
- public ImageInfo(int cols, int rows, int bitdepth, boolean alpha) {
+ public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha) {
this(cols, rows, bitdepth, alpha, false, false);
}
@@ -113,7 +113,7 @@ public class ImageInfo {
* @param indexed
* Flag: has palette
*/
- public ImageInfo(int cols, int rows, int bitdepth, boolean alpha, boolean grayscale, boolean indexed) {
+ public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha, final boolean grayscale, final boolean indexed) {
this.cols = cols;
this.rows = rows;
this.alpha = alpha;
@@ -176,14 +176,14 @@ public class ImageInfo {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- ImageInfo other = (ImageInfo) obj;
+ final ImageInfo other = (ImageInfo) obj;
if (alpha != other.alpha)
return false;
if (bitDepth != other.bitDepth)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
index e6afd8694..5ad2e4409 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
@@ -69,7 +69,7 @@ public class ImageLine {
/**
* default mode: INT packed
*/
- public ImageLine(ImageInfo imgInfo) {
+ public ImageLine(final ImageInfo imgInfo) {
this(imgInfo, SampleType.INT, false);
}
@@ -86,14 +86,14 @@ public class ImageLine {
* images
*
*/
- public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) {
+ public ImageLine(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode) {
this(imgInfo, stype, unpackedMode, null, null);
}
/**
* If a preallocated array is passed, the copy is shallow
*/
- ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode, int[] sci, byte[] scb) {
+ ImageLine(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode, final int[] sci, final byte[] scb) {
this.imgInfo = imgInfo;
channels = imgInfo.channels;
bitDepth = imgInfo.bitDepth;
@@ -118,7 +118,7 @@ public class ImageLine {
}
/** Sets row number (0 : Rows-1) */
- public void setRown(int n) {
+ public void setRown(final int n) {
this.rown = n;
}
@@ -274,7 +274,7 @@ public class ImageLine {
* The caller must be sure that the original was really packed
*/
public ImageLine unpackToNewImageLine() {
- ImageLine newline = new ImageLine(imgInfo, sampleType, true);
+ final ImageLine newline = new ImageLine(imgInfo, sampleType, true);
if (sampleType == SampleType.INT)
unpackInplaceInt(imgInfo, scanline, newline.scanline, false);
else
@@ -288,7 +288,7 @@ public class ImageLine {
* The caller must be sure that the original was really unpacked
*/
public ImageLine packToNewImageLine() {
- ImageLine newline = new ImageLine(imgInfo, sampleType, false);
+ final ImageLine newline = new ImageLine(imgInfo, sampleType, false);
if (sampleType == SampleType.INT)
packInplaceInt(imgInfo, scanline, newline.scanline, false);
else
@@ -300,7 +300,7 @@ public class ImageLine {
return filterUsed;
}
- public void setFilterUsed(FilterType ft) {
+ public void setFilterUsed(final FilterType ft) {
filterUsed = ft;
}
@@ -323,9 +323,9 @@ public class ImageLine {
/**
* Prints some statistics - just for debugging
*/
- public static void showLineInfo(ImageLine line) {
+ public static void showLineInfo(final ImageLine line) {
System.out.println(line);
- ImageLineStats stats = new ImageLineHelper.ImageLineStats(line);
+ final ImageLineStats stats = new ImageLineHelper.ImageLineStats(line);
System.out.println(stats);
System.out.println(ImageLineHelper.infoFirstLastPixels(line));
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
index 4636c3955..616ccd560 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
@@ -33,28 +33,28 @@ public class ImageLineHelper {
* @return R G B (A), one sample 0-255 per array element. Ready for
* pngw.writeRowInt()
*/
- public static int[] palette2rgb(ImageLine line, PngChunkPLTE pal, PngChunkTRNS trns, int[] buf) {
- boolean isalpha = trns != null;
- int channels = isalpha ? 4 : 3;
- int nsamples = line.imgInfo.cols * channels;
+ public static int[] palette2rgb(ImageLine line, final PngChunkPLTE pal, final PngChunkTRNS trns, int[] buf) {
+ final boolean isalpha = trns != null;
+ final int channels = isalpha ? 4 : 3;
+ final int nsamples = line.imgInfo.cols * channels;
if (buf == null || buf.length < nsamples)
buf = new int[nsamples];
if (!line.samplesUnpacked)
line = line.unpackToNewImageLine();
- boolean isbyte = line.sampleType == SampleType.BYTE;
- int nindexesWithAlpha = trns != null ? trns.getPalletteAlpha().length : 0;
+ final boolean isbyte = line.sampleType == SampleType.BYTE;
+ final int nindexesWithAlpha = trns != null ? trns.getPalletteAlpha().length : 0;
for (int c = 0; c < line.imgInfo.cols; c++) {
- int index = isbyte ? (line.scanlineb[c] & 0xFF) : line.scanline[c];
+ final int index = isbyte ? (line.scanlineb[c] & 0xFF) : line.scanline[c];
pal.getEntryRgb(index, buf, c * channels);
if (isalpha) {
- int alpha = index < nindexesWithAlpha ? trns.getPalletteAlpha()[index] : 255;
+ final int alpha = index < nindexesWithAlpha ? trns.getPalletteAlpha()[index] : 255;
buf[c * channels + 3] = alpha;
}
}
return buf;
}
- public static int[] palette2rgb(ImageLine line, PngChunkPLTE pal, int[] buf) {
+ public static int[] palette2rgb(final ImageLine line, final PngChunkPLTE pal, final int[] buf) {
return palette2rgb(line, pal, null, buf);
}
@@ -65,7 +65,7 @@ public class ImageLineHelper {
* Just for basic info or debugging. Shows values for first and last pixel.
* Does not include alpha
*/
- public static String infoFirstLastPixels(ImageLine line) {
+ public static String infoFirstLastPixels(final ImageLine line) {
return line.imgInfo.channels == 1 ? String.format("first=(%d) last=(%d)", line.scanline[0],
line.scanline[line.scanline.length - 1]) : String.format("first=(%d %d %d) last=(%d %d %d)",
line.scanline[0], line.scanline[1], line.scanline[2], line.scanline[line.scanline.length
@@ -73,8 +73,8 @@ public class ImageLineHelper {
line.scanline[line.scanline.length - line.imgInfo.channels + 2]);
}
- public static String infoFull(ImageLine line) {
- ImageLineStats stats = new ImageLineStats(line);
+ public static String infoFull(final ImageLine line) {
+ final ImageLineStats stats = new ImageLineStats(line);
return "row=" + line.getRown() + " " + stats.toString() + "\n " + infoFirstLastPixels(line);
}
@@ -104,7 +104,7 @@ public class ImageLineHelper {
+ String.format(" maxdif=(%.1f %.1f %.1f %.1f)", maxdif[0], maxdif[1], maxdif[2], maxdif[3]);
}
- public ImageLineStats(ImageLine line) {
+ public ImageLineStats(final ImageLine line) {
this.channels = line.channels;
if (line.channels < 3)
throw new PngjException("ImageLineStats only works for RGB - RGBA");
@@ -146,18 +146,18 @@ public class ImageLineHelper {
* integer packed R G B only for bitdepth=8! (does not check!)
*
**/
- public static int getPixelRGB8(ImageLine line, int column) {
- int offset = column * line.channels;
+ public static int getPixelRGB8(final ImageLine line, final int column) {
+ final int offset = column * line.channels;
return (line.scanline[offset] << 16) + (line.scanline[offset + 1] << 8) + (line.scanline[offset + 2]);
}
- public static int getPixelARGB8(ImageLine line, int column) {
- int offset = column * line.channels;
+ public static int getPixelARGB8(final ImageLine line, final int column) {
+ final int offset = column * line.channels;
return (line.scanline[offset + 3] << 24) + (line.scanline[offset] << 16) + (line.scanline[offset + 1] << 8)
+ (line.scanline[offset + 2]);
}
- public static void setPixelsRGB8(ImageLine line, int[] rgb) {
+ public static void setPixelsRGB8(final ImageLine line, final int[] rgb) {
for (int i = 0, j = 0; i < line.imgInfo.cols; i++) {
line.scanline[j++] = ((rgb[i] >> 16) & 0xFF);
line.scanline[j++] = ((rgb[i] >> 8) & 0xFF);
@@ -165,18 +165,18 @@ public class ImageLineHelper {
}
}
- public static void setPixelRGB8(ImageLine line, int col, int r, int g, int b) {
+ public static void setPixelRGB8(final ImageLine line, int col, final int r, final int g, final int b) {
col *= line.channels;
line.scanline[col++] = r;
line.scanline[col++] = g;
line.scanline[col] = b;
}
- public static void setPixelRGB8(ImageLine line, int col, int rgb) {
+ public static void setPixelRGB8(final ImageLine line, final int col, final int rgb) {
setPixelRGB8(line, col, (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF);
}
- public static void setPixelsRGBA8(ImageLine line, int[] rgb) {
+ public static void setPixelsRGBA8(final ImageLine line, final int[] rgb) {
for (int i = 0, j = 0; i < line.imgInfo.cols; i++) {
line.scanline[j++] = ((rgb[i] >> 16) & 0xFF);
line.scanline[j++] = ((rgb[i] >> 8) & 0xFF);
@@ -185,7 +185,7 @@ public class ImageLineHelper {
}
}
- public static void setPixelRGBA8(ImageLine line, int col, int r, int g, int b, int a) {
+ public static void setPixelRGBA8(final ImageLine line, int col, final int r, final int g, final int b, final int a) {
col *= line.channels;
line.scanline[col++] = r;
line.scanline[col++] = g;
@@ -193,53 +193,53 @@ public class ImageLineHelper {
line.scanline[col] = a;
}
- public static void setPixelRGBA8(ImageLine line, int col, int rgb) {
+ public static void setPixelRGBA8(final ImageLine line, final int col, final int rgb) {
setPixelRGBA8(line, col, (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF, (rgb >> 24) & 0xFF);
}
- public static void setValD(ImageLine line, int i, double d) {
+ public static void setValD(final ImageLine line, final int i, final double d) {
line.scanline[i] = double2int(line, d);
}
- public static int interpol(int a, int b, int c, int d, double dx, double dy) {
+ public static int interpol(final int a, final int b, final int c, final int d, final double dx, final double dy) {
// a b -> x (0-1)
// c d
//
- double e = a * (1.0 - dx) + b * dx;
- double f = c * (1.0 - dx) + d * dx;
+ final double e = a * (1.0 - dx) + b * dx;
+ final double f = c * (1.0 - dx) + d * dx;
return (int) (e * (1 - dy) + f * dy + 0.5);
}
- public static double int2double(ImageLine line, int p) {
+ public static double int2double(final ImageLine line, final int p) {
return line.bitDepth == 16 ? p / 65535.0 : p / 255.0;
// TODO: replace my multiplication? check for other bitdepths
}
- public static double int2doubleClamped(ImageLine line, int p) {
+ public static double int2doubleClamped(final ImageLine line, final int p) {
// TODO: replace my multiplication?
- double d = line.bitDepth == 16 ? p / 65535.0 : p / 255.0;
+ final double d = line.bitDepth == 16 ? p / 65535.0 : p / 255.0;
return d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d);
}
- public static int double2int(ImageLine line, double d) {
+ public static int double2int(final ImageLine line, double d) {
d = d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d);
return line.bitDepth == 16 ? (int) (d * 65535.0 + 0.5) : (int) (d * 255.0 + 0.5); //
}
- public static int double2intClamped(ImageLine line, double d) {
+ public static int double2intClamped(final ImageLine line, double d) {
d = d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d);
return line.bitDepth == 16 ? (int) (d * 65535.0 + 0.5) : (int) (d * 255.0 + 0.5); //
}
- public static int clampTo_0_255(int i) {
+ public static int clampTo_0_255(final int i) {
return i > 255 ? 255 : (i < 0 ? 0 : i);
}
- public static int clampTo_0_65535(int i) {
+ public static int clampTo_0_65535(final int i) {
return i > 65535 ? 65535 : (i < 0 ? 0 : i);
}
- public static int clampTo_128_127(int x) {
+ public static int clampTo_128_127(final int x) {
return x > 127 ? 127 : (x < -128 ? -128 : x);
}
@@ -255,9 +255,9 @@ public class ImageLineHelper {
* You probably should use {@link ImageLine#unpackToNewImageLine()}
*
*/
- public static int[] unpack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
- int len1 = imgInfo.samplesPerRow;
- int len0 = imgInfo.samplesPerRowPacked;
+ public static int[] unpack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale) {
+ final int len1 = imgInfo.samplesPerRow;
+ final int len0 = imgInfo.samplesPerRowPacked;
if (dst == null || dst.length < len1)
dst = new int[len1];
if (imgInfo.packed)
@@ -267,9 +267,9 @@ public class ImageLineHelper {
return dst;
}
- public static byte[] unpack(ImageInfo imgInfo, byte[] src, byte[] dst, boolean scale) {
- int len1 = imgInfo.samplesPerRow;
- int len0 = imgInfo.samplesPerRowPacked;
+ public static byte[] unpack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale) {
+ final int len1 = imgInfo.samplesPerRow;
+ final int len0 = imgInfo.samplesPerRowPacked;
if (dst == null || dst.length < len1)
dst = new byte[len1];
if (imgInfo.packed)
@@ -286,8 +286,8 @@ public class ImageLineHelper {
*
* You probably should use {@link ImageLine#packToNewImageLine()}
*/
- public static int[] pack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
- int len0 = imgInfo.samplesPerRowPacked;
+ public static int[] pack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale) {
+ final int len0 = imgInfo.samplesPerRowPacked;
if (dst == null || dst.length < len0)
dst = new int[len0];
if (imgInfo.packed)
@@ -297,8 +297,8 @@ public class ImageLineHelper {
return dst;
}
- public static byte[] pack(ImageInfo imgInfo, byte[] src, byte[] dst, boolean scale) {
- int len0 = imgInfo.samplesPerRowPacked;
+ public static byte[] pack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale) {
+ final int len0 = imgInfo.samplesPerRowPacked;
if (dst == null || dst.length < len0)
dst = new byte[len0];
if (imgInfo.packed)
@@ -308,7 +308,7 @@ public class ImageLineHelper {
return dst;
}
- static int getMaskForPackedFormats(int bitDepth) { // Utility function for pack/unpack
+ static int getMaskForPackedFormats(final int bitDepth) { // Utility function for pack/unpack
if (bitDepth == 4)
return 0xf0;
else if (bitDepth == 2)
@@ -317,7 +317,7 @@ public class ImageLineHelper {
return 0x80; // bitDepth == 1
}
- static int getMaskForPackedFormatsLs(int bitDepth) { // Utility function for pack/unpack
+ static int getMaskForPackedFormatsLs(final int bitDepth) { // Utility function for pack/unpack
if (bitDepth == 4)
return 0x0f;
else if (bitDepth == 2)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
index fb2cf5910..8f6216ab2 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
@@ -36,7 +36,7 @@ public class ImageLines {
* @param nRows
* @param rowStep
*/
- public ImageLines(ImageInfo imgInfo, SampleType stype, boolean unpackedMode, int rowOffset, int nRows, int rowStep) {
+ public ImageLines(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode, final int rowOffset, final int nRows, final int rowStep) {
this.imgInfo = imgInfo;
channels = imgInfo.channels;
bitDepth = imgInfo.bitDepth;
@@ -61,8 +61,8 @@ public class ImageLines {
* and rounding down) Eg: rowOffset=4,rowStep=2 imageRowToMatrixRow(17)
* returns 6 , imageRowToMatrixRow(1) returns 0
*/
- public int imageRowToMatrixRow(int imrow) {
- int r = (imrow - rowOffset) / rowStep;
+ public int imageRowToMatrixRow(final int imrow) {
+ final int r = (imrow - rowOffset) / rowStep;
return r < 0 ? 0 : (r < nRows ? r : nRows - 1);
}
@@ -71,7 +71,7 @@ public class ImageLines {
*/
public int imageRowToMatrixRowStrict(int imrow) {
imrow -= rowOffset;
- int mrow = imrow >= 0 && imrow % rowStep == 0 ? imrow / rowStep : -1;
+ final int mrow = imrow >= 0 && imrow % rowStep == 0 ? imrow / rowStep : -1;
return mrow < nRows ? mrow : -1;
}
@@ -82,7 +82,7 @@ public class ImageLines {
* Matrix row number
* @return Image row number. Invalid only if mrow is invalid
*/
- public int matrixRowToImageRow(int mrow) {
+ public int matrixRowToImageRow(final int mrow) {
return mrow * rowStep + rowOffset;
}
@@ -96,10 +96,10 @@ public class ImageLines {
* @return A new ImageLine, backed by the matrix, with the correct ('real')
* rownumber
*/
- public ImageLine getImageLineAtMatrixRow(int mrow) {
+ public ImageLine getImageLineAtMatrixRow(final int mrow) {
if (mrow < 0 || mrow > nRows)
throw new PngjException("Bad row " + mrow + ". Should be positive and less than " + nRows);
- ImageLine imline = sampleType == SampleType.INT ? new ImageLine(imgInfo, sampleType, samplesUnpacked,
+ final ImageLine imline = sampleType == SampleType.INT ? new ImageLine(imgInfo, sampleType, samplesUnpacked,
scanlines[mrow], null) : new ImageLine(imgInfo, sampleType, samplesUnpacked, null, scanlinesb[mrow]);
imline.setRown(matrixRowToImageRow(mrow));
return imline;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java
index e099c4f6a..436821cf7 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java
@@ -20,7 +20,7 @@ class PngDeinterlacer {
private short[][] imageShort;
private byte[][] imageByte;
- PngDeinterlacer(ImageInfo iminfo) {
+ PngDeinterlacer(final ImageInfo iminfo) {
this.imi = iminfo;
pass = 0;
if (imi.packed) {
@@ -40,14 +40,14 @@ class PngDeinterlacer {
}
/** this refers to the row currRowSubimg */
- void setRow(int n) {
+ void setRow(final int n) {
currRowSubimg = n;
currRowReal = n * dY + oY;
if (currRowReal < 0 || currRowReal >= imi.rows)
throw new PngjExceptionInternal("bad row - this should not happen");
}
- void setPass(int p) {
+ void setPass(final int p) {
if (this.pass == p)
return;
pass = p;
@@ -105,7 +105,7 @@ class PngDeinterlacer {
}
// notice that this is a "partial" deinterlace, it will be called several times for the same row!
- void deinterlaceInt(int[] src, int[] dst, boolean readInPackedFormat) {
+ void deinterlaceInt(final int[] src, final int[] dst, final boolean readInPackedFormat) {
if (!(imi.packed && readInPackedFormat))
for (int i = 0, j = oXsamples; i < cols * imi.channels; i += imi.channels, j += dXsamples)
for (int k = 0; k < imi.channels; k++)
@@ -115,7 +115,7 @@ class PngDeinterlacer {
}
// interlaced+packed = monster; this is very clumsy!
- private void deinterlaceIntPacked(int[] src, int[] dst) {
+ private void deinterlaceIntPacked(final int[] src, final int[] dst) {
int spos, smod, smask; // source byte position, bits to shift to left (01,2,3,4
int tpos, tmod, p, d;
spos = 0;
@@ -143,7 +143,7 @@ class PngDeinterlacer {
}
// yes, duplication of code is evil, normally
- void deinterlaceByte(byte[] src, byte[] dst, boolean readInPackedFormat) {
+ void deinterlaceByte(final byte[] src, final byte[] dst, final boolean readInPackedFormat) {
if (!(imi.packed && readInPackedFormat))
for (int i = 0, j = oXsamples; i < cols * imi.channels; i += imi.channels, j += dXsamples)
for (int k = 0; k < imi.channels; k++)
@@ -152,7 +152,7 @@ class PngDeinterlacer {
deinterlacePackedByte(src, dst);
}
- private void deinterlacePackedByte(byte[] src, byte[] dst) {
+ private void deinterlacePackedByte(final byte[] src, final byte[] dst) {
int spos, smod, smask; // source byte position, bits to shift to left (01,2,3,4
int tpos, tmod, p, d;
// what the heck are you reading here? I told you would not enjoy this. Try Dostoyevsky or Simone Weil instead
@@ -230,7 +230,7 @@ class PngDeinterlacer {
return imageInt;
}
- void setImageInt(int[][] imageInt) {
+ void setImageInt(final int[][] imageInt) {
this.imageInt = imageInt;
}
@@ -238,7 +238,7 @@ class PngDeinterlacer {
return imageShort;
}
- void setImageShort(short[][] imageShort) {
+ void setImageShort(final short[][] imageShort) {
this.imageShort = imageShort;
}
@@ -246,20 +246,20 @@ class PngDeinterlacer {
return imageByte;
}
- void setImageByte(byte[][] imageByte) {
+ void setImageByte(final byte[][] imageByte) {
this.imageByte = imageByte;
}
static void test() {
- Random rand = new Random();
- PngDeinterlacer ih = new PngDeinterlacer(new ImageInfo(rand.nextInt(35) + 1, rand.nextInt(52) + 1, 8, true));
+ final Random rand = new Random();
+ final PngDeinterlacer ih = new PngDeinterlacer(new ImageInfo(rand.nextInt(35) + 1, rand.nextInt(52) + 1, 8, true));
int np = ih.imi.cols * ih.imi.rows;
System.out.println(ih.imi);
for (int p = 1; p <= 7; p++) {
ih.setPass(p);
for (int row = 0; row < ih.getRows(); row++) {
ih.setRow(row);
- int b = ih.getCols();
+ final int b = ih.getCols();
np -= b;
System.out.printf("Read %d pixels. Pass:%d Realline:%d cols=%d dX=%d oX=%d last:%b\n", b, ih.pass,
ih.currRowReal, ih.cols, ih.dX, ih.oX, ih.isAtLastRow());
@@ -270,7 +270,7 @@ class PngDeinterlacer {
throw new PngjExceptionInternal("wtf??" + ih.imi);
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
test();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
index 9e64c3eb1..f1bee1957 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
@@ -31,18 +31,18 @@ public class PngHelperInternal {
return new byte[] { -119, 80, 78, 71, 13, 10, 26, 10 };
}
- public static int doubleToInt100000(double d) {
+ public static int doubleToInt100000(final double d) {
return (int) (d * 100000.0 + 0.5);
}
- public static double intToDouble100000(int i) {
+ public static double intToDouble100000(final int i) {
return i / 100000.0;
}
- public static int readByte(InputStream is) {
+ public static int readByte(final InputStream is) {
try {
return is.read();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException("error reading byte", e);
}
}
@@ -52,14 +52,14 @@ public class PngHelperInternal {
*
* PNG uses "network byte order"
*/
- public static int readInt2(InputStream is) {
+ public static int readInt2(final InputStream is) {
try {
- int b1 = is.read();
- int b2 = is.read();
+ final int b1 = is.read();
+ final int b2 = is.read();
if (b1 == -1 || b2 == -1)
return -1;
return (b1 << 8) + b2;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException("error reading readInt2", e);
}
}
@@ -67,58 +67,58 @@ public class PngHelperInternal {
/**
* -1 if eof
*/
- public static int readInt4(InputStream is) {
+ public static int readInt4(final InputStream is) {
try {
- int b1 = is.read();
- int b2 = is.read();
- int b3 = is.read();
- int b4 = is.read();
+ final int b1 = is.read();
+ final int b2 = is.read();
+ final int b3 = is.read();
+ final int b4 = is.read();
if (b1 == -1 || b2 == -1 || b3 == -1 || b4 == -1)
return -1;
return (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException("error reading readInt4", e);
}
}
- public static int readInt1fromByte(byte[] b, int offset) {
+ public static int readInt1fromByte(final byte[] b, final int offset) {
return (b[offset] & 0xff);
}
- public static int readInt2fromBytes(byte[] b, int offset) {
+ public static int readInt2fromBytes(final byte[] b, final int offset) {
return ((b[offset] & 0xff) << 16) | ((b[offset + 1] & 0xff));
}
- public static int readInt4fromBytes(byte[] b, int offset) {
+ public static int readInt4fromBytes(final byte[] b, final int offset) {
return ((b[offset] & 0xff) << 24) | ((b[offset + 1] & 0xff) << 16) | ((b[offset + 2] & 0xff) << 8)
| (b[offset + 3] & 0xff);
}
- public static void writeByte(OutputStream os, byte b) {
+ public static void writeByte(final OutputStream os, final byte b) {
try {
os.write(b);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjOutputException(e);
}
}
- public static void writeInt2(OutputStream os, int n) {
- byte[] temp = { (byte) ((n >> 8) & 0xff), (byte) (n & 0xff) };
+ public static void writeInt2(final OutputStream os, final int n) {
+ final byte[] temp = { (byte) ((n >> 8) & 0xff), (byte) (n & 0xff) };
writeBytes(os, temp);
}
- public static void writeInt4(OutputStream os, int n) {
- byte[] temp = new byte[4];
+ public static void writeInt4(final OutputStream os, final int n) {
+ final byte[] temp = new byte[4];
writeInt4tobytes(n, temp, 0);
writeBytes(os, temp);
}
- public static void writeInt2tobytes(int n, byte[] b, int offset) {
+ public static void writeInt2tobytes(final int n, final byte[] b, final int offset) {
b[offset] = (byte) ((n >> 8) & 0xff);
b[offset + 1] = (byte) (n & 0xff);
}
- public static void writeInt4tobytes(int n, byte[] b, int offset) {
+ public static void writeInt4tobytes(final int n, final byte[] b, final int offset) {
b[offset] = (byte) ((n >> 24) & 0xff);
b[offset + 1] = (byte) ((n >> 16) & 0xff);
b[offset + 2] = (byte) ((n >> 8) & 0xff);
@@ -128,26 +128,26 @@ public class PngHelperInternal {
/**
* guaranteed to read exactly len bytes. throws error if it can't
*/
- public static void readBytes(InputStream is, byte[] b, int offset, int len) {
+ public static void readBytes(final InputStream is, final byte[] b, final int offset, final int len) {
if (len == 0)
return;
try {
int read = 0;
while (read < len) {
- int n = is.read(b, offset + read, len - read);
+ final int n = is.read(b, offset + read, len - read);
if (n < 1)
throw new PngjInputException("error reading bytes, " + n + " !=" + len);
read += n;
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException("error reading", e);
}
}
- public static void skipBytes(InputStream is, long len) {
+ public static void skipBytes(final InputStream is, long len) {
try {
while (len > 0) {
- long n1 = is.skip(len);
+ final long n1 = is.skip(len);
if (n1 > 0) {
len -= n1;
} else if (n1 == 0) { // should we retry? lets read one byte
@@ -159,28 +159,28 @@ public class PngHelperInternal {
// negative? this should never happen but...
throw new IOException("skip() returned a negative value ???");
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException(e);
}
}
- public static void writeBytes(OutputStream os, byte[] b) {
+ public static void writeBytes(final OutputStream os, final byte[] b) {
try {
os.write(b);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjOutputException(e);
}
}
- public static void writeBytes(OutputStream os, byte[] b, int offset, int n) {
+ public static void writeBytes(final OutputStream os, final byte[] b, final int offset, final int n) {
try {
os.write(b, offset, n);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjOutputException(e);
}
}
- public static void logdebug(String msg) {
+ public static void logdebug(final String msg) {
if (DEBUG)
System.out.println(msg);
}
@@ -198,43 +198,43 @@ public class PngHelperInternal {
}
// / filters
- public static int filterRowNone(int r) {
- return (int) (r & 0xFF);
+ public static int filterRowNone(final int r) {
+ return r & 0xFF;
}
- public static int filterRowSub(int r, int left) {
- return ((int) (r - left) & 0xFF);
+ public static int filterRowSub(final int r, final int left) {
+ return (r - left & 0xFF);
}
- public static int filterRowUp(int r, int up) {
- return ((int) (r - up) & 0xFF);
+ public static int filterRowUp(final int r, final int up) {
+ return (r - up & 0xFF);
}
- public static int filterRowAverage(int r, int left, int up) {
+ public static int filterRowAverage(final int r, final int left, final int up) {
return (r - (left + up) / 2) & 0xFF;
}
- public static int filterRowPaeth(int r, int left, int up, int upleft) { // a = left, b = above, c = upper left
+ public static int filterRowPaeth(final int r, final int left, final int up, final int upleft) { // a = left, b = above, c = upper left
return (r - filterPaethPredictor(left, up, upleft)) & 0xFF;
}
- public static int unfilterRowNone(int r) {
- return (int) (r & 0xFF);
+ public static int unfilterRowNone(final int r) {
+ return r & 0xFF;
}
- public static int unfilterRowSub(int r, int left) {
- return ((int) (r + left) & 0xFF);
+ public static int unfilterRowSub(final int r, final int left) {
+ return (r + left & 0xFF);
}
- public static int unfilterRowUp(int r, int up) {
- return ((int) (r + up) & 0xFF);
+ public static int unfilterRowUp(final int r, final int up) {
+ return (r + up & 0xFF);
}
- public static int unfilterRowAverage(int r, int left, int up) {
+ public static int unfilterRowAverage(final int r, final int left, final int up) {
return (r + (left + up) / 2) & 0xFF;
}
- public static int unfilterRowPaeth(int r, int left, int up, int upleft) { // a = left, b = above, c = upper left
+ public static int unfilterRowPaeth(final int r, final int left, final int up, final int upleft) { // a = left, b = above, c = upper left
return (r + filterPaethPredictor(left, up, upleft)) & 0xFF;
}
@@ -259,11 +259,11 @@ public class PngHelperInternal {
/*
* we put this methods here so as to not pollute the public interface of PngReader
*/
- public final static void initCrcForTests(PngReader pngr) {
+ public final static void initCrcForTests(final PngReader pngr) {
pngr.initCrctest();
}
- public final static long getCrctestVal(PngReader pngr) {
+ public final static long getCrctestVal(final PngReader pngr) {
return pngr.getCrctestVal();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java
index cdad09809..cde4b517e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java
@@ -18,7 +18,7 @@ class PngIDatChunkInputStream extends InputStream {
private final CRC32 crcEngine;
private boolean checkCrc = true;
private int lenLastChunk;
- private byte[] idLastChunk = new byte[4];
+ private final byte[] idLastChunk = new byte[4];
private int toReadThisChunk = 0;
private boolean ended = false;
private long offset; // offset inside whole inputstream (counting bytes before IDAT)
@@ -28,7 +28,7 @@ class PngIDatChunkInputStream extends InputStream {
public final int len;
public final long offset;
- private IdatChunkInfo(int len, long offset) {
+ private IdatChunkInfo(final int len, final long offset) {
this.len = len;
this.offset = offset;
}
@@ -40,7 +40,7 @@ class PngIDatChunkInputStream extends InputStream {
* Constructor must be called just after reading length and id of first IDAT
* chunk
**/
- PngIDatChunkInputStream(InputStream iStream, int lenFirstChunk, long offset) {
+ PngIDatChunkInputStream(final InputStream iStream, final int lenFirstChunk, final long offset) {
this.offset = offset;
inputStream = iStream;
this.lenLastChunk = lenFirstChunk;
@@ -70,10 +70,10 @@ class PngIDatChunkInputStream extends InputStream {
// Those values are left in idLastChunk / lenLastChunk
// Skips empty IDATS
do {
- int crc = PngHelperInternal.readInt4(inputStream); //
+ final int crc = PngHelperInternal.readInt4(inputStream); //
offset += 4;
if (checkCrc) {
- int crccalc = (int) crcEngine.getValue();
+ final int crccalc = (int) crcEngine.getValue();
if (lenLastChunk > 0 && crc != crccalc)
throw new PngjBadCrcException("error reading idat; offset: " + offset);
crcEngine.reset();
@@ -101,7 +101,7 @@ class PngIDatChunkInputStream extends InputStream {
*/
void forceChunkEnd() {
if (!ended) {
- byte[] dummy = new byte[toReadThisChunk];
+ final byte[] dummy = new byte[toReadThisChunk];
PngHelperInternal.readBytes(inputStream, dummy, 0, toReadThisChunk);
if (checkCrc)
crcEngine.update(dummy, 0, toReadThisChunk);
@@ -114,12 +114,12 @@ class PngIDatChunkInputStream extends InputStream {
* ended prematurely. That is our error.
*/
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
if (ended)
return -1; // can happen only when raw reading, see Pngreader.readAndSkipsAllRows()
if (toReadThisChunk == 0)
throw new PngjExceptionInternal("this should not happen");
- int n = inputStream.read(b, off, len >= toReadThisChunk ? toReadThisChunk : len);
+ final int n = inputStream.read(b, off, len >= toReadThisChunk ? toReadThisChunk : len);
if (n > 0) {
if (checkCrc)
crcEngine.update(b, off, n);
@@ -133,7 +133,7 @@ class PngIDatChunkInputStream extends InputStream {
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return this.read(b, 0, b.length);
}
@@ -141,8 +141,8 @@ class PngIDatChunkInputStream extends InputStream {
public int read() throws IOException {
// PngHelper.logdebug("read() should go here");
// inneficient - but this should be used rarely
- byte[] b1 = new byte[1];
- int r = this.read(b1, 0, 1);
+ final byte[] b1 = new byte[1];
+ final int r = this.read(b1, 0, 1);
return r < 0 ? -1 : (int) b1[0];
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java
index 411d18819..38b500cd3 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java
@@ -13,18 +13,18 @@ class PngIDatChunkOutputStream extends ProgressiveOutputStream {
private static final int SIZE_DEFAULT = 32768; // 32k
private final OutputStream outputStream;
- PngIDatChunkOutputStream(OutputStream outputStream) {
+ PngIDatChunkOutputStream(final OutputStream outputStream) {
this(outputStream, 0);
}
- PngIDatChunkOutputStream(OutputStream outputStream, int size) {
+ PngIDatChunkOutputStream(final OutputStream outputStream, final int size) {
super(size > 0 ? size : SIZE_DEFAULT);
this.outputStream = outputStream;
}
@Override
- protected final void flushBuffer(byte[] b, int len) {
- ChunkRaw c = new ChunkRaw(len, ChunkHelper.b_IDAT, false);
+ protected final void flushBuffer(final byte[] b, final int len) {
+ final ChunkRaw c = new ChunkRaw(len, ChunkHelper.b_IDAT, false);
c.data = b;
c.writeChunk(outputStream);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
index 0412beb8c..f77d4f4e0 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
@@ -100,32 +100,32 @@ public class PngReader {
* error/debug messages
*
*/
- public PngReader(InputStream inputStream, String filenameOrDescription) {
+ public PngReader(final InputStream inputStream, final String filenameOrDescription) {
this.filename = filenameOrDescription == null ? "" : filenameOrDescription;
this.inputStream = inputStream;
this.chunksList = new ChunksList(null);
this.metadata = new PngMetadata(chunksList);
// starts reading: signature
- byte[] pngid = new byte[8];
+ final byte[] pngid = new byte[8];
PngHelperInternal.readBytes(inputStream, pngid, 0, pngid.length);
offset += pngid.length;
if (!Arrays.equals(pngid, PngHelperInternal.getPngIdSignature()))
throw new PngjInputException("Bad PNG signature");
// reads first chunk
currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR;
- int clen = PngHelperInternal.readInt4(inputStream);
+ final int clen = PngHelperInternal.readInt4(inputStream);
offset += 4;
if (clen != 13)
throw new PngjInputException("IDHR chunk len != 13 ?? " + clen);
- byte[] chunkid = new byte[4];
+ final byte[] chunkid = new byte[4];
PngHelperInternal.readBytes(inputStream, chunkid, 0, 4);
if (!Arrays.equals(chunkid, ChunkHelper.b_IHDR))
throw new PngjInputException("IHDR not found as first chunk??? [" + ChunkHelper.toString(chunkid) + "]");
offset += 4;
- PngChunkIHDR ihdr = (PngChunkIHDR) readChunk(chunkid, clen, false);
- boolean alpha = (ihdr.getColormodel() & 0x04) != 0;
- boolean palette = (ihdr.getColormodel() & 0x01) != 0;
- boolean grayscale = (ihdr.getColormodel() == 0 || ihdr.getColormodel() == 4);
+ final PngChunkIHDR ihdr = (PngChunkIHDR) readChunk(chunkid, clen, false);
+ final boolean alpha = (ihdr.getColormodel() & 0x04) != 0;
+ final boolean palette = (ihdr.getColormodel() & 0x01) != 0;
+ final boolean grayscale = (ihdr.getColormodel() == 0 || ihdr.getColormodel() == 4);
// creates ImgInfo and imgLine, and allocates buffers
imgInfo = new ImageInfo(ihdr.getCols(), ihdr.getRows(), ihdr.getBitspc(), alpha, grayscale, palette);
interlaced = ihdr.getInterlaced() == 1;
@@ -163,7 +163,7 @@ public class PngReader {
if (currentChunkGroup < ChunksList.CHUNK_GROUP_5_AFTERIDAT) {
try {
idatIstream.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
}
readLastChunks();
}
@@ -174,23 +174,23 @@ public class PngReader {
if (currentChunkGroup < ChunksList.CHUNK_GROUP_6_END) { // this could only happen if forced close
try {
idatIstream.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
}
currentChunkGroup = ChunksList.CHUNK_GROUP_6_END;
}
if (shouldCloseStream) {
try {
inputStream.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new PngjInputException("error closing input stream!", e);
}
}
}
// nbytes: NOT including the filter byte. leaves result in rowb
- private void unfilterRow(int nbytes) {
- int ftn = rowbfilter[0];
- FilterType ft = FilterType.getByVal(ftn);
+ private void unfilterRow(final int nbytes) {
+ final int ftn = rowbfilter[0];
+ final FilterType ft = FilterType.getByVal(ftn);
if (ft == null)
throw new PngjInputException("Filter type " + ftn + " invalid");
switch (ft) {
@@ -226,7 +226,7 @@ public class PngReader {
private void unfilterRowNone(final int nbytes) {
for (int i = 1; i <= nbytes; i++) {
- rowb[i] = (byte) (rowbfilter[i]);
+ rowb[i] = (rowbfilter[i]);
}
}
@@ -242,7 +242,7 @@ public class PngReader {
private void unfilterRowSub(final int nbytes) {
int i, j;
for (i = 1; i <= imgInfo.bytesPixel; i++) {
- rowb[i] = (byte) (rowbfilter[i]);
+ rowb[i] = (rowbfilter[i]);
}
for (j = 1, i = imgInfo.bytesPixel + 1; i <= nbytes; i++, j++) {
rowb[i] = (byte) (rowbfilter[i] + rowb[j]);
@@ -276,7 +276,7 @@ public class PngReader {
return;
int clen = 0;
boolean found = false;
- byte[] chunkid = new byte[4]; // it's important to reallocate in each iteration
+ final byte[] chunkid = new byte[4]; // it's important to reallocate in each iteration
currentChunkGroup = ChunksList.CHUNK_GROUP_1_AFTERIDHR;
while (!found) {
clen = PngHelperInternal.readInt4(inputStream);
@@ -300,7 +300,7 @@ public class PngReader {
if (Arrays.equals(chunkid, ChunkHelper.b_PLTE))
currentChunkGroup = ChunksList.CHUNK_GROUP_3_AFTERPLTE;
}
- int idatLen = found ? clen : -1;
+ final int idatLen = found ? clen : -1;
if (idatLen < 0)
throw new PngjInputException("first idat chunk not found!");
iIdatCstream = new PngIDatChunkInputStream(inputStream, idatLen, offset);
@@ -323,7 +323,7 @@ public class PngReader {
if (!iIdatCstream.isEnded())
iIdatCstream.forceChunkEnd();
int clen = iIdatCstream.getLenLastChunk();
- byte[] chunkid = iIdatCstream.getIdLastChunk();
+ final byte[] chunkid = iIdatCstream.getIdLastChunk();
boolean endfound = false;
boolean first = true;
boolean skip = false;
@@ -355,14 +355,14 @@ public class PngReader {
* Reads chunkd from input stream, adds to ChunksList, and returns it. If
* it's skipped, a PngChunkSkipped object is created
*/
- private PngChunk readChunk(byte[] chunkid, int clen, boolean skipforced) {
+ private PngChunk readChunk(final byte[] chunkid, final int clen, final boolean skipforced) {
if (clen < 0)
throw new PngjInputException("invalid chunk lenght: " + clen);
// skipChunksByIdSet is created lazyly, if fist IHDR has already been read
if (skipChunkIdsSet == null && currentChunkGroup > ChunksList.CHUNK_GROUP_0_IDHR)
skipChunkIdsSet = new HashSet<String>(Arrays.asList(skipChunkIds));
- String chunkidstr = ChunkHelper.toString(chunkid);
- boolean critical = ChunkHelper.isCritical(chunkidstr);
+ final String chunkidstr = ChunkHelper.toString(chunkid);
+ final boolean critical = ChunkHelper.isCritical(chunkidstr);
PngChunk pngChunk = null;
boolean skip = skipforced;
if (maxTotalBytesRead > 0 && clen + offset > maxTotalBytesRead)
@@ -379,7 +379,7 @@ public class PngReader {
// clen + 4) for risk of overflow
pngChunk = new PngChunkSkipped(chunkidstr, imgInfo, clen);
} else {
- ChunkRaw chunk = new ChunkRaw(clen, chunkid, true);
+ final ChunkRaw chunk = new ChunkRaw(clen, chunkid, true);
chunk.readChunkData(inputStream, crcEnabled || critical);
pngChunk = PngChunk.factory(chunk, imgInfo);
if (!pngChunk.crit)
@@ -398,7 +398,7 @@ public class PngReader {
* <p>
* This happens rarely - most errors are fatal.
*/
- protected void logWarn(String warn) {
+ protected void logWarn(final String warn) {
System.err.println(warn);
}
@@ -415,7 +415,7 @@ public class PngReader {
* @param chunkLoadBehaviour
* {@link ChunkLoadBehaviour}
*/
- public void setChunkLoadBehaviour(ChunkLoadBehaviour chunkLoadBehaviour) {
+ public void setChunkLoadBehaviour(final ChunkLoadBehaviour chunkLoadBehaviour) {
this.chunkLoadBehaviour = chunkLoadBehaviour;
}
@@ -459,7 +459,7 @@ public class PngReader {
*
* @see #readRowInt(int) {@link #readRowByte(int)}
*/
- public ImageLine readRow(int nrow) {
+ public ImageLine readRow(final int nrow) {
if (imgLine == null)
imgLine = new ImageLine(imgInfo, SampleType.INT, unpackedMode);
return imgLine.sampleType != SampleType.BYTE ? readRowInt(nrow) : readRowByte(nrow);
@@ -476,7 +476,7 @@ public class PngReader {
* @return ImageLine object, also available as field. Data is in
* {@link ImageLine#scanline} (int) field.
*/
- public ImageLine readRowInt(int nrow) {
+ public ImageLine readRowInt(final int nrow) {
if (imgLine == null)
imgLine = new ImageLine(imgInfo, SampleType.INT, unpackedMode);
if (imgLine.getRown() == nrow) // already read
@@ -499,7 +499,7 @@ public class PngReader {
* @return ImageLine object, also available as field. Data is in
* {@link ImageLine#scanlineb} (byte) field.
*/
- public ImageLine readRowByte(int nrow) {
+ public ImageLine readRowByte(final int nrow) {
if (imgLine == null)
imgLine = new ImageLine(imgInfo, SampleType.BYTE, unpackedMode);
if (imgLine.getRown() == nrow) // already read
@@ -513,7 +513,7 @@ public class PngReader {
/**
* @see #readRowInt(int[], int)
*/
- public final int[] readRow(int[] buffer, final int nrow) {
+ public final int[] readRow(final int[] buffer, final int nrow) {
return readRowInt(buffer, nrow);
}
@@ -596,11 +596,11 @@ public class PngReader {
* @deprecated Now {@link #readRow(int)} implements the same funcion. This
* method will be removed in future releases
*/
- public ImageLine getRow(int nrow) {
+ public ImageLine getRow(final int nrow) {
return readRow(nrow);
}
- private void decodeLastReadRowToInt(int[] buffer, int bytesRead) {
+ private void decodeLastReadRowToInt(final int[] buffer, final int bytesRead) {
if (imgInfo.bitDepth <= 8)
for (int i = 0, j = 1; i < bytesRead; i++)
buffer[i] = (rowb[j++] & 0xFF); // http://www.libpng.org/pub/png/spec/1.2/PNG-DataRep.html
@@ -611,7 +611,7 @@ public class PngReader {
ImageLine.unpackInplaceInt(imgInfo, buffer, buffer, false);
}
- private void decodeLastReadRowToByte(byte[] buffer, int bytesRead) {
+ private void decodeLastReadRowToByte(final byte[] buffer, final int bytesRead) {
if (imgInfo.bitDepth <= 8)
System.arraycopy(rowb, 1, buffer, 0, bytesRead);
else
@@ -644,27 +644,27 @@ public class PngReader {
* even/odd lines, etc
* @return Set of lines as a ImageLines, which wraps a matrix
*/
- public ImageLines readRowsInt(int rowOffset, int nRows, int rowStep) {
+ public ImageLines readRowsInt(final int rowOffset, int nRows, final int rowStep) {
if (nRows < 0)
nRows = (imgInfo.rows - rowOffset) / rowStep;
if (rowStep < 1 || rowOffset < 0 || nRows * rowStep + rowOffset > imgInfo.rows)
throw new PngjInputException("bad args");
- ImageLines imlines = new ImageLines(imgInfo, SampleType.INT, unpackedMode, rowOffset, nRows, rowStep);
+ final ImageLines imlines = new ImageLines(imgInfo, SampleType.INT, unpackedMode, rowOffset, nRows, rowStep);
if (!interlaced) {
for (int j = 0; j < imgInfo.rows; j++) {
- int bytesread = readRowRaw(j); // read and perhaps discards
- int mrow = imlines.imageRowToMatrixRowStrict(j);
+ final int bytesread = readRowRaw(j); // read and perhaps discards
+ final int mrow = imlines.imageRowToMatrixRowStrict(j);
if (mrow >= 0)
decodeLastReadRowToInt(imlines.scanlines[mrow], bytesread);
}
} else { // and now, for something completely different (interlaced)
- int[] buf = new int[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked];
+ final int[] buf = new int[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked];
for (int p = 1; p <= 7; p++) {
deinterlacer.setPass(p);
for (int i = 0; i < deinterlacer.getRows(); i++) {
- int bytesread = readRowRaw(i);
- int j = deinterlacer.getCurrRowReal();
- int mrow = imlines.imageRowToMatrixRowStrict(j);
+ final int bytesread = readRowRaw(i);
+ final int j = deinterlacer.getCurrRowReal();
+ final int mrow = imlines.imageRowToMatrixRowStrict(j);
if (mrow >= 0) {
decodeLastReadRowToInt(buf, bytesread);
deinterlacer.deinterlaceInt(buf, imlines.scanlines[mrow], !unpackedMode);
@@ -709,27 +709,27 @@ public class PngReader {
* even/odd lines, etc
* @return Set of lines as a matrix
*/
- public ImageLines readRowsByte(int rowOffset, int nRows, int rowStep) {
+ public ImageLines readRowsByte(final int rowOffset, int nRows, final int rowStep) {
if (nRows < 0)
nRows = (imgInfo.rows - rowOffset) / rowStep;
if (rowStep < 1 || rowOffset < 0 || nRows * rowStep + rowOffset > imgInfo.rows)
throw new PngjInputException("bad args");
- ImageLines imlines = new ImageLines(imgInfo, SampleType.BYTE, unpackedMode, rowOffset, nRows, rowStep);
+ final ImageLines imlines = new ImageLines(imgInfo, SampleType.BYTE, unpackedMode, rowOffset, nRows, rowStep);
if (!interlaced) {
for (int j = 0; j < imgInfo.rows; j++) {
- int bytesread = readRowRaw(j); // read and perhaps discards
- int mrow = imlines.imageRowToMatrixRowStrict(j);
+ final int bytesread = readRowRaw(j); // read and perhaps discards
+ final int mrow = imlines.imageRowToMatrixRowStrict(j);
if (mrow >= 0)
decodeLastReadRowToByte(imlines.scanlinesb[mrow], bytesread);
}
} else { // and now, for something completely different (interlaced)
- byte[] buf = new byte[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked];
+ final byte[] buf = new byte[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked];
for (int p = 1; p <= 7; p++) {
deinterlacer.setPass(p);
for (int i = 0; i < deinterlacer.getRows(); i++) {
- int bytesread = readRowRaw(i);
- int j = deinterlacer.getCurrRowReal();
- int mrow = imlines.imageRowToMatrixRowStrict(j);
+ final int bytesread = readRowRaw(i);
+ final int j = deinterlacer.getCurrRowReal();
+ final int mrow = imlines.imageRowToMatrixRowStrict(j);
if (mrow >= 0) {
decodeLastReadRowToByte(buf, bytesread);
deinterlacer.deinterlaceByte(buf, imlines.scanlinesb[mrow], !unpackedMode);
@@ -784,7 +784,7 @@ public class PngReader {
}
rowNum = nrow;
// swap buffers
- byte[] tmp = rowb;
+ final byte[] tmp = rowb;
rowb = rowbprev;
rowbprev = tmp;
// loads in rowbfilter "raw" bytes, with filter
@@ -821,7 +821,7 @@ public class PngReader {
do {
r = iIdatCstream.read(rowbfilter, 0, buffersLen);
} while (r >= 0);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjInputException("error in raw read of IDAT", e);
}
offset = iIdatCstream.getOffset();
@@ -838,7 +838,7 @@ public class PngReader {
* These are the bytes read (not loaded) in the input stream. If exceeded,
* an exception will be thrown.
*/
- public void setMaxTotalBytesRead(long maxTotalBytesToRead) {
+ public void setMaxTotalBytesRead(final long maxTotalBytesToRead) {
this.maxTotalBytesRead = maxTotalBytesToRead;
}
@@ -854,7 +854,7 @@ public class PngReader {
* default: 5Mb).<br>
* If exceeded, some chunks will be skipped
*/
- public void setMaxBytesMetadata(int maxBytesChunksToLoad) {
+ public void setMaxBytesMetadata(final int maxBytesChunksToLoad) {
this.maxBytesMetadata = maxBytesChunksToLoad;
}
@@ -872,7 +872,7 @@ public class PngReader {
* checked) and the chunk will be saved as a PngChunkSkipped object. See
* also setSkipChunkIds
*/
- public void setSkipChunkMaxSize(int skipChunksBySize) {
+ public void setSkipChunkMaxSize(final int skipChunksBySize) {
this.skipChunkMaxSize = skipChunksBySize;
}
@@ -888,7 +888,7 @@ public class PngReader {
* These chunks will be skipped (the CRC will not be checked) and the chunk
* will be saved as a PngChunkSkipped object. See also setSkipChunkMaxSize
*/
- public void setSkipChunkIds(String[] skipChunksById) {
+ public void setSkipChunkIds(final String[] skipChunksById) {
this.skipChunkIds = skipChunksById == null ? new String[] {} : skipChunksById;
}
@@ -904,7 +904,7 @@ public class PngReader {
* <p>
* default=true
*/
- public void setShouldCloseStream(boolean shouldCloseStream) {
+ public void setShouldCloseStream(final boolean shouldCloseStream) {
this.shouldCloseStream = shouldCloseStream;
}
@@ -936,7 +936,7 @@ public class PngReader {
*
* @param unPackedMode
*/
- public void setUnpackedMode(boolean unPackedMode) {
+ public void setUnpackedMode(final boolean unPackedMode) {
this.unpackedMode = unPackedMode;
}
@@ -954,7 +954,7 @@ public class PngReader {
*
* @param other A PngReader that has already finished reading pixels. Can be null.
*/
- public void reuseBuffersFrom(PngReader other) {
+ public void reuseBuffersFrom(final PngReader other) {
if(other==null) return;
if (other.currentChunkGroup < ChunksList.CHUNK_GROUP_5_AFTERIDAT)
throw new PngjInputException("PngReader to be reused have not yet ended reading pixels");
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
index 2f475aab1..ed5dd7d69 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
@@ -64,7 +64,7 @@ public class PngWriter {
*/
private int deflaterStrategy = Deflater.FILTERED;
- private int[] histox = new int[256]; // auxiliar buffer, only used by reportResultsForFilter
+ private final int[] histox = new int[256]; // auxiliar buffer, only used by reportResultsForFilter
private int idatMaxSize = 0; // 0=use default (PngIDatChunkOutputStream 32768)
@@ -78,7 +78,7 @@ public class PngWriter {
// this only influences the 1-2-4 bitdepth format - and if we pass a ImageLine to writeRow, this is ignored
private boolean unpackedMode = false;
- public PngWriter(OutputStream outputStream, ImageInfo imgInfo) {
+ public PngWriter(final OutputStream outputStream, final ImageInfo imgInfo) {
this(outputStream, imgInfo, "[NO FILENAME AVAILABLE]");
}
@@ -96,7 +96,7 @@ public class PngWriter {
* @param filenameOrDescription
* Optional, just for error/debug messages
*/
- public PngWriter(OutputStream outputStream, ImageInfo imgInfo, String filenameOrDescription) {
+ public PngWriter(final OutputStream outputStream, final ImageInfo imgInfo, final String filenameOrDescription) {
this.filename = filenameOrDescription == null ? "" : filenameOrDescription;
this.os = outputStream;
this.imgInfo = imgInfo;
@@ -111,29 +111,29 @@ public class PngWriter {
private void init() {
datStream = new PngIDatChunkOutputStream(this.os, idatMaxSize);
- Deflater def = new Deflater(compLevel);
+ final Deflater def = new Deflater(compLevel);
def.setStrategy(deflaterStrategy);
datStreamDeflated = new DeflaterOutputStream(datStream, def);
writeSignatureAndIHDR();
writeFirstChunks();
}
- private void reportResultsForFilter(int rown, FilterType type, boolean tentative) {
+ private void reportResultsForFilter(final int rown, final FilterType type, final boolean tentative) {
Arrays.fill(histox, 0);
int s = 0, v;
for (int i = 1; i <= imgInfo.bytesPerRow; i++) {
v = rowbfilter[i];
if (v < 0)
- s -= (int) v;
+ s -= v;
else
- s += (int) v;
+ s += v;
histox[v & 0xFF]++;
}
filterStrat.fillResultsForFilter(rown, type, s, histox, tentative);
}
private void writeEndChunk() {
- PngChunkIEND c = new PngChunkIEND(imgInfo);
+ final PngChunkIEND c = new PngChunkIEND(imgInfo);
c.createRawChunk().writeChunk(os);
}
@@ -156,7 +156,7 @@ public class PngWriter {
currentChunkGroup = ChunksList.CHUNK_GROUP_5_AFTERIDAT;
chunksList.writeChunks(os, currentChunkGroup);
// should not be unwriten chunks
- List<PngChunk> pending = chunksList.getQueuedChunks();
+ final List<PngChunk> pending = chunksList.getQueuedChunks();
if (!pending.isEmpty())
throw new PngjOutputException(pending.size() + " chunks were not written! Eg: " + pending.get(0).toString());
currentChunkGroup = ChunksList.CHUNK_GROUP_6_END;
@@ -169,7 +169,7 @@ public class PngWriter {
currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR;
PngHelperInternal.writeBytes(os, PngHelperInternal.getPngIdSignature()); // signature
- PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo);
+ final PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo);
// http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
ihdr.setCols(imgInfo.cols);
ihdr.setRows(imgInfo.rows);
@@ -189,16 +189,16 @@ public class PngWriter {
}
- protected void encodeRowFromByte(byte[] row) {
+ protected void encodeRowFromByte(final byte[] row) {
if (row.length == imgInfo.samplesPerRowPacked) {
// some duplication of code - because this case is typical and it works faster this way
int j = 1;
if (imgInfo.bitDepth <= 8) {
- for (byte x : row) { // optimized
+ for (final byte x : row) { // optimized
rowb[j++] = x;
}
} else { // 16 bitspc
- for (byte x : row) { // optimized
+ for (final byte x : row) { // optimized
rowb[j] = x;
j += 2;
}
@@ -221,17 +221,17 @@ public class PngWriter {
}
}
- protected void encodeRowFromInt(int[] row) {
+ protected void encodeRowFromInt(final int[] row) {
// http://www.libpng.org/pub/png/spec/1.2/PNG-DataRep.html
if (row.length == imgInfo.samplesPerRowPacked) {
// some duplication of code - because this case is typical and it works faster this way
int j = 1;
if (imgInfo.bitDepth <= 8) {
- for (int x : row) { // optimized
+ for (final int x : row) { // optimized
rowb[j++] = (byte) x;
}
} else { // 16 bitspc
- for (int x : row) { // optimized
+ for (final int x : row) { // optimized
rowb[j++] = (byte) (x >> 8);
rowb[j++] = (byte) (x);
}
@@ -253,7 +253,7 @@ public class PngWriter {
}
}
- private void filterRow(int rown) {
+ private void filterRow(final int rown) {
// warning: filters operation rely on: "previos row" (rowbprev) is
// initialized to 0 the first time
if (filterStrat.shouldTestAll(rown)) {
@@ -268,7 +268,7 @@ public class PngWriter {
filterRowPaeth();
reportResultsForFilter(rown, FilterType.FILTER_PAETH, true);
}
- FilterType filterType = filterStrat.gimmeFilterType(rown, true);
+ final FilterType filterType = filterStrat.gimmeFilterType(rown, true);
rowbfilter[0] = (byte) filterType.val;
switch (filterType) {
case FILTER_NONE:
@@ -292,23 +292,23 @@ public class PngWriter {
reportResultsForFilter(rown, filterType, false);
}
- private void prepareEncodeRow(int rown) {
+ private void prepareEncodeRow(final int rown) {
if (datStream == null)
init();
rowNum++;
if (rown >= 0 && rowNum != rown)
throw new PngjOutputException("rows must be written in order: expected:" + rowNum + " passed:" + rown);
// swap
- byte[] tmp = rowb;
+ final byte[] tmp = rowb;
rowb = rowbprev;
rowbprev = tmp;
}
- private void filterAndSend(int rown) {
+ private void filterAndSend(final int rown) {
filterRow(rown);
try {
datStreamDeflated.write(rowbfilter, 0, imgInfo.bytesPerRow + 1);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjOutputException(e);
}
}
@@ -323,7 +323,7 @@ public class PngWriter {
protected void filterRowNone() {
for (int i = 1; i <= imgInfo.bytesPerRow; i++) {
- rowbfilter[i] = (byte) rowb[i];
+ rowbfilter[i] = rowb[i];
}
}
@@ -341,7 +341,7 @@ public class PngWriter {
protected void filterRowSub() {
int i, j;
for (i = 1; i <= imgInfo.bytesPixel; i++)
- rowbfilter[i] = (byte) rowb[i];
+ rowbfilter[i] = rowb[i];
for (j = 1, i = imgInfo.bytesPixel + 1; i <= imgInfo.bytesPerRow; i++, j++) {
// !!! rowbfilter[i] = (byte) (rowb[i] - rowb[j]);
rowbfilter[i] = (byte) PngHelperInternal.filterRowSub(rowb[i], rowb[j]);
@@ -359,9 +359,9 @@ public class PngWriter {
int s = 0;
for (int i = 1; i <= imgInfo.bytesPerRow; i++)
if (rowbfilter[i] < 0)
- s -= (int) rowbfilter[i];
+ s -= rowbfilter[i];
else
- s += (int) rowbfilter[i];
+ s += rowbfilter[i];
return s;
}
@@ -372,12 +372,12 @@ public class PngWriter {
* <p>
* TODO: this should be more customizable
*/
- private void copyChunks(PngReader reader, int copy_mask, boolean onlyAfterIdat) {
- boolean idatDone = currentChunkGroup >= ChunksList.CHUNK_GROUP_4_IDAT;
+ private void copyChunks(final PngReader reader, final int copy_mask, final boolean onlyAfterIdat) {
+ final boolean idatDone = currentChunkGroup >= ChunksList.CHUNK_GROUP_4_IDAT;
if (onlyAfterIdat && reader.getCurrentChunkGroup() < ChunksList.CHUNK_GROUP_6_END)
throw new PngjExceptionInternal("tried to copy last chunks but reader has not ended");
- for (PngChunk chunk : reader.getChunksList().getChunks()) {
- int group = chunk.getChunkGroup();
+ for (final PngChunk chunk : reader.getChunksList().getChunks()) {
+ final int group = chunk.getChunkGroup();
if (group < ChunksList.CHUNK_GROUP_4_IDAT && idatDone)
continue;
boolean copy = false;
@@ -389,8 +389,8 @@ public class PngWriter {
copy = true;
}
} else { // ancillary
- boolean text = (chunk instanceof PngChunkTextVar);
- boolean safe = chunk.safe;
+ final boolean text = (chunk instanceof PngChunkTextVar);
+ final boolean safe = chunk.safe;
// notice that these if are not exclusive
if (ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALL))
copy = true;
@@ -429,7 +429,7 @@ public class PngWriter {
* : Mask bit (OR), see <code>ChunksToWrite.COPY_XXX</code>
* constants
*/
- public void copyChunksFirst(PngReader reader, int copy_mask) {
+ public void copyChunksFirst(final PngReader reader, final int copy_mask) {
copyChunks(reader, copy_mask, false);
}
@@ -446,7 +446,7 @@ public class PngWriter {
* : Mask bit (OR), see <code>ChunksToWrite.COPY_XXX</code>
* constants
*/
- public void copyChunksLast(PngReader reader, int copy_mask) {
+ public void copyChunksLast(final PngReader reader, final int copy_mask) {
copyChunks(reader, copy_mask, true);
}
@@ -461,8 +461,8 @@ public class PngWriter {
public double computeCompressionRatio() {
if (currentChunkGroup < ChunksList.CHUNK_GROUP_6_END)
throw new PngjOutputException("must be called after end()");
- double compressed = (double) datStream.getCountFlushed();
- double raw = (imgInfo.bytesPerRow + 1) * imgInfo.rows;
+ final double compressed = datStream.getCountFlushed();
+ final double raw = (imgInfo.bytesPerRow + 1) * imgInfo.rows;
return compressed / raw;
}
@@ -480,7 +480,7 @@ public class PngWriter {
writeEndChunk();
if (shouldCloseStream)
os.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjOutputException(e);
}
}
@@ -516,7 +516,7 @@ public class PngWriter {
* @param compLevel
* between 0 and 9 (default:6 , recommended: 6 or more)
*/
- public void setCompLevel(int compLevel) {
+ public void setCompLevel(final int compLevel) {
if (compLevel < 0 || compLevel > 9)
throw new PngjOutputException("Compression level invalid (" + compLevel + ") Must be 0..9");
this.compLevel = compLevel;
@@ -534,7 +534,7 @@ public class PngWriter {
* <code>PngFilterType</code>) Recommended values: DEFAULT
* (default) or AGGRESIVE
*/
- public void setFilterType(FilterType filterType) {
+ public void setFilterType(final FilterType filterType) {
filterStrat = new FilterWriteStrategy(imgInfo, filterType);
}
@@ -546,7 +546,7 @@ public class PngWriter {
* @param idatMaxSize
* default=0 : use defaultSize (32K)
*/
- public void setIdatMaxSize(int idatMaxSize) {
+ public void setIdatMaxSize(final int idatMaxSize) {
this.idatMaxSize = idatMaxSize;
}
@@ -555,7 +555,7 @@ public class PngWriter {
* <p>
* default=true
*/
- public void setShouldCloseStream(boolean shouldCloseStream) {
+ public void setShouldCloseStream(final boolean shouldCloseStream) {
this.shouldCloseStream = shouldCloseStream;
}
@@ -565,7 +565,7 @@ public class PngWriter {
* <p>
* Default: Deflater.FILTERED . This should be changed very rarely.
*/
- public void setDeflaterStrategy(int deflaterStrategy) {
+ public void setDeflaterStrategy(final int deflaterStrategy) {
this.deflaterStrategy = deflaterStrategy;
}
@@ -575,7 +575,7 @@ public class PngWriter {
*
* @deprecated Better use writeRow(ImageLine imgline, int rownumber)
*/
- public void writeRow(ImageLine imgline) {
+ public void writeRow(final ImageLine imgline) {
writeRow(imgline.scanline, imgline.getRown());
}
@@ -586,7 +586,7 @@ public class PngWriter {
*
* @see #writeRowInt(int[], int)
*/
- public void writeRow(ImageLine imgline, int rownumber) {
+ public void writeRow(final ImageLine imgline, final int rownumber) {
unpackedMode = imgline.samplesUnpacked;
if (imgline.sampleType == SampleType.INT)
writeRowInt(imgline.scanline, rownumber);
@@ -599,7 +599,7 @@ public class PngWriter {
*
* @param newrow
*/
- public void writeRow(int[] newrow) {
+ public void writeRow(final int[] newrow) {
writeRow(newrow, -1);
}
@@ -608,7 +608,7 @@ public class PngWriter {
*
* @see #writeRowInt(int[], int)
*/
- public void writeRow(int[] newrow, int rown) {
+ public void writeRow(final int[] newrow, final int rown) {
writeRowInt(newrow, rown);
}
@@ -632,7 +632,7 @@ public class PngWriter {
* Row number, from 0 (top) to rows-1 (bottom). This is just used
* as a check. Pass -1 if you want to autocompute it
*/
- public void writeRowInt(int[] newrow, int rown) {
+ public void writeRowInt(final int[] newrow, final int rown) {
prepareEncodeRow(rown);
encodeRowFromInt(newrow);
filterAndSend(rown);
@@ -645,7 +645,7 @@ public class PngWriter {
*
* @see PngWriter#writeRowInt(int[], int)
*/
- public void writeRowByte(byte[] newrow, int rown) {
+ public void writeRowByte(final byte[] newrow, final int rown) {
prepareEncodeRow(rown);
encodeRowFromByte(newrow);
filterAndSend(rown);
@@ -654,7 +654,7 @@ public class PngWriter {
/**
* Writes all the pixels, calling writeRowInt() for each image row
*/
- public void writeRowsInt(int[][] image) {
+ public void writeRowsInt(final int[][] image) {
for (int i = 0; i < imgInfo.rows; i++)
writeRowInt(image[i], i);
}
@@ -662,7 +662,7 @@ public class PngWriter {
/**
* Writes all the pixels, calling writeRowByte() for each image row
*/
- public void writeRowsByte(byte[][] image) {
+ public void writeRowsByte(final byte[][] image) {
for (int i = 0; i < imgInfo.rows; i++)
writeRowByte(image[i], i);
}
@@ -682,7 +682,7 @@ public class PngWriter {
* <tt>packed</tt> flag of the ImageLine object overrides (and overwrites!)
* this field.
*/
- public void setUseUnPackedMode(boolean useUnpackedMode) {
+ public void setUseUnPackedMode(final boolean useUnpackedMode) {
this.unpackedMode = useUnpackedMode;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java
index 3b74f862f..032b2ed3a 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java
@@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj;
public class PngjBadCrcException extends PngjInputException {
private static final long serialVersionUID = 1L;
- public PngjBadCrcException(String message, Throwable cause) {
+ public PngjBadCrcException(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjBadCrcException(String message) {
+ public PngjBadCrcException(final String message) {
super(message);
}
- public PngjBadCrcException(Throwable cause) {
+ public PngjBadCrcException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
index 97e24fc73..3d05589b1 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
@@ -9,15 +9,15 @@ package jogamp.opengl.util.pngj;
public class PngjException extends RuntimeException {
private static final long serialVersionUID = 1L;
- public PngjException(String message, Throwable cause) {
+ public PngjException(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjException(String message) {
+ public PngjException(final String message) {
super(message);
}
- public PngjException(Throwable cause) {
+ public PngjException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
index 5da70de7b..9484abf5e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
@@ -10,15 +10,15 @@ package jogamp.opengl.util.pngj;
public class PngjExceptionInternal extends RuntimeException {
private static final long serialVersionUID = 1L;
- public PngjExceptionInternal(String message, Throwable cause) {
+ public PngjExceptionInternal(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjExceptionInternal(String message) {
+ public PngjExceptionInternal(final String message) {
super(message);
}
- public PngjExceptionInternal(Throwable cause) {
+ public PngjExceptionInternal(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java
index 5cc36b99a..c92d80b2c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java
@@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj;
public class PngjInputException extends PngjException {
private static final long serialVersionUID = 1L;
- public PngjInputException(String message, Throwable cause) {
+ public PngjInputException(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjInputException(String message) {
+ public PngjInputException(final String message) {
super(message);
}
- public PngjInputException(Throwable cause) {
+ public PngjInputException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java
index c8cd36acb..4e9cdc950 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java
@@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj;
public class PngjOutputException extends PngjException {
private static final long serialVersionUID = 1L;
- public PngjOutputException(String message, Throwable cause) {
+ public PngjOutputException(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjOutputException(String message) {
+ public PngjOutputException(final String message) {
super(message);
}
- public PngjOutputException(Throwable cause) {
+ public PngjOutputException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java
index f68458d19..e68b153ac 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java
@@ -11,15 +11,15 @@ public class PngjUnsupportedException extends RuntimeException {
super();
}
- public PngjUnsupportedException(String message, Throwable cause) {
+ public PngjUnsupportedException(final String message, final Throwable cause) {
super(message, cause);
}
- public PngjUnsupportedException(String message) {
+ public PngjUnsupportedException(final String message) {
super(message);
}
- public PngjUnsupportedException(Throwable cause) {
+ public PngjUnsupportedException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java
index 4516a0886..248472298 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java
@@ -11,7 +11,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream {
private final int size;
private long countFlushed = 0;
- public ProgressiveOutputStream(int size) {
+ public ProgressiveOutputStream(final int size) {
this.size = size;
}
@@ -28,19 +28,19 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream {
}
@Override
- public final void write(byte[] b, int off, int len) {
+ public final void write(final byte[] b, final int off, final int len) {
super.write(b, off, len);
checkFlushBuffer(false);
}
@Override
- public final void write(byte[] b) throws IOException {
+ public final void write(final byte[] b) throws IOException {
super.write(b);
checkFlushBuffer(false);
}
@Override
- public final void write(int arg0) {
+ public final void write(final int arg0) {
super.write(arg0);
checkFlushBuffer(false);
}
@@ -54,7 +54,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream {
* if it's time to flush data (or if forced==true) calls abstract method
* flushBuffer() and cleans those bytes from own buffer
*/
- private final void checkFlushBuffer(boolean forced) {
+ private final void checkFlushBuffer(final boolean forced) {
while (forced || count >= size) {
int nb = size;
if (nb > count)
@@ -63,7 +63,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream {
return;
flushBuffer(buf, nb);
countFlushed += nb;
- int bytesleft = count - nb;
+ final int bytesleft = count - nb;
count = bytesleft;
if (bytesleft > 0)
System.arraycopy(buf, nb, buf, 0, bytesleft);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
index 4e8bf5635..b8cfd8691 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
@@ -68,63 +68,63 @@ public class ChunkHelper {
/**
* Converts to bytes using Latin1 (ISO-8859-1)
*/
- public static byte[] toBytes(String x) {
+ public static byte[] toBytes(final String x) {
return x.getBytes(PngHelperInternal.charsetLatin1);
}
/**
* Converts to String using Latin1 (ISO-8859-1)
*/
- public static String toString(byte[] x) {
+ public static String toString(final byte[] x) {
return new String(x, PngHelperInternal.charsetLatin1);
}
/**
* Converts to String using Latin1 (ISO-8859-1)
*/
- public static String toString(byte[] x, int offset, int len) {
+ public static String toString(final byte[] x, final int offset, final int len) {
return new String(x, offset, len, PngHelperInternal.charsetLatin1);
}
/**
* Converts to bytes using UTF-8
*/
- public static byte[] toBytesUTF8(String x) {
+ public static byte[] toBytesUTF8(final String x) {
return x.getBytes(PngHelperInternal.charsetUTF8);
}
/**
* Converts to string using UTF-8
*/
- public static String toStringUTF8(byte[] x) {
+ public static String toStringUTF8(final byte[] x) {
return new String(x, PngHelperInternal.charsetUTF8);
}
/**
* Converts to string using UTF-8
*/
- public static String toStringUTF8(byte[] x, int offset, int len) {
+ public static String toStringUTF8(final byte[] x, final int offset, final int len) {
return new String(x, offset, len, PngHelperInternal.charsetUTF8);
}
/**
* critical chunk : first letter is uppercase
*/
- public static boolean isCritical(String id) {
+ public static boolean isCritical(final String id) {
return (Character.isUpperCase(id.charAt(0)));
}
/**
* public chunk: second letter is uppercase
*/
- public static boolean isPublic(String id) { //
+ public static boolean isPublic(final String id) { //
return (Character.isUpperCase(id.charAt(1)));
}
/**
* Safe to copy chunk: fourth letter is lower case
*/
- public static boolean isSafeToCopy(String id) {
+ public static boolean isSafeToCopy(final String id) {
return (!Character.isUpperCase(id.charAt(3)));
}
@@ -132,7 +132,7 @@ public class ChunkHelper {
* "Unknown" just means that our chunk factory (even when it has been
* augmented by client code) did not recognize its id
*/
- public static boolean isUnknown(PngChunk c) {
+ public static boolean isUnknown(final PngChunk c) {
return c instanceof PngChunkUNKNOWN;
}
@@ -142,7 +142,7 @@ public class ChunkHelper {
* @param b
* @return -1 if not found
*/
- public static int posNullByte(byte[] b) {
+ public static int posNullByte(final byte[] b) {
for (int i = 0; i < b.length; i++)
if (b[i] == 0)
return i;
@@ -156,10 +156,10 @@ public class ChunkHelper {
* @param behav
* @return true/false
*/
- public static boolean shouldLoad(String id, ChunkLoadBehaviour behav) {
+ public static boolean shouldLoad(final String id, final ChunkLoadBehaviour behav) {
if (isCritical(id))
return true;
- boolean kwown = PngChunk.isKnown(id);
+ final boolean kwown = PngChunk.isKnown(id);
switch (behav) {
case LOAD_CHUNK_ALWAYS:
return true;
@@ -173,21 +173,21 @@ public class ChunkHelper {
return false; // should not reach here
}
- public final static byte[] compressBytes(byte[] ori, boolean compress) {
+ public final static byte[] compressBytes(final byte[] ori, final boolean compress) {
return compressBytes(ori, 0, ori.length, compress);
}
- public static byte[] compressBytes(byte[] ori, int offset, int len, boolean compress) {
+ public static byte[] compressBytes(final byte[] ori, final int offset, final int len, final boolean compress) {
try {
- ByteArrayInputStream inb = new ByteArrayInputStream(ori, offset, len);
- InputStream in = compress ? inb : new InflaterInputStream(inb, getInflater());
- ByteArrayOutputStream outb = new ByteArrayOutputStream();
- OutputStream out = compress ? new DeflaterOutputStream(outb) : outb;
+ final ByteArrayInputStream inb = new ByteArrayInputStream(ori, offset, len);
+ final InputStream in = compress ? inb : new InflaterInputStream(inb, getInflater());
+ final ByteArrayOutputStream outb = new ByteArrayOutputStream();
+ final OutputStream out = compress ? new DeflaterOutputStream(outb) : outb;
shovelInToOut(in, out);
in.close();
out.close();
return outb.toByteArray();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new PngjException(e);
}
}
@@ -195,7 +195,7 @@ public class ChunkHelper {
/**
* Shovels all data from an input stream to an output stream.
*/
- private static void shovelInToOut(InputStream in, OutputStream out) throws IOException {
+ private static void shovelInToOut(final InputStream in, final OutputStream out) throws IOException {
synchronized (tmpbuffer) {
int len;
while ((len = in.read(tmpbuffer)) > 0) {
@@ -204,7 +204,7 @@ public class ChunkHelper {
}
}
- public static boolean maskMatch(int v, int mask) {
+ public static boolean maskMatch(final int v, final int mask) {
return (v & mask) != 0;
}
@@ -213,9 +213,9 @@ public class ChunkHelper {
*
* See also trimList()
*/
- public static List<PngChunk> filterList(List<PngChunk> target, ChunkPredicate predicateKeep) {
- List<PngChunk> result = new ArrayList<PngChunk>();
- for (PngChunk element : target) {
+ public static List<PngChunk> filterList(final List<PngChunk> target, final ChunkPredicate predicateKeep) {
+ final List<PngChunk> result = new ArrayList<PngChunk>();
+ for (final PngChunk element : target) {
if (predicateKeep.match(element)) {
result.add(element);
}
@@ -228,11 +228,11 @@ public class ChunkHelper {
*
* See also filterList
*/
- public static int trimList(List<PngChunk> target, ChunkPredicate predicateRemove) {
- Iterator<PngChunk> it = target.iterator();
+ public static int trimList(final List<PngChunk> target, final ChunkPredicate predicateRemove) {
+ final Iterator<PngChunk> it = target.iterator();
int cont = 0;
while (it.hasNext()) {
- PngChunk c = it.next();
+ final PngChunk c = it.next();
if (predicateRemove.match(c)) {
it.remove();
cont++;
@@ -252,7 +252,7 @@ public class ChunkHelper {
*
* @return true if "equivalent"
*/
- public static final boolean equivalent(PngChunk c1, PngChunk c2) {
+ public static final boolean equivalent(final PngChunk c1, final PngChunk c2) {
if (c1 == c2)
return true;
if (c1 == null || c2 == null || !c1.id.equals(c2.id))
@@ -272,7 +272,7 @@ public class ChunkHelper {
return false;
}
- public static boolean isText(PngChunk c) {
+ public static boolean isText(final PngChunk c) {
return c instanceof PngChunkTextVar;
}
@@ -281,7 +281,7 @@ public class ChunkHelper {
* individual chunks compression
*/
public static Inflater getInflater() {
- Inflater inflater = inflaterProvider.get();
+ final Inflater inflater = inflaterProvider.get();
inflater.reset();
return inflater;
}
@@ -291,7 +291,7 @@ public class ChunkHelper {
* individual chunks decompression
*/
public static Deflater getDeflater() {
- Deflater deflater = deflaterProvider.get();
+ final Deflater deflater = deflaterProvider.get();
deflater.reset();
return deflater;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
index dcb1958df..0ac2dc6a0 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
@@ -50,7 +50,7 @@ public class ChunkRaw {
* @param alloc
* : it true, the data array will be allocced
*/
- public ChunkRaw(int len, byte[] idbytes, boolean alloc) {
+ public ChunkRaw(final int len, final byte[] idbytes, final boolean alloc) {
this.len = len;
System.arraycopy(idbytes, 0, this.idbytes, 0, 4);
if (alloc)
@@ -66,7 +66,7 @@ public class ChunkRaw {
* this is called after setting data, before writing to os
*/
private int computeCrc() {
- CRC32 crcengine = PngHelperInternal.getCRC();
+ final CRC32 crcengine = PngHelperInternal.getCRC();
crcengine.reset();
crcengine.update(idbytes, 0, 4);
if (len > 0)
@@ -78,7 +78,7 @@ public class ChunkRaw {
* Computes the CRC and writes to the stream. If error, a
* PngjOutputException is thrown
*/
- public void writeChunk(OutputStream os) {
+ public void writeChunk(final OutputStream os) {
if (idbytes.length != 4)
throw new PngjOutputException("bad chunkid [" + ChunkHelper.toString(idbytes) + "]");
crcval = computeCrc();
@@ -93,11 +93,11 @@ public class ChunkRaw {
* position before: just after chunk id. positon after: after crc Data
* should be already allocated. Checks CRC Return number of byte read.
*/
- public int readChunkData(InputStream is, boolean checkCrc) {
+ public int readChunkData(final InputStream is, final boolean checkCrc) {
PngHelperInternal.readBytes(is, data, 0, len);
crcval = PngHelperInternal.readInt4(is);
if (checkCrc) {
- int crc = computeCrc();
+ final int crc = computeCrc();
if (crc != crcval)
throw new PngjBadCrcException("chunk: " + this + " crc calc=" + crc + " read=" + crcval);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
index 75107d761..f5a920e73 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
@@ -31,7 +31,7 @@ public class ChunksList {
final ImageInfo imageInfo; // only required for writing
- public ChunksList(ImageInfo imfinfo) {
+ public ChunksList(final ImageInfo imfinfo) {
this.imageInfo = imfinfo;
}
@@ -41,8 +41,8 @@ public class ChunksList {
* @return key:chunk id, val: number of occurrences
*/
public HashMap<String, Integer> getChunksKeys() {
- HashMap<String, Integer> ck = new HashMap<String, Integer>();
- for (PngChunk c : chunks) {
+ final HashMap<String, Integer> ck = new HashMap<String, Integer>();
+ for (final PngChunk c : chunks) {
ck.put(c.id, ck.containsKey(c.id) ? ck.get(c.id) + 1 : 1);
}
return ck;
@@ -60,14 +60,14 @@ public class ChunksList {
if (innerid == null)
return ChunkHelper.filterList(list, new ChunkPredicate() {
@Override
- public boolean match(PngChunk c) {
+ public boolean match(final PngChunk c) {
return c.id.equals(id);
}
});
else
return ChunkHelper.filterList(list, new ChunkPredicate() {
@Override
- public boolean match(PngChunk c) {
+ public boolean match(final PngChunk c) {
if (!c.id.equals(id))
return false;
if (c instanceof PngChunkTextVar && !((PngChunkTextVar) c).getKey().equals(innerid))
@@ -82,7 +82,7 @@ public class ChunksList {
/**
* Adds chunk in next position. This is used onyl by the pngReader
*/
- public void appendReadChunk(PngChunk chunk, int chunkGroup) {
+ public void appendReadChunk(final PngChunk chunk, final int chunkGroup) {
chunk.setChunkGroup(chunkGroup);
chunks.add(chunk);
}
@@ -138,7 +138,7 @@ public class ChunksList {
* one is returned (failifMultiple=false)
**/
public PngChunk getById1(final String id, final String innerid, final boolean failIfMultiple) {
- List<? extends PngChunk> list = getById(id, innerid);
+ final List<? extends PngChunk> list = getById(id, innerid);
if (list.isEmpty())
return null;
if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple()))
@@ -155,7 +155,7 @@ public class ChunksList {
public List<PngChunk> getEquivalent(final PngChunk c2) {
return ChunkHelper.filterList(chunks, new ChunkPredicate() {
@Override
- public boolean match(PngChunk c) {
+ public boolean match(final PngChunk c) {
return ChunkHelper.equivalent(c, c2);
}
});
@@ -170,9 +170,9 @@ public class ChunksList {
* for debugging
*/
public String toStringFull() {
- StringBuilder sb = new StringBuilder(toString());
+ final StringBuilder sb = new StringBuilder(toString());
sb.append("\n Read:\n");
- for (PngChunk chunk : chunks) {
+ for (final PngChunk chunk : chunks) {
sb.append(chunk).append(" G=" + chunk.getChunkGroup() + "\n");
}
return sb.toString();
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
index c502e9071..6ad61f8e2 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
@@ -19,9 +19,9 @@ public class ChunksListForWrite extends ChunksList {
private final List<PngChunk> queuedChunks = new ArrayList<PngChunk>();
// redundant, just for eficciency
- private HashMap<String, Integer> alreadyWrittenKeys = new HashMap<String, Integer>();
+ private final HashMap<String, Integer> alreadyWrittenKeys = new HashMap<String, Integer>();
- public ChunksListForWrite(ImageInfo imfinfo) {
+ public ChunksListForWrite(final ImageInfo imfinfo) {
super(imfinfo);
}
@@ -43,7 +43,7 @@ public class ChunksListForWrite extends ChunksList {
* Same as getById1(), but looking in the queued chunks
**/
public PngChunk getQueuedById1(final String id, final String innerid, final boolean failIfMultiple) {
- List<? extends PngChunk> list = getQueuedById(id, innerid);
+ final List<? extends PngChunk> list = getQueuedById(id, innerid);
if (list.isEmpty())
return null;
if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple()))
@@ -72,7 +72,7 @@ public class ChunksListForWrite extends ChunksList {
* straightforward for SingleChunks. For MultipleChunks, it will normally
* check for reference equality!
*/
- public boolean removeChunk(PngChunk c) {
+ public boolean removeChunk(final PngChunk c) {
return queuedChunks.remove(c);
}
@@ -83,7 +83,7 @@ public class ChunksListForWrite extends ChunksList {
*
* @param c
*/
- public boolean queue(PngChunk c) {
+ public boolean queue(final PngChunk c) {
queuedChunks.add(c);
return true;
}
@@ -92,7 +92,7 @@ public class ChunksListForWrite extends ChunksList {
* this should be called only for ancillary chunks and PLTE (groups 1 - 3 -
* 5)
**/
- private static boolean shouldWrite(PngChunk c, int currentGroup) {
+ private static boolean shouldWrite(final PngChunk c, final int currentGroup) {
if (currentGroup == CHUNK_GROUP_2_PLTE)
return c.id.equals(ChunkHelper.PLTE);
if (currentGroup % 2 == 0)
@@ -121,11 +121,11 @@ public class ChunksListForWrite extends ChunksList {
return false;
}
- public int writeChunks(OutputStream os, int currentGroup) {
+ public int writeChunks(final OutputStream os, final int currentGroup) {
int cont = 0;
- Iterator<PngChunk> it = queuedChunks.iterator();
+ final Iterator<PngChunk> it = queuedChunks.iterator();
while (it.hasNext()) {
- PngChunk c = it.next();
+ final PngChunk c = it.next();
if (!shouldWrite(c, currentGroup))
continue;
if (ChunkHelper.isCritical(c.id) && !c.id.equals(ChunkHelper.PLTE))
@@ -159,14 +159,14 @@ public class ChunksListForWrite extends ChunksList {
*/
@Override
public String toStringFull() {
- StringBuilder sb = new StringBuilder(toString());
+ final StringBuilder sb = new StringBuilder(toString());
sb.append("\n Written:\n");
- for (PngChunk chunk : chunks) {
+ for (final PngChunk chunk : chunks) {
sb.append(chunk).append(" G=" + chunk.getChunkGroup() + "\n");
}
if (!queuedChunks.isEmpty()) {
sb.append(" Queued:\n");
- for (PngChunk chunk : queuedChunks) {
+ for (final PngChunk chunk : queuedChunks) {
sb.append(chunk).append("\n");
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
index 6cd86eb98..eba218fe3 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
@@ -122,7 +122,7 @@ public abstract class PngChunk {
* (not implmemented in this library) to the factory, so that the PngReader
* knows about it.
*/
- public static void factoryRegister(String chunkId, Class<? extends PngChunk> chunkClass) {
+ public static void factoryRegister(final String chunkId, final Class<? extends PngChunk> chunkClass) {
factoryMap.put(chunkId, chunkClass);
}
@@ -137,11 +137,11 @@ public abstract class PngChunk {
* <p>
* Unknown chunks will be parsed as instances of {@link PngChunkUNKNOWN}
*/
- public static boolean isKnown(String id) {
+ public static boolean isKnown(final String id) {
return factoryMap.containsKey(id);
}
- protected PngChunk(String id, ImageInfo imgInfo) {
+ protected PngChunk(final String id, final ImageInfo imgInfo) {
this.id = id;
this.imgInfo = imgInfo;
this.crit = ChunkHelper.isCritical(id);
@@ -153,8 +153,8 @@ public abstract class PngChunk {
* This factory creates the corresponding chunk and parses the raw chunk.
* This is used when reading.
*/
- public static PngChunk factory(ChunkRaw chunk, ImageInfo info) {
- PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info);
+ public static PngChunk factory(final ChunkRaw chunk, final ImageInfo info) {
+ final PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info);
c.length = chunk.len;
c.parseFromRaw(chunk);
return c;
@@ -164,15 +164,15 @@ public abstract class PngChunk {
* Creates one new blank chunk of the corresponding type, according to
* factoryMap (PngChunkUNKNOWN if not known)
*/
- public static PngChunk factoryFromId(String cid, ImageInfo info) {
+ public static PngChunk factoryFromId(final String cid, final ImageInfo info) {
PngChunk chunk = null;
try {
- Class<? extends PngChunk> cla = factoryMap.get(cid);
+ final Class<? extends PngChunk> cla = factoryMap.get(cid);
if (cla != null) {
- Constructor<? extends PngChunk> constr = cla.getConstructor(ImageInfo.class);
+ final Constructor<? extends PngChunk> constr = cla.getConstructor(ImageInfo.class);
chunk = constr.newInstance(info);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// this can happen for unkown chunks
}
if (chunk == null)
@@ -180,8 +180,8 @@ public abstract class PngChunk {
return chunk;
}
- protected final ChunkRaw createEmptyChunk(int len, boolean alloc) {
- ChunkRaw c = new ChunkRaw(len, ChunkHelper.toBytes(id), alloc);
+ protected final ChunkRaw createEmptyChunk(final int len, final boolean alloc) {
+ final ChunkRaw c = new ChunkRaw(len, ChunkHelper.toBytes(id), alloc);
return c;
}
@@ -189,8 +189,8 @@ public abstract class PngChunk {
* Makes a clone (deep copy) calling {@link #cloneDataFromRead(PngChunk)}
*/
@SuppressWarnings("unchecked")
- public static <T extends PngChunk> T cloneChunk(T chunk, ImageInfo info) {
- PngChunk cn = factoryFromId(chunk.id, info);
+ public static <T extends PngChunk> T cloneChunk(final T chunk, final ImageInfo info) {
+ final PngChunk cn = factoryFromId(chunk.id, info);
if (cn.getClass() != chunk.getClass())
throw new PngjExceptionInternal("bad class cloning chunk: " + cn.getClass() + " " + chunk.getClass());
cn.cloneDataFromRead(chunk);
@@ -210,7 +210,7 @@ public abstract class PngChunk {
/**
* @see #getChunkGroup()
*/
- final public void setChunkGroup(int chunkGroup) {
+ final public void setChunkGroup(final int chunkGroup) {
this.chunkGroup = chunkGroup;
}
@@ -218,12 +218,12 @@ public abstract class PngChunk {
return priority;
}
- public void setPriority(boolean priority) {
+ public void setPriority(final boolean priority) {
this.priority = priority;
}
- final void write(OutputStream os) {
- ChunkRaw c = createRawChunk();
+ final void write(final OutputStream os) {
+ final ChunkRaw c = createRawChunk();
if (c == null)
throw new PngjExceptionInternal("null chunk ! creation failed for " + this);
c.writeChunk(os);
@@ -241,7 +241,7 @@ public abstract class PngChunk {
return offset;
}
- public void setOffset(long offset) {
+ public void setOffset(final long offset) {
this.offset = offset;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
index ea6235432..191278dbc 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
@@ -18,7 +18,7 @@ public class PngChunkBKGD extends PngChunkSingle {
private int red, green, blue;
private int paletteIndex;
- public PngChunkBKGD(ImageInfo info) {
+ public PngChunkBKGD(final ImageInfo info) {
super(ChunkHelper.bKGD, info);
}
@@ -46,11 +46,11 @@ public class PngChunkBKGD extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (imgInfo.greyscale) {
gray = PngHelperInternal.readInt2fromBytes(c.data, 0);
} else if (imgInfo.indexed) {
- paletteIndex = (int) (c.data[0] & 0xff);
+ paletteIndex = c.data[0] & 0xff;
} else {
red = PngHelperInternal.readInt2fromBytes(c.data, 0);
green = PngHelperInternal.readInt2fromBytes(c.data, 2);
@@ -59,8 +59,8 @@ public class PngChunkBKGD extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkBKGD otherx = (PngChunkBKGD) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkBKGD otherx = (PngChunkBKGD) other;
gray = otherx.gray;
red = otherx.red;
green = otherx.red;
@@ -73,7 +73,7 @@ public class PngChunkBKGD extends PngChunkSingle {
*
* @param gray
*/
- public void setGray(int gray) {
+ public void setGray(final int gray) {
if (!imgInfo.greyscale)
throw new PngjException("only gray images support this");
this.gray = gray;
@@ -89,7 +89,7 @@ public class PngChunkBKGD extends PngChunkSingle {
* Set pallette index
*
*/
- public void setPaletteIndex(int i) {
+ public void setPaletteIndex(final int i) {
if (!imgInfo.indexed)
throw new PngjException("only indexed (pallete) images support this");
this.paletteIndex = i;
@@ -105,7 +105,7 @@ public class PngChunkBKGD extends PngChunkSingle {
* Set rgb values
*
*/
- public void setRGB(int r, int g, int b) {
+ public void setRGB(final int r, final int g, final int b) {
if (imgInfo.greyscale || imgInfo.indexed)
throw new PngjException("only rgb or rgba images support this");
red = r;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java
index 25a4bf2d6..8bdd7b4c0 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java
@@ -18,7 +18,7 @@ public class PngChunkCHRM extends PngChunkSingle {
private double greenx, greeny;
private double bluex, bluey;
- public PngChunkCHRM(ImageInfo info) {
+ public PngChunkCHRM(final ImageInfo info) {
super(ID, info);
}
@@ -43,7 +43,7 @@ public class PngChunkCHRM extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (c.len != 32)
throw new PngjException("bad chunk " + c);
whitex = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 0));
@@ -57,8 +57,8 @@ public class PngChunkCHRM extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkCHRM otherx = (PngChunkCHRM) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkCHRM otherx = (PngChunkCHRM) other;
whitex = otherx.whitex;
whitey = otherx.whitex;
redx = otherx.redx;
@@ -69,8 +69,8 @@ public class PngChunkCHRM extends PngChunkSingle {
bluey = otherx.bluey;
}
- public void setChromaticities(double whitex, double whitey, double redx, double redy, double greenx, double greeny,
- double bluex, double bluey) {
+ public void setChromaticities(final double whitex, final double whitey, final double redx, final double redy, final double greenx, final double greeny,
+ final double bluex, final double bluey) {
this.whitex = whitex;
this.redx = redx;
this.greenx = greenx;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java
index 74640746e..6b627326c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java
@@ -15,7 +15,7 @@ public class PngChunkGAMA extends PngChunkSingle {
// http://www.w3.org/TR/PNG/#11gAMA
private double gamma;
- public PngChunkGAMA(ImageInfo info) {
+ public PngChunkGAMA(final ImageInfo info) {
super(ID, info);
}
@@ -26,22 +26,22 @@ public class PngChunkGAMA extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(4, true);
- int g = (int) (gamma * 100000 + 0.5);
+ final ChunkRaw c = createEmptyChunk(4, true);
+ final int g = (int) (gamma * 100000 + 0.5);
PngHelperInternal.writeInt4tobytes(g, c.data, 0);
return c;
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
if (chunk.len != 4)
throw new PngjException("bad chunk " + chunk);
- int g = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
- gamma = ((double) g) / 100000.0;
+ final int g = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
+ gamma = (g) / 100000.0;
}
@Override
- public void cloneDataFromRead(PngChunk other) {
+ public void cloneDataFromRead(final PngChunk other) {
gamma = ((PngChunkGAMA) other).gamma;
}
@@ -49,7 +49,7 @@ public class PngChunkGAMA extends PngChunkSingle {
return gamma;
}
- public void setGamma(double gamma) {
+ public void setGamma(final double gamma) {
this.gamma = gamma;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java
index 6dc3fd9ec..4a4832d3b 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java
@@ -15,7 +15,7 @@ public class PngChunkHIST extends PngChunkSingle {
private int[] hist = new int[0]; // should have same lenght as palette
- public PngChunkHIST(ImageInfo info) {
+ public PngChunkHIST(final ImageInfo info) {
super(ID, info);
}
@@ -25,10 +25,10 @@ public class PngChunkHIST extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (!imgInfo.indexed)
throw new PngjException("only indexed images accept a HIST chunk");
- int nentries = c.data.length / 2;
+ final int nentries = c.data.length / 2;
hist = new int[nentries];
for (int i = 0; i < hist.length; i++) {
hist[i] = PngHelperInternal.readInt2fromBytes(c.data, i * 2);
@@ -48,8 +48,8 @@ public class PngChunkHIST extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkHIST otherx = (PngChunkHIST) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkHIST otherx = (PngChunkHIST) other;
hist = new int[otherx.hist.length];
System.arraycopy(otherx.hist, 0, hist, 0, otherx.hist.length);
}
@@ -58,7 +58,7 @@ public class PngChunkHIST extends PngChunkSingle {
return hist;
}
- public void setHist(int[] hist) {
+ public void setHist(final int[] hist) {
this.hist = hist;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java
index 399577d72..17f69861c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java
@@ -16,7 +16,7 @@ public class PngChunkICCP extends PngChunkSingle {
private String profileName;
private byte[] compressedProfile; // copmression/decopmresion is done in getter/setter
- public PngChunkICCP(ImageInfo info) {
+ public PngChunkICCP(final ImageInfo info) {
super(ID, info);
}
@@ -27,7 +27,7 @@ public class PngChunkICCP extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(profileName.length() + compressedProfile.length + 2, true);
+ final ChunkRaw c = createEmptyChunk(profileName.length() + compressedProfile.length + 2, true);
System.arraycopy(ChunkHelper.toBytes(profileName), 0, c.data, 0, profileName.length());
c.data[profileName.length()] = 0;
c.data[profileName.length() + 1] = 0;
@@ -36,20 +36,20 @@ public class PngChunkICCP extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
- int pos0 = ChunkHelper.posNullByte(chunk.data);
+ public void parseFromRaw(final ChunkRaw chunk) {
+ final int pos0 = ChunkHelper.posNullByte(chunk.data);
profileName = new String(chunk.data, 0, pos0, PngHelperInternal.charsetLatin1);
- int comp = (chunk.data[pos0 + 1] & 0xff);
+ final int comp = (chunk.data[pos0 + 1] & 0xff);
if (comp != 0)
throw new PngjException("bad compression for ChunkTypeICCP");
- int compdatasize = chunk.data.length - (pos0 + 2);
+ final int compdatasize = chunk.data.length - (pos0 + 2);
compressedProfile = new byte[compdatasize];
System.arraycopy(chunk.data, pos0 + 2, compressedProfile, 0, compdatasize);
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkICCP otherx = (PngChunkICCP) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkICCP otherx = (PngChunkICCP) other;
profileName = otherx.profileName;
compressedProfile = new byte[otherx.compressedProfile.length];
System.arraycopy(otherx.compressedProfile, 0, compressedProfile, 0, otherx.compressedProfile.length); // deep
@@ -59,12 +59,12 @@ public class PngChunkICCP extends PngChunkSingle {
/**
* The profile should be uncompressed bytes
*/
- public void setProfileNameAndContent(String name, byte[] profile) {
+ public void setProfileNameAndContent(final String name, final byte[] profile) {
profileName = name;
compressedProfile = ChunkHelper.compressBytes(profile, true);
}
- public void setProfileNameAndContent(String name, String profile) {
+ public void setProfileNameAndContent(final String name, final String profile) {
setProfileNameAndContent(name, profile.getBytes(PngHelperInternal.charsetLatin1));
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
index 911513c0d..f7bee4b11 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
@@ -14,7 +14,7 @@ public class PngChunkIDAT extends PngChunkMultiple {
public final static String ID = ChunkHelper.IDAT;
// http://www.w3.org/TR/PNG/#11IDAT
- public PngChunkIDAT(ImageInfo i, int len, long offset) {
+ public PngChunkIDAT(final ImageInfo i, final int len, final long offset) {
super(ID, i);
this.length = len;
this.offset = offset;
@@ -31,10 +31,10 @@ public class PngChunkIDAT extends PngChunkMultiple {
}
@Override
- public void parseFromRaw(ChunkRaw c) { // does nothing
+ public void parseFromRaw(final ChunkRaw c) { // does nothing
}
@Override
- public void cloneDataFromRead(PngChunk other) {
+ public void cloneDataFromRead(final PngChunk other) {
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java
index fbec564d8..3f6e47b09 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java
@@ -12,7 +12,7 @@ public class PngChunkIEND extends PngChunkSingle {
// http://www.w3.org/TR/PNG/#11IEND
// this is a dummy placeholder
- public PngChunkIEND(ImageInfo info) {
+ public PngChunkIEND(final ImageInfo info) {
super(ID, info);
}
@@ -23,16 +23,16 @@ public class PngChunkIEND extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = new ChunkRaw(0, ChunkHelper.b_IEND, false);
+ final ChunkRaw c = new ChunkRaw(0, ChunkHelper.b_IEND, false);
return c;
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
// this is not used
}
@Override
- public void cloneDataFromRead(PngChunk other) {
+ public void cloneDataFromRead(final PngChunk other) {
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java
index 94bfedd38..71e0ec90e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java
@@ -27,7 +27,7 @@ public class PngChunkIHDR extends PngChunkSingle {
// http://www.w3.org/TR/PNG/#11IHDR
//
- public PngChunkIHDR(ImageInfo info) {
+ public PngChunkIHDR(final ImageInfo info) {
super(ID, info);
}
@@ -38,7 +38,7 @@ public class PngChunkIHDR extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = new ChunkRaw(13, ChunkHelper.b_IHDR, true);
+ final ChunkRaw c = new ChunkRaw(13, ChunkHelper.b_IHDR, true);
int offset = 0;
PngHelperInternal.writeInt4tobytes(cols, c.data, offset);
offset += 4;
@@ -53,10 +53,10 @@ public class PngChunkIHDR extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (c.len != 13)
throw new PngjException("Bad IDHR len " + c.len);
- ByteArrayInputStream st = c.getAsByteStream();
+ final ByteArrayInputStream st = c.getAsByteStream();
cols = PngHelperInternal.readInt4(st);
rows = PngHelperInternal.readInt4(st);
// bit depth: number of bits per channel
@@ -68,8 +68,8 @@ public class PngChunkIHDR extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkIHDR otherx = (PngChunkIHDR) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkIHDR otherx = (PngChunkIHDR) other;
cols = otherx.cols;
rows = otherx.rows;
bitspc = otherx.bitspc;
@@ -83,7 +83,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return cols;
}
- public void setCols(int cols) {
+ public void setCols(final int cols) {
this.cols = cols;
}
@@ -91,7 +91,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return rows;
}
- public void setRows(int rows) {
+ public void setRows(final int rows) {
this.rows = rows;
}
@@ -99,7 +99,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return bitspc;
}
- public void setBitspc(int bitspc) {
+ public void setBitspc(final int bitspc) {
this.bitspc = bitspc;
}
@@ -107,7 +107,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return colormodel;
}
- public void setColormodel(int colormodel) {
+ public void setColormodel(final int colormodel) {
this.colormodel = colormodel;
}
@@ -115,7 +115,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return compmeth;
}
- public void setCompmeth(int compmeth) {
+ public void setCompmeth(final int compmeth) {
this.compmeth = compmeth;
}
@@ -123,7 +123,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return filmeth;
}
- public void setFilmeth(int filmeth) {
+ public void setFilmeth(final int filmeth) {
this.filmeth = filmeth;
}
@@ -131,7 +131,7 @@ public class PngChunkIHDR extends PngChunkSingle {
return interlaced;
}
- public void setInterlaced(int interlaced) {
+ public void setInterlaced(final int interlaced) {
this.interlaced = interlaced;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java
index ab52d7c90..738f92471 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java
@@ -21,7 +21,7 @@ public class PngChunkITXT extends PngChunkTextVar {
private String translatedTag = "";
// http://www.w3.org/TR/PNG/#11iTXt
- public PngChunkITXT(ImageInfo info) {
+ public PngChunkITXT(final ImageInfo info) {
super(ID, info);
}
@@ -30,7 +30,7 @@ public class PngChunkITXT extends PngChunkTextVar {
if (key.isEmpty())
throw new PngjException("Text chunk key must be non empty");
try {
- ByteArrayOutputStream ba = new ByteArrayOutputStream();
+ final ByteArrayOutputStream ba = new ByteArrayOutputStream();
ba.write(ChunkHelper.toBytes(key));
ba.write(0); // separator
ba.write(compressed ? 1 : 0);
@@ -44,19 +44,19 @@ public class PngChunkITXT extends PngChunkTextVar {
textbytes = ChunkHelper.compressBytes(textbytes, true);
}
ba.write(textbytes);
- byte[] b = ba.toByteArray();
- ChunkRaw chunk = createEmptyChunk(b.length, false);
+ final byte[] b = ba.toByteArray();
+ final ChunkRaw chunk = createEmptyChunk(b.length, false);
chunk.data = b;
return chunk;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjException(e);
}
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
int nullsFound = 0;
- int[] nullsIdx = new int[3];
+ final int[] nullsIdx = new int[3];
for (int i = 0; i < c.data.length; i++) {
if (c.data[i] != 0)
continue;
@@ -80,7 +80,7 @@ public class PngChunkITXT extends PngChunkTextVar {
PngHelperInternal.charsetUTF8);
i = nullsIdx[2] + 1;
if (compressed) {
- byte[] bytes = ChunkHelper.compressBytes(c.data, i, c.data.length - i, false);
+ final byte[] bytes = ChunkHelper.compressBytes(c.data, i, c.data.length - i, false);
val = ChunkHelper.toStringUTF8(bytes);
} else {
val = ChunkHelper.toStringUTF8(c.data, i, c.data.length - i);
@@ -88,8 +88,8 @@ public class PngChunkITXT extends PngChunkTextVar {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkITXT otherx = (PngChunkITXT) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkITXT otherx = (PngChunkITXT) other;
key = otherx.key;
val = otherx.val;
compressed = otherx.compressed;
@@ -101,7 +101,7 @@ public class PngChunkITXT extends PngChunkTextVar {
return compressed;
}
- public void setCompressed(boolean compressed) {
+ public void setCompressed(final boolean compressed) {
this.compressed = compressed;
}
@@ -109,7 +109,7 @@ public class PngChunkITXT extends PngChunkTextVar {
return langTag;
}
- public void setLangtag(String langtag) {
+ public void setLangtag(final String langtag) {
this.langTag = langtag;
}
@@ -117,7 +117,7 @@ public class PngChunkITXT extends PngChunkTextVar {
return translatedTag;
}
- public void setTranslatedTag(String translatedTag) {
+ public void setTranslatedTag(final String translatedTag) {
this.translatedTag = translatedTag;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
index 057f6c25e..5a7bee98c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
@@ -7,7 +7,7 @@ import jogamp.opengl.util.pngj.ImageInfo;
*/
public abstract class PngChunkMultiple extends PngChunk {
- protected PngChunkMultiple(String id, ImageInfo imgInfo) {
+ protected PngChunkMultiple(final String id, final ImageInfo imgInfo) {
super(id, imgInfo);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java
index a3bab4995..2217a59b4 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java
@@ -17,7 +17,7 @@ public class PngChunkOFFS extends PngChunkSingle {
private long posY;
private int units; // 0: pixel 1:micrometer
- public PngChunkOFFS(ImageInfo info) {
+ public PngChunkOFFS(final ImageInfo info) {
super(ID, info);
}
@@ -28,7 +28,7 @@ public class PngChunkOFFS extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(9, true);
+ final ChunkRaw c = createEmptyChunk(9, true);
PngHelperInternal.writeInt4tobytes((int) posX, c.data, 0);
PngHelperInternal.writeInt4tobytes((int) posY, c.data, 4);
c.data[8] = (byte) units;
@@ -36,7 +36,7 @@ public class PngChunkOFFS extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
if (chunk.len != 9)
throw new PngjException("bad chunk length " + chunk);
posX = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
@@ -49,8 +49,8 @@ public class PngChunkOFFS extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkOFFS otherx = (PngChunkOFFS) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkOFFS otherx = (PngChunkOFFS) other;
this.posX = otherx.posX;
this.posY = otherx.posY;
this.units = otherx.units;
@@ -66,7 +66,7 @@ public class PngChunkOFFS extends PngChunkSingle {
/**
* 0: pixel, 1:micrometer
*/
- public void setUnits(int units) {
+ public void setUnits(final int units) {
this.units = units;
}
@@ -74,7 +74,7 @@ public class PngChunkOFFS extends PngChunkSingle {
return posX;
}
- public void setPosX(long posX) {
+ public void setPosX(final long posX) {
this.posX = posX;
}
@@ -82,7 +82,7 @@ public class PngChunkOFFS extends PngChunkSingle {
return posY;
}
- public void setPosY(long posY) {
+ public void setPosY(final long posY) {
this.posY = posY;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java
index b0a1bb898..fc647273e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java
@@ -16,7 +16,7 @@ public class PngChunkPHYS extends PngChunkSingle {
private long pixelsxUnitY;
private int units; // 0: unknown 1:metre
- public PngChunkPHYS(ImageInfo info) {
+ public PngChunkPHYS(final ImageInfo info) {
super(ID, info);
}
@@ -27,7 +27,7 @@ public class PngChunkPHYS extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(9, true);
+ final ChunkRaw c = createEmptyChunk(9, true);
PngHelperInternal.writeInt4tobytes((int) pixelsxUnitX, c.data, 0);
PngHelperInternal.writeInt4tobytes((int) pixelsxUnitY, c.data, 4);
c.data[8] = (byte) units;
@@ -35,7 +35,7 @@ public class PngChunkPHYS extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
if (chunk.len != 9)
throw new PngjException("bad chunk length " + chunk);
pixelsxUnitX = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
@@ -48,8 +48,8 @@ public class PngChunkPHYS extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkPHYS otherx = (PngChunkPHYS) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkPHYS otherx = (PngChunkPHYS) other;
this.pixelsxUnitX = otherx.pixelsxUnitX;
this.pixelsxUnitY = otherx.pixelsxUnitY;
this.units = otherx.units;
@@ -59,7 +59,7 @@ public class PngChunkPHYS extends PngChunkSingle {
return pixelsxUnitX;
}
- public void setPixelsxUnitX(long pixelsxUnitX) {
+ public void setPixelsxUnitX(final long pixelsxUnitX) {
this.pixelsxUnitX = pixelsxUnitX;
}
@@ -67,7 +67,7 @@ public class PngChunkPHYS extends PngChunkSingle {
return pixelsxUnitY;
}
- public void setPixelsxUnitY(long pixelsxUnitY) {
+ public void setPixelsxUnitY(final long pixelsxUnitY) {
this.pixelsxUnitY = pixelsxUnitY;
}
@@ -75,7 +75,7 @@ public class PngChunkPHYS extends PngChunkSingle {
return units;
}
- public void setUnits(int units) {
+ public void setUnits(final int units) {
this.units = units;
}
@@ -87,7 +87,7 @@ public class PngChunkPHYS extends PngChunkSingle {
public double getAsDpi() {
if (units != 1 || pixelsxUnitX != pixelsxUnitY)
return -1;
- return ((double) pixelsxUnitX) * 0.0254;
+ return (pixelsxUnitX) * 0.0254;
}
/**
@@ -96,16 +96,16 @@ public class PngChunkPHYS extends PngChunkSingle {
public double[] getAsDpi2() {
if (units != 1)
return new double[] { -1, -1 };
- return new double[] { ((double) pixelsxUnitX) * 0.0254, ((double) pixelsxUnitY) * 0.0254 };
+ return new double[] { (pixelsxUnitX) * 0.0254, (pixelsxUnitY) * 0.0254 };
}
- public void setAsDpi(double dpi) {
+ public void setAsDpi(final double dpi) {
units = 1;
pixelsxUnitX = (long) (dpi / 0.0254 + 0.5);
pixelsxUnitY = pixelsxUnitX;
}
- public void setAsDpi2(double dpix, double dpiy) {
+ public void setAsDpi2(final double dpix, final double dpiy) {
units = 1;
pixelsxUnitX = (long) (dpix / 0.0254 + 0.5);
pixelsxUnitY = (long) (dpiy / 0.0254 + 0.5);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java
index dbf5e53c0..0f135d1ed 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java
@@ -20,7 +20,7 @@ public class PngChunkPLTE extends PngChunkSingle {
*/
private int[] entries;
- public PngChunkPLTE(ImageInfo info) {
+ public PngChunkPLTE(final ImageInfo info) {
super(ID, info);
}
@@ -31,9 +31,9 @@ public class PngChunkPLTE extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- int len = 3 * nentries;
- int[] rgb = new int[3];
- ChunkRaw c = createEmptyChunk(len, true);
+ final int len = 3 * nentries;
+ final int[] rgb = new int[3];
+ final ChunkRaw c = createEmptyChunk(len, true);
for (int n = 0, i = 0; n < nentries; n++) {
getEntryRgb(n, rgb);
c.data[i++] = (byte) rgb[0];
@@ -44,21 +44,21 @@ public class PngChunkPLTE extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
setNentries(chunk.len / 3);
for (int n = 0, i = 0; n < nentries; n++) {
- setEntry(n, (int) (chunk.data[i++] & 0xff), (int) (chunk.data[i++] & 0xff), (int) (chunk.data[i++] & 0xff));
+ setEntry(n, chunk.data[i++] & 0xff, chunk.data[i++] & 0xff, chunk.data[i++] & 0xff);
}
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkPLTE otherx = (PngChunkPLTE) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkPLTE otherx = (PngChunkPLTE) other;
this.setNentries(otherx.getNentries());
System.arraycopy(otherx.entries, 0, entries, 0, nentries);
}
- public void setNentries(int n) {
+ public void setNentries(final int n) {
nentries = n;
if (nentries < 1 || nentries > 256)
throw new PngjException("invalid pallette - nentries=" + nentries);
@@ -71,20 +71,20 @@ public class PngChunkPLTE extends PngChunkSingle {
return nentries;
}
- public void setEntry(int n, int r, int g, int b) {
+ public void setEntry(final int n, final int r, final int g, final int b) {
entries[n] = ((r << 16) | (g << 8) | b);
}
- public int getEntry(int n) {
+ public int getEntry(final int n) {
return entries[n];
}
- public void getEntryRgb(int n, int[] rgb) {
+ public void getEntryRgb(final int n, final int[] rgb) {
getEntryRgb(n, rgb, 0);
}
- public void getEntryRgb(int n, int[] rgb, int offset) {
- int v = entries[n];
+ public void getEntryRgb(final int n, final int[] rgb, final int offset) {
+ final int v = entries[n];
rgb[offset + 0] = ((v & 0xff0000) >> 16);
rgb[offset + 1] = ((v & 0xff00) >> 8);
rgb[offset + 2] = (v & 0xff);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
index 3a490654a..53858da83 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
@@ -19,7 +19,7 @@ public class PngChunkSBIT extends PngChunkSingle {
private int graysb, alphasb;
private int redsb, greensb, bluesb;
- public PngChunkSBIT(ImageInfo info) {
+ public PngChunkSBIT(final ImageInfo info) {
super(ID, info);
}
@@ -36,7 +36,7 @@ public class PngChunkSBIT extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (c.len != getLen())
throw new PngjException("bad chunk length " + c);
if (imgInfo.greyscale) {
@@ -71,8 +71,8 @@ public class PngChunkSBIT extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkSBIT otherx = (PngChunkSBIT) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkSBIT otherx = (PngChunkSBIT) other;
graysb = otherx.graysb;
redsb = otherx.redsb;
greensb = otherx.greensb;
@@ -80,7 +80,7 @@ public class PngChunkSBIT extends PngChunkSingle {
alphasb = otherx.alphasb;
}
- public void setGraysb(int gray) {
+ public void setGraysb(final int gray) {
if (!imgInfo.greyscale)
throw new PngjException("only greyscale images support this");
graysb = gray;
@@ -92,7 +92,7 @@ public class PngChunkSBIT extends PngChunkSingle {
return graysb;
}
- public void setAlphasb(int a) {
+ public void setAlphasb(final int a) {
if (!imgInfo.alpha)
throw new PngjException("only images with alpha support this");
alphasb = a;
@@ -108,7 +108,7 @@ public class PngChunkSBIT extends PngChunkSingle {
* Set rgb values
*
*/
- public void setRGB(int r, int g, int b) {
+ public void setRGB(final int r, final int g, final int b) {
if (imgInfo.greyscale || imgInfo.indexed)
throw new PngjException("only rgb or rgba images support this");
redsb = r;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java
index 2ff65834d..44ff249ac 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java
@@ -21,7 +21,7 @@ public class PngChunkSPLT extends PngChunkMultiple {
private int sampledepth; // 8/16
private int[] palette; // 5 elements per entry
- public PngChunkSPLT(ImageInfo info) {
+ public PngChunkSPLT(final ImageInfo info) {
super(ID, info);
}
@@ -33,11 +33,11 @@ public class PngChunkSPLT extends PngChunkMultiple {
@Override
public ChunkRaw createRawChunk() {
try {
- ByteArrayOutputStream ba = new ByteArrayOutputStream();
+ final ByteArrayOutputStream ba = new ByteArrayOutputStream();
ba.write(palName.getBytes(PngHelperInternal.charsetLatin1));
ba.write(0); // separator
ba.write((byte) sampledepth);
- int nentries = getNentries();
+ final int nentries = getNentries();
for (int n = 0; n < nentries; n++) {
for (int i = 0; i < 4; i++) {
if (sampledepth == 8)
@@ -47,17 +47,17 @@ public class PngChunkSPLT extends PngChunkMultiple {
}
PngHelperInternal.writeInt2(ba, palette[n * 5 + 4]);
}
- byte[] b = ba.toByteArray();
- ChunkRaw chunk = createEmptyChunk(b.length, false);
+ final byte[] b = ba.toByteArray();
+ final ChunkRaw chunk = createEmptyChunk(b.length, false);
chunk.data = b;
return chunk;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjException(e);
}
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
int t = -1;
for (int i = 0; i < c.data.length; i++) { // look for first zero
if (c.data[i] == 0) {
@@ -70,7 +70,7 @@ public class PngChunkSPLT extends PngChunkMultiple {
palName = new String(c.data, 0, t, PngHelperInternal.charsetLatin1);
sampledepth = PngHelperInternal.readInt1fromByte(c.data, t + 1);
t += 2;
- int nentries = (c.data.length - t) / (sampledepth == 8 ? 6 : 10);
+ final int nentries = (c.data.length - t) / (sampledepth == 8 ? 6 : 10);
palette = new int[nentries * 5];
int r, g, b, a, f, ne;
ne = 0;
@@ -101,8 +101,8 @@ public class PngChunkSPLT extends PngChunkMultiple {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkSPLT otherx = (PngChunkSPLT) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkSPLT otherx = (PngChunkSPLT) other;
palName = otherx.palName;
sampledepth = otherx.sampledepth;
palette = new int[otherx.palette.length];
@@ -117,7 +117,7 @@ public class PngChunkSPLT extends PngChunkMultiple {
return palName;
}
- public void setPalName(String palName) {
+ public void setPalName(final String palName) {
this.palName = palName;
}
@@ -125,7 +125,7 @@ public class PngChunkSPLT extends PngChunkMultiple {
return sampledepth;
}
- public void setSampledepth(int sampledepth) {
+ public void setSampledepth(final int sampledepth) {
this.sampledepth = sampledepth;
}
@@ -133,7 +133,7 @@ public class PngChunkSPLT extends PngChunkMultiple {
return palette;
}
- public void setPalette(int[] palette) {
+ public void setPalette(final int[] palette) {
this.palette = palette;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
index e4d77d40a..19504b917 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
@@ -21,7 +21,7 @@ public class PngChunkSRGB extends PngChunkSingle {
private int intent;
- public PngChunkSRGB(ImageInfo info) {
+ public PngChunkSRGB(final ImageInfo info) {
super(ID, info);
}
@@ -31,7 +31,7 @@ public class PngChunkSRGB extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (c.len != 1)
throw new PngjException("bad chunk length " + c);
intent = PngHelperInternal.readInt1fromByte(c.data, 0);
@@ -46,8 +46,8 @@ public class PngChunkSRGB extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkSRGB otherx = (PngChunkSRGB) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkSRGB otherx = (PngChunkSRGB) other;
intent = otherx.intent;
}
@@ -55,7 +55,7 @@ public class PngChunkSRGB extends PngChunkSingle {
return intent;
}
- public void setIntent(int intent) {
+ public void setIntent(final int intent) {
this.intent = intent;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java
index 4dc5edec5..52037b396 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java
@@ -14,7 +14,7 @@ public class PngChunkSTER extends PngChunkSingle {
// http://www.libpng.org/pub/png/spec/register/pngext-1.3.0-pdg.html#C.sTER
private byte mode; // 0: cross-fuse layout 1: diverging-fuse layout
- public PngChunkSTER(ImageInfo info) {
+ public PngChunkSTER(final ImageInfo info) {
super(ID, info);
}
@@ -25,21 +25,21 @@ public class PngChunkSTER extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(1, true);
- c.data[0] = (byte) mode;
+ final ChunkRaw c = createEmptyChunk(1, true);
+ c.data[0] = mode;
return c;
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
if (chunk.len != 1)
throw new PngjException("bad chunk length " + chunk);
mode = chunk.data[0];
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkSTER otherx = (PngChunkSTER) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkSTER otherx = (PngChunkSTER) other;
this.mode = otherx.mode;
}
@@ -53,7 +53,7 @@ public class PngChunkSTER extends PngChunkSingle {
/**
* 0: cross-fuse layout 1: diverging-fuse layout
*/
- public void setMode(byte mode) {
+ public void setMode(final byte mode) {
this.mode = mode;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
index 7df5ba021..c5e9407b1 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
@@ -8,7 +8,7 @@ import jogamp.opengl.util.pngj.ImageInfo;
*/
public abstract class PngChunkSingle extends PngChunk {
- protected PngChunkSingle(String id, ImageInfo imgInfo) {
+ protected PngChunkSingle(final String id, final ImageInfo imgInfo) {
super(id, imgInfo);
}
@@ -26,14 +26,14 @@ public abstract class PngChunkSingle extends PngChunk {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- PngChunkSingle other = (PngChunkSingle) obj;
+ final PngChunkSingle other = (PngChunkSingle) obj;
if (id == null) {
if (other.id != null)
return false;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java
index f4c77b4e1..02a18816b 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java
@@ -8,7 +8,7 @@ import jogamp.opengl.util.pngj.PngjException;
*/
public class PngChunkSkipped extends PngChunk {
- public PngChunkSkipped(String id, ImageInfo info, int clen) {
+ public PngChunkSkipped(final String id, final ImageInfo info, final int clen) {
super(id, info);
this.length = clen;
}
@@ -24,12 +24,12 @@ public class PngChunkSkipped extends PngChunk {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
throw new PngjException("Non supported for a skipped chunk");
}
@Override
- public void cloneDataFromRead(PngChunk other) {
+ public void cloneDataFromRead(final PngChunk other) {
throw new PngjException("Non supported for a skipped chunk");
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java
index d97cd63c5..634d0cd12 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java
@@ -12,7 +12,7 @@ import jogamp.opengl.util.pngj.PngjException;
public class PngChunkTEXT extends PngChunkTextVar {
public final static String ID = ChunkHelper.tEXt;
- public PngChunkTEXT(ImageInfo info) {
+ public PngChunkTEXT(final ImageInfo info) {
super(ID, info);
}
@@ -20,14 +20,14 @@ public class PngChunkTEXT extends PngChunkTextVar {
public ChunkRaw createRawChunk() {
if (key.isEmpty())
throw new PngjException("Text chunk key must be non empty");
- byte[] b = (key + "\0" + val).getBytes(PngHelperInternal.charsetLatin1);
- ChunkRaw chunk = createEmptyChunk(b.length, false);
+ final byte[] b = (key + "\0" + val).getBytes(PngHelperInternal.charsetLatin1);
+ final ChunkRaw chunk = createEmptyChunk(b.length, false);
chunk.data = b;
return chunk;
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
int i;
for (i = 0; i < c.data.length; i++)
if (c.data[i] == 0)
@@ -38,8 +38,8 @@ public class PngChunkTEXT extends PngChunkTextVar {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkTEXT otherx = (PngChunkTEXT) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkTEXT otherx = (PngChunkTEXT) other;
key = otherx.key;
val = otherx.val;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java
index 8f34c78fe..850fb649f 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java
@@ -17,7 +17,7 @@ public class PngChunkTIME extends PngChunkSingle {
// http://www.w3.org/TR/PNG/#11tIME
private int year, mon, day, hour, min, sec;
- public PngChunkTIME(ImageInfo info) {
+ public PngChunkTIME(final ImageInfo info) {
super(ID, info);
}
@@ -28,7 +28,7 @@ public class PngChunkTIME extends PngChunkSingle {
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw c = createEmptyChunk(7, true);
+ final ChunkRaw c = createEmptyChunk(7, true);
PngHelperInternal.writeInt2tobytes(year, c.data, 0);
c.data[2] = (byte) mon;
c.data[3] = (byte) day;
@@ -39,7 +39,7 @@ public class PngChunkTIME extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw chunk) {
+ public void parseFromRaw(final ChunkRaw chunk) {
if (chunk.len != 7)
throw new PngjException("bad chunk " + chunk);
year = PngHelperInternal.readInt2fromBytes(chunk.data, 0);
@@ -51,8 +51,8 @@ public class PngChunkTIME extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkTIME x = (PngChunkTIME) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkTIME x = (PngChunkTIME) other;
year = x.year;
mon = x.mon;
day = x.day;
@@ -61,8 +61,8 @@ public class PngChunkTIME extends PngChunkSingle {
sec = x.sec;
}
- public void setNow(int secsAgo) {
- Calendar d = Calendar.getInstance();
+ public void setNow(final int secsAgo) {
+ final Calendar d = Calendar.getInstance();
d.setTimeInMillis(System.currentTimeMillis() - 1000 * (long) secsAgo);
year = d.get(Calendar.YEAR);
mon = d.get(Calendar.MONTH) + 1;
@@ -72,7 +72,7 @@ public class PngChunkTIME extends PngChunkSingle {
sec = d.get(Calendar.SECOND);
}
- public void setYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) {
+ public void setYMDHMS(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx) {
year = yearx;
mon = monx;
day = dayx;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
index 867e34861..5e10c041b 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
@@ -21,7 +21,7 @@ public class PngChunkTRNS extends PngChunkSingle {
private int red, green, blue;
private int[] paletteAlpha = new int[] {};
- public PngChunkTRNS(ImageInfo info) {
+ public PngChunkTRNS(final ImageInfo info) {
super(ID, info);
}
@@ -51,14 +51,14 @@ public class PngChunkTRNS extends PngChunkSingle {
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
if (imgInfo.greyscale) {
gray = PngHelperInternal.readInt2fromBytes(c.data, 0);
} else if (imgInfo.indexed) {
- int nentries = c.data.length;
+ final int nentries = c.data.length;
paletteAlpha = new int[nentries];
for (int n = 0; n < nentries; n++) {
- paletteAlpha[n] = (int) (c.data[n] & 0xff);
+ paletteAlpha[n] = c.data[n] & 0xff;
}
} else {
red = PngHelperInternal.readInt2fromBytes(c.data, 0);
@@ -68,8 +68,8 @@ public class PngChunkTRNS extends PngChunkSingle {
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkTRNS otherx = (PngChunkTRNS) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkTRNS otherx = (PngChunkTRNS) other;
gray = otherx.gray;
red = otherx.red;
green = otherx.green;
@@ -84,7 +84,7 @@ public class PngChunkTRNS extends PngChunkSingle {
* Set rgb values
*
*/
- public void setRGB(int r, int g, int b) {
+ public void setRGB(final int r, final int g, final int b) {
if (imgInfo.greyscale || imgInfo.indexed)
throw new PngjException("only rgb or rgba images support this");
red = r;
@@ -98,7 +98,7 @@ public class PngChunkTRNS extends PngChunkSingle {
return new int[] { red, green, blue };
}
- public void setGray(int g) {
+ public void setGray(final int g) {
if (!imgInfo.greyscale)
throw new PngjException("only grayscale images support this");
gray = g;
@@ -113,7 +113,7 @@ public class PngChunkTRNS extends PngChunkSingle {
/**
* WARNING: non deep copy
*/
- public void setPalletteAlpha(int[] palAlpha) {
+ public void setPalletteAlpha(final int[] palAlpha) {
if (!imgInfo.indexed)
throw new PngjException("only indexed images support this");
paletteAlpha = palAlpha;
@@ -122,7 +122,7 @@ public class PngChunkTRNS extends PngChunkSingle {
/**
* to use when only one pallete index is set as totally transparent
*/
- public void setIndexEntryAsTransparent(int palAlphaIndex) {
+ public void setIndexEntryAsTransparent(final int palAlphaIndex) {
if (!imgInfo.indexed)
throw new PngjException("only indexed images support this");
paletteAlpha = new int[] { palAlphaIndex + 1 };
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java
index ba3ffc30c..d00c29971 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java
@@ -21,7 +21,7 @@ public abstract class PngChunkTextVar extends PngChunkMultiple {
public final static String KEY_Source = "Source"; // Device used to create the image
public final static String KEY_Comment = "Comment"; // Miscellaneous comment
- protected PngChunkTextVar(String id, ImageInfo info) {
+ protected PngChunkTextVar(final String id, final ImageInfo info) {
super(id, info);
}
@@ -51,7 +51,7 @@ public abstract class PngChunkTextVar extends PngChunkMultiple {
return val;
}
- public void setKeyVal(String key, String val) {
+ public void setKeyVal(final String key, final String val) {
this.key = key;
this.val = val;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java
index 3803428e6..693729e9b 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java
@@ -11,11 +11,11 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not
private byte[] data;
- public PngChunkUNKNOWN(String id, ImageInfo info) {
+ public PngChunkUNKNOWN(final String id, final ImageInfo info) {
super(id, info);
}
- private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info) {
+ private PngChunkUNKNOWN(final PngChunkUNKNOWN c, final ImageInfo info) {
super(c.id, info);
System.arraycopy(c.data, 0, data, 0, c.data.length);
}
@@ -27,13 +27,13 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not
@Override
public ChunkRaw createRawChunk() {
- ChunkRaw p = createEmptyChunk(data.length, false);
+ final ChunkRaw p = createEmptyChunk(data.length, false);
p.data = this.data;
return p;
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
data = c.data;
}
@@ -43,14 +43,14 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not
}
/* does not copy! */
- public void setData(byte[] data) {
+ public void setData(final byte[] data) {
this.data = data;
}
@Override
- public void cloneDataFromRead(PngChunk other) {
+ public void cloneDataFromRead(final PngChunk other) {
// THIS SHOULD NOT BE CALLED IF ALREADY CLONED WITH COPY CONSTRUCTOR
- PngChunkUNKNOWN c = (PngChunkUNKNOWN) other;
+ final PngChunkUNKNOWN c = (PngChunkUNKNOWN) other;
data = c.data; // not deep copy
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java
index 64593eae4..c1dfdeb33 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java
@@ -16,7 +16,7 @@ public class PngChunkZTXT extends PngChunkTextVar {
public final static String ID = ChunkHelper.zTXt;
// http://www.w3.org/TR/PNG/#11zTXt
- public PngChunkZTXT(ImageInfo info) {
+ public PngChunkZTXT(final ImageInfo info) {
super(ID, info);
}
@@ -25,23 +25,23 @@ public class PngChunkZTXT extends PngChunkTextVar {
if (key.isEmpty())
throw new PngjException("Text chunk key must be non empty");
try {
- ByteArrayOutputStream ba = new ByteArrayOutputStream();
+ final ByteArrayOutputStream ba = new ByteArrayOutputStream();
ba.write(key.getBytes(PngHelperInternal.charsetLatin1));
ba.write(0); // separator
ba.write(0); // compression method: 0
- byte[] textbytes = ChunkHelper.compressBytes(val.getBytes(PngHelperInternal.charsetLatin1), true);
+ final byte[] textbytes = ChunkHelper.compressBytes(val.getBytes(PngHelperInternal.charsetLatin1), true);
ba.write(textbytes);
- byte[] b = ba.toByteArray();
- ChunkRaw chunk = createEmptyChunk(b.length, false);
+ final byte[] b = ba.toByteArray();
+ final ChunkRaw chunk = createEmptyChunk(b.length, false);
chunk.data = b;
return chunk;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PngjException(e);
}
}
@Override
- public void parseFromRaw(ChunkRaw c) {
+ public void parseFromRaw(final ChunkRaw c) {
int nullsep = -1;
for (int i = 0; i < c.data.length; i++) { // look for first zero
if (c.data[i] != 0)
@@ -52,16 +52,16 @@ public class PngChunkZTXT extends PngChunkTextVar {
if (nullsep < 0 || nullsep > c.data.length - 2)
throw new PngjException("bad zTXt chunk: no separator found");
key = new String(c.data, 0, nullsep, PngHelperInternal.charsetLatin1);
- int compmet = (int) c.data[nullsep + 1];
+ final int compmet = c.data[nullsep + 1];
if (compmet != 0)
throw new PngjException("bad zTXt chunk: unknown compression method");
- byte[] uncomp = ChunkHelper.compressBytes(c.data, nullsep + 2, c.data.length - nullsep - 2, false); // uncompress
+ final byte[] uncomp = ChunkHelper.compressBytes(c.data, nullsep + 2, c.data.length - nullsep - 2, false); // uncompress
val = new String(uncomp, PngHelperInternal.charsetLatin1);
}
@Override
- public void cloneDataFromRead(PngChunk other) {
- PngChunkZTXT otherx = (PngChunkZTXT) other;
+ public void cloneDataFromRead(final PngChunk other) {
+ final PngChunkZTXT otherx = (PngChunkZTXT) other;
key = otherx.key;
val = otherx.val;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
index 139603448..bba2b3e7c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
@@ -19,7 +19,7 @@ public class PngMetadata {
private final ChunksList chunkList;
private final boolean readonly;
- public PngMetadata(ChunksList chunks) {
+ public PngMetadata(final ChunksList chunks) {
this.chunkList = chunks;
if (chunks instanceof ChunksListForWrite) {
this.readonly = false;
@@ -35,14 +35,14 @@ public class PngMetadata {
* and if so, overwrites it. However if that not check for already written
* chunks.
*/
- public void queueChunk(final PngChunk c, boolean lazyOverwrite) {
- ChunksListForWrite cl = getChunkListW();
+ public void queueChunk(final PngChunk c, final boolean lazyOverwrite) {
+ final ChunksListForWrite cl = getChunkListW();
if (readonly)
throw new PngjException("cannot set chunk : readonly metadata");
if (lazyOverwrite) {
ChunkHelper.trimList(cl.getQueuedChunks(), new ChunkPredicate() {
@Override
- public boolean match(PngChunk c2) {
+ public boolean match(final PngChunk c2) {
return ChunkHelper.equivalent(c, c2);
}
});
@@ -66,19 +66,19 @@ public class PngMetadata {
* returns -1 if not found or dimension unknown
*/
public double[] getDpi() {
- PngChunk c = chunkList.getById1(ChunkHelper.pHYs, true);
+ final PngChunk c = chunkList.getById1(ChunkHelper.pHYs, true);
if (c == null)
return new double[] { -1, -1 };
else
return ((PngChunkPHYS) c).getAsDpi2();
}
- public void setDpi(double x) {
+ public void setDpi(final double x) {
setDpi(x, x);
}
- public void setDpi(double x, double y) {
- PngChunkPHYS c = new PngChunkPHYS(chunkList.imageInfo);
+ public void setDpi(final double x, final double y) {
+ final PngChunkPHYS c = new PngChunkPHYS(chunkList.imageInfo);
c.setAsDpi2(x, y);
queueChunk(c);
}
@@ -92,8 +92,8 @@ public class PngMetadata {
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
- public PngChunkTIME setTimeNow(int secsAgo) {
- PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
+ public PngChunkTIME setTimeNow(final int secsAgo) {
+ final PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
c.setNow(secsAgo);
queueChunk(c);
return c;
@@ -110,8 +110,8 @@ public class PngMetadata {
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
- public PngChunkTIME setTimeYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) {
- PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
+ public PngChunkTIME setTimeYMDHMS(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx) {
+ final PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
c.setYMDHMS(yearx, monx, dayx, hourx, minx, secx);
queueChunk(c, true);
return c;
@@ -125,7 +125,7 @@ public class PngMetadata {
}
public String getTimeAsString() {
- PngChunkTIME c = getTime();
+ final PngChunkTIME c = getTime();
return c == null ? "" : c.getAsString();
}
@@ -144,7 +144,7 @@ public class PngMetadata {
* @return Returns the created-queued chunks, just in case you want to
* examine, touch it
*/
- public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress) {
+ public PngChunkTextVar setText(final String k, final String val, final boolean useLatin1, final boolean compress) {
if (compress && !useLatin1)
throw new PngjException("cannot compress non latin text");
PngChunkTextVar c;
@@ -163,7 +163,7 @@ public class PngMetadata {
return c;
}
- public PngChunkTextVar setText(String k, String val) {
+ public PngChunkTextVar setText(final String k, final String val) {
return setText(k, val, false, false);
}
@@ -175,8 +175,9 @@ public class PngMetadata {
* Warning: this does not check the "lang" key of iTxt
*/
@SuppressWarnings("unchecked")
- public List<? extends PngChunkTextVar> getTxtsForKey(String k) {
+ public List<? extends PngChunkTextVar> getTxtsForKey(final String k) {
@SuppressWarnings("rawtypes")
+ final
List c = new ArrayList();
c.addAll(chunkList.getById(ChunkHelper.tEXt, k));
c.addAll(chunkList.getById(ChunkHelper.zTXt, k));
@@ -190,12 +191,12 @@ public class PngMetadata {
* <p>
* Use getTxtsForKey() if you don't want this behaviour
*/
- public String getTxtForKey(String k) {
- List<? extends PngChunkTextVar> li = getTxtsForKey(k);
+ public String getTxtForKey(final String k) {
+ final List<? extends PngChunkTextVar> li = getTxtsForKey(k);
if (li.isEmpty())
return "";
- StringBuilder t = new StringBuilder();
- for (PngChunkTextVar c : li)
+ final StringBuilder t = new StringBuilder();
+ for (final PngChunkTextVar c : li)
t.append(c.getVal()).append("\n");
return t.toString().trim();
}
@@ -214,7 +215,7 @@ public class PngMetadata {
* the caller, who should fill its entries
*/
public PngChunkPLTE createPLTEChunk() {
- PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo);
+ final PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo);
queueChunk(plte);
return plte;
}
@@ -233,7 +234,7 @@ public class PngMetadata {
* caller, who should fill its entries
*/
public PngChunkTRNS createTRNSChunk() {
- PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo);
+ final PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo);
queueChunk(trns);
return trns;
}