diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
239 files changed, 4337 insertions, 4335 deletions
diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java index 9332b670a..8fa450f51 100644 --- a/src/jogl/classes/jogamp/opengl/Debug.java +++ b/src/jogl/classes/jogamp/opengl/Debug.java @@ -63,7 +63,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("jogl.verbose", true); debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { - Package p = Package.getPackage("javax.media.opengl"); + final Package p = Package.getPackage("javax.media.opengl"); System.err.println("JOGL specification version " + p.getSpecificationVersion()); System.err.println("JOGL implementation version " + p.getImplementationVersion()); System.err.println("JOGL implementation vendor " + p.getImplementationVendor()); @@ -81,7 +81,7 @@ public class Debug extends PropertyAccess { return debugAll; } - public static final boolean debug(String subcomponent) { + public static final boolean debug(final String subcomponent) { return debugAll() || isPropertyDefined("jogl.debug." + subcomponent, true); } } diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java index 578f416b7..270a65882 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java @@ -49,7 +49,7 @@ public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibrary } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java index c1e1d1821..6025b45ff 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java @@ -33,7 +33,7 @@ import java.util.*; public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper { - public DesktopGLDynamicLookupHelper(DesktopGLDynamicLibraryBundleInfo info) { + public DesktopGLDynamicLookupHelper(final DesktopGLDynamicLibraryBundleInfo info) { super(info); } @@ -43,7 +43,7 @@ public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper { public final synchronized boolean loadGLULibrary() { /** hacky code .. where all platform GLU libs are tried ..*/ if(null==gluLib) { - List<String> gluLibNames = new ArrayList<String>(); + final List<String> gluLibNames = new ArrayList<String>(); gluLibNames.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"); // osx gluLibNames.add("libGLU.so"); // unix gluLibNames.add("GLU32"); // windows diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java index fd59ecfd4..1b33e1a8b 100644 --- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java @@ -44,6 +44,7 @@ import java.util.HashMap; import java.util.StringTokenizer; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; @@ -77,7 +78,7 @@ final class ExtensionAvailabilityCache { /** * Flush and rebuild the cache. */ - final void reset(GLContextImpl context) { + final void reset(final GLContextImpl context) { flush(); initAvailableExtensions(context); } @@ -91,7 +92,7 @@ final class ExtensionAvailabilityCache { return availableExtensionCache.size(); } - final boolean isExtensionAvailable(String glExtensionName) { + final boolean isExtensionAvailable(final String glExtensionName) { validateInitialization(); return null != availableExtensionCache.get(glExtensionName); } @@ -124,8 +125,8 @@ final class ExtensionAvailabilityCache { throw new InternalError("ExtensionAvailabilityCache not initialized!"); } } - private final void initAvailableExtensions(GLContextImpl context) { - GL gl = context.getGL(); + private final void initAvailableExtensions(final GLContextImpl context) { + final GL gl = context.getGL(); // if hash is empty (meaning it was flushed), pre-cache it with the list // of extensions that are in the GL_EXTENSIONS string if (isInitialized()) { @@ -155,14 +156,14 @@ final class ExtensionAvailabilityCache { } if(useGetStringi) { - GL2GL3 gl2gl3 = gl.getGL2GL3(); + final GL2GL3 gl2gl3 = gl.getGL2GL3(); final int count; { - int[] val = { 0 } ; - gl2gl3.glGetIntegerv(GL2GL3.GL_NUM_EXTENSIONS, val, 0); + final int[] val = { 0 } ; + gl2gl3.glGetIntegerv(GL2ES3.GL_NUM_EXTENSIONS, val, 0); count = val[0]; } - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i); if( null == availableExtensionCache.put(ext, ext) ) { @@ -229,8 +230,8 @@ final class ExtensionAvailabilityCache { final int ctxOptions = context.getCtxOptions(); final VersionNumber version = context.getGLVersionNumber(); - int major[] = new int[] { version.getMajor() }; - int minor[] = new int[] { version.getMinor() }; + final int major[] = new int[] { version.getMajor() }; + final int minor[] = new int[] { version.getMinor() }; do{ final String GL_XX_VERSION = ( context.isGLES() ? "GL_ES_VERSION_" : "GL_VERSION_" ) + major[0] + "_" + minor[0]; availableExtensionCache.put(GL_XX_VERSION, GL_XX_VERSION); diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java index 08a1fe882..d7ac6eb1e 100644 --- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java +++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java @@ -60,11 +60,11 @@ public class FPSCounterImpl implements FPSCounter { final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); fpsLastPeriod = now - fpsLastUpdateTime; fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0 - fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ; + fpsLast = ( fpsUpdateFramesInterval * 1000f ) / ( fpsLastPeriod ) ; fpsTotalDuration = now - fpsStartTime; fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0 - fpsTotal= ( (float)fpsTotalFrames * 1000f ) / ( (float) fpsTotalDuration ) ; + fpsTotal= ( fpsTotalFrames * 1000f ) / ( fpsTotalDuration ) ; if(null != fpsOutputStream) { fpsOutputStream.println(toString()); @@ -93,7 +93,7 @@ public class FPSCounterImpl implements FPSCounter { } @Override - public final synchronized void setUpdateFPSFrames(int frames, PrintStream out) { + public final synchronized void setUpdateFPSFrames(final int frames, final PrintStream out) { fpsUpdateFramesInterval = frames; fpsOutputStream = out; resetFPSCounter(); diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 493926f25..fce5c1fcc 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -100,7 +100,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe * the drawable is created w/ it's own new instance, e.g. offscreen drawables, * and no further lifecycle handling is applied. */ - public GLAutoDrawableBase(GLDrawableImpl drawable, GLContextImpl context, boolean ownsDevice) { + public GLAutoDrawableBase(final GLDrawableImpl drawable, final GLContextImpl context, final boolean ownsDevice) { this.drawable = drawable; this.context = context; this.preserveGLELSAtDestroy = false; @@ -114,12 +114,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.context, sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -127,14 +127,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe protected abstract RecursiveLock getLock(); @Override - public final GLStateKeeper.Listener setGLStateKeeperListener(Listener l) { + public final GLStateKeeper.Listener setGLStateKeeperListener(final Listener l) { final GLStateKeeper.Listener pre = glStateKeeperListener; glStateKeeperListener = l; return pre; } @Override - public final boolean preserveGLStateAtDestroy(boolean value) { + public final boolean preserveGLStateAtDestroy(final boolean value) { final boolean res = isGLStatePreservationSupported() ? true : false; if( res ) { if( DEBUG ) { @@ -363,7 +363,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // so we can continue with the destruction. try { helper.disposeGL(this, context, true); - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -451,7 +451,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } } - protected final GLEventListener defaultDisposeGLEventListener(GLEventListener listener, boolean remove) { + protected final GLEventListener defaultDisposeGLEventListener(final GLEventListener listener, final boolean remove) { final RecursiveLock _lock = getLock(); _lock.lock(); try { @@ -472,7 +472,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public final GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final RecursiveLock lock = getLock(); lock.lock(); try { @@ -495,7 +495,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final GL setGL(GL gl) { + public final GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); @@ -505,12 +505,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void addGLEventListener(GLEventListener listener) { + public final void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public final void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException { + public final void addGLEventListener(final int index, final GLEventListener listener) throws IndexOutOfBoundsException { helper.addGLEventListener(index, listener); } @@ -520,7 +520,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -530,27 +530,27 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { return defaultDisposeGLEventListener(listener, remove); } @Override - public final GLEventListener removeGLEventListener(GLEventListener listener) { + public final GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public final void setAnimator(GLAnimatorControl animatorControl) + public final void setAnimator(final GLAnimatorControl animatorControl) throws GLException { helper.setAnimator(animatorControl); } @@ -561,7 +561,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, context); } @@ -571,7 +571,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final boolean invoke(boolean wait, GLRunnable glRunnable) { + public final boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -581,7 +581,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setAutoSwapBufferMode(boolean enable) { + public final void setAutoSwapBufferMode(final boolean enable) { helper.setAutoSwapBufferMode(enable); } @@ -591,7 +591,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setContextCreationFlags(int flags) { + public final void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; final GLContext _context = context; if(null != _context) { @@ -609,7 +609,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // @Override - public final void setUpdateFPSFrames(int frames, PrintStream out) { + public final void setUpdateFPSFrames(final int frames, final PrintStream out) { fpsCounter.setUpdateFPSFrames(frames, out); } @@ -679,7 +679,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setRealized(boolean realized) { + public final void setRealized(final boolean realized) { final RecursiveLock _lock = getLock(); _lock.lock(); try { diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java index 483b9b526..34857586d 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java @@ -36,6 +36,7 @@ import javax.media.opengl.*; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IntObjectHashMap; +import com.jogamp.common.util.PropertyAccess; /** * Tracking of {@link GLBufferStorage} instances via GL API callbacks. @@ -102,7 +103,7 @@ public class GLBufferObjectTracker { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferObjectTracker", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLBufferObjectTracker", true); } static final class GLBufferStorageImpl extends GLBufferStorage { @@ -146,7 +147,7 @@ public class GLBufferObjectTracker { * @throws GLException if a native GL-Error occurs */ public synchronized final void createBufferStorage(final GLBufferStateTracker bufferStateTracker, final GL caller, - final int target, final long size, final Buffer data, int mutableUsage, int immutableFlags, + final int target, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { @@ -195,7 +196,7 @@ public class GLBufferObjectTracker { * @throws GLException if a native GL-Error occurs */ public synchronized final void createBufferStorage(final GL caller, - final int bufferName, final long size, final Buffer data, final int mutableUsage, int immutableFlags, + final int bufferName, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { @@ -340,7 +341,7 @@ public class GLBufferObjectTracker { */ private synchronized final GLBufferStorage mapBufferImpl(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final boolean useRange, - long offset, long length, final int access, + final long offset, final long length, final int access, final MapBufferDispatch dispatch, final long glProcAddress) throws GLException { final int bufferName = bufferStateTracker.getBoundBufferObject(target, caller); if( 0 == bufferName ) { diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 511c1b9b9..9231804be 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -43,6 +43,7 @@ package jogamp.opengl; import javax.media.opengl.*; import com.jogamp.common.util.IntIntHashMap; +import com.jogamp.common.util.PropertyAccess; /** * Tracks as closely as possible which OpenGL buffer object is bound @@ -82,7 +83,7 @@ public class GLBufferStateTracker { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferStateTracker", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLBufferStateTracker", true); } // Maps binding targets to buffer objects. A null value indicates @@ -104,8 +105,8 @@ public class GLBufferStateTracker { setBoundBufferObject(GL.GL_ARRAY_BUFFER, 0); setBoundBufferObject(GL4.GL_DRAW_INDIRECT_BUFFER, 0); setBoundBufferObject(GL.GL_ELEMENT_ARRAY_BUFFER, 0); - setBoundBufferObject(GL2.GL_PIXEL_PACK_BUFFER, 0); - setBoundBufferObject(GL2.GL_PIXEL_UNPACK_BUFFER, 0); + setBoundBufferObject(GL2ES3.GL_PIXEL_PACK_BUFFER, 0); + setBoundBufferObject(GL2ES3.GL_PIXEL_UNPACK_BUFFER, 0); } @@ -136,8 +137,8 @@ public class GLBufferStateTracker { case GL4.GL_DRAW_INDIRECT_BUFFER: return GL4.GL_DRAW_INDIRECT_BUFFER_BINDING; case GL4.GL_DISPATCH_INDIRECT_BUFFER: return GL4.GL_DISPATCH_INDIRECT_BUFFER_BINDING; case GL.GL_ELEMENT_ARRAY_BUFFER: return GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; - case GL2.GL_PIXEL_PACK_BUFFER: return GL2.GL_PIXEL_PACK_BUFFER_BINDING; - case GL2.GL_PIXEL_UNPACK_BUFFER: return GL2.GL_PIXEL_UNPACK_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_PACK_BUFFER: return GL2ES3.GL_PIXEL_PACK_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_UNPACK_BUFFER: return GL2ES3.GL_PIXEL_UNPACK_BUFFER_BINDING; // FIXME case GL4.GL_QUERY_BUFFER: return GL4.GL_QUERY_BUFFER_BINDING; case GL4.GL_SHADER_STORAGE_BUFFER: return GL4.GL_SHADER_STORAGE_BUFFER_BINDING; case GL2GL3.GL_TEXTURE_BUFFER: return GL2GL3.GL_TEXTURE_BINDING_BUFFER; @@ -159,8 +160,8 @@ public class GLBufferStateTracker { case GL4.GL_DRAW_INDIRECT_BUFFER: case GL4.GL_DISPATCH_INDIRECT_BUFFER: case GL.GL_ELEMENT_ARRAY_BUFFER: - case GL2.GL_PIXEL_PACK_BUFFER: - case GL2.GL_PIXEL_UNPACK_BUFFER: + case GL2ES3.GL_PIXEL_PACK_BUFFER: + case GL2ES3.GL_PIXEL_UNPACK_BUFFER: // FIXME case GL4.GL_QUERY_BUFFER: case GL4.GL_SHADER_STORAGE_BUFFER: case GL2GL3.GL_TEXTURE_BUFFER: @@ -185,7 +186,7 @@ public class GLBufferStateTracker { * @param target * @param bufferName */ - public final void setBoundBufferObject(int target, int bufferName) { + public final void setBoundBufferObject(final int target, final int bufferName) { checkTargetName(target); final int oldBufferName = bindingMap.put(target, bufferName); /*** @@ -215,7 +216,7 @@ public class GLBufferStateTracker { specified target (e.g. GL_ARRAY_BUFFER) is currently unknown. You must use isBoundBufferObjectKnown() to see whether the return value is valid. */ - public final int getBoundBufferObject(int target, GL caller) { + public final int getBoundBufferObject(final int target, final GL caller) { int value = bindingMap.get(target); if (bindingNotFound == value) { // User probably either called glPushClientAttrib / @@ -263,5 +264,5 @@ public class GLBufferStateTracker { } bindingMap.clear(); } - private final String toHexString(int i) { return Integer.toHexString(i); } + private final String toHexString(final int i) { return Integer.toHexString(i); } } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index b88bdcdae..5671334bd 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -134,7 +134,7 @@ public abstract class GLContextImpl extends GLContext { mappedGLXProcAddress.clear(); } - public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) { + public GLContextImpl(final GLDrawableImpl drawable, final GLContext shareWith) { super(); bufferStateTracker = new GLBufferStateTracker(); @@ -162,7 +162,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { if( !isInit ) { clearStates(); } @@ -188,7 +188,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final GLDrawable setGLReadDrawable(GLDrawable read) { + public final GLDrawable setGLReadDrawable(final GLDrawable read) { if(!isGLReadDrawableAvailable()) { throw new GLException("Setting read drawable feature not available"); } @@ -212,7 +212,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly) { + public final GLDrawable setGLDrawable(final GLDrawable readWrite, final boolean setWriteOnly) { if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) { return drawable; // no change. } @@ -278,7 +278,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public GL setGL(GL gl) { + public GL setGL(final GL gl) { if( DEBUG ) { final String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>"; final String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>"; @@ -314,7 +314,7 @@ public abstract class GLContextImpl extends GLContext { public void release() throws GLException { release(false); } - private void release(boolean inDestruction) throws GLException { + private void release(final boolean inDestruction) throws GLException { if( TRACE_SWITCH ) { System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock); } @@ -339,7 +339,7 @@ public abstract class GLContextImpl extends GLContext { if( !inDestruction ) { try { contextMadeCurrent(false); - } catch (Throwable t) { + } catch (final Throwable t) { drawableContextMadeCurrentException = t; } } @@ -409,7 +409,7 @@ public abstract class GLContextImpl extends GLContext { } try { associateDrawable(false); - } catch (Throwable t) { + } catch (final Throwable t) { associateDrawableException = t; } if ( 0 != defaultVAO ) { @@ -452,7 +452,7 @@ public abstract class GLContextImpl extends GLContext { protected abstract void destroyImpl() throws GLException; @Override - public final void copy(GLContext source, int mask) throws GLException { + public final void copy(final GLContext source, final int mask) throws GLException { if (source.getHandle() == 0) { throw new GLException("Source OpenGL context has not been created"); } @@ -568,7 +568,7 @@ public abstract class GLContextImpl extends GLContext { tracker.ref(); } */ - } catch (RuntimeException e) { + } catch (final RuntimeException e) { unlockResources = true; throw e; } finally { @@ -580,7 +580,7 @@ public abstract class GLContextImpl extends GLContext { } } } /* if ( drawable.isRealized() ) */ - } catch (RuntimeException e) { + } catch (final RuntimeException e) { unlockResources = true; throw e; } finally { @@ -632,7 +632,7 @@ public abstract class GLContextImpl extends GLContext { return res; } - private final int makeCurrentWithinLock(int surfaceLockRes) throws GLException { + private final int makeCurrentWithinLock(final int surfaceLockRes) throws GLException { if (!isCreated()) { if( 0 >= drawable.getSurfaceWidth() || 0 >= drawable.getSurfaceHeight() ) { if ( DEBUG_TRACE_SWITCH ) { @@ -728,14 +728,14 @@ public abstract class GLContextImpl extends GLContext { /** * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)} */ - protected void associateDrawable(boolean bound) { + protected void associateDrawable(final boolean bound) { drawable.associateContext(this, bound); } /** * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)} */ - protected void contextMadeCurrent(boolean current) { + protected void contextMadeCurrent(final boolean current) { drawable.contextMadeCurrent(this, current); } @@ -840,9 +840,9 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null)); } - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; long _ctx = 0; if( GLContext.getAvailableGLVersion(device, reqMajorCTP[0], reqMajorCTP[1], _major, _minor, _ctp)) { @@ -860,7 +860,7 @@ public abstract class GLContextImpl extends GLContext { return _ctx; } - private final boolean mapGLVersions(AbstractGraphicsDevice device) { + private final boolean mapGLVersions(final AbstractGraphicsDevice device) { synchronized (GLContext.deviceVersionAvailable) { final long t0 = ( DEBUG ) ? System.nanoTime() : 0; boolean success = false; @@ -985,7 +985,7 @@ public abstract class GLContextImpl extends GLContext { * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true. * This method does not reset the states, allowing the caller to utilize the state variables. **/ - private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) { + private final boolean createContextARBMapVersionsAvailable(final int reqMajor, final int reqProfile) { long _context; int ctp = CTX_IS_ARB_CREATED | reqProfile; @@ -994,8 +994,8 @@ public abstract class GLContextImpl extends GLContext { // so the user can always cast to the highest available one. int majorMax, minorMax; int majorMin, minorMin; - int major[] = new int[1]; - int minor[] = new int[1]; + final int major[] = new int[1]; + final int minor[] = new int[1]; if( 4 == reqMajor ) { majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax); majorMin=4; minorMin=0; @@ -1034,7 +1034,7 @@ public abstract class GLContextImpl extends GLContext { } final boolean res; if( 0 != _context ) { - AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by // createContextARBVersions(..) -> setGLFunctionAvailbility(..) -> setContextVersion(..) GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); @@ -1052,10 +1052,10 @@ public abstract class GLContextImpl extends GLContext { return res; } - private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags, - int majorMax, int minorMax, - int majorMin, int minorMin, - int major[], int minor[]) { + private final long createContextARBVersions(final long share, final boolean direct, final int ctxOptionFlags, + final int majorMax, final int minorMax, + final int majorMin, final int minorMin, + final int major[], final int minor[]) { major[0]=majorMax; minor[0]=minorMax; long _context=0; @@ -1097,7 +1097,7 @@ public abstract class GLContextImpl extends GLContext { * If major > 0 || minor > 0 : Use passed values, determined at creation time * Otherwise .. don't touch .. */ - private final void setContextVersion(int major, int minor, int ctp, VersionNumberString glVendorVersion, boolean useGL) { + private final void setContextVersion(final int major, final int minor, final int ctp, final VersionNumberString glVendorVersion, final boolean useGL) { if ( 0 == ctp ) { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } @@ -1126,16 +1126,16 @@ public abstract class GLContextImpl extends GLContext { // Helpers for various context implementations // - private Object createInstance(GLProfile glp, boolean glObject, Object[] cstrArgs) { + private Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) { return ReflectionUtil.createInstance(glp.getGLCtor(glObject), cstrArgs); } - private boolean verifyInstance(GLProfile glp, String suffix, Object instance) { + private boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) { return ReflectionUtil.instanceOf(instance, glp.getGLImplBaseClassName()+suffix); } /** Create the GL for this context. */ - protected GL createGL(GLProfile glp) { + protected GL createGL(final GLProfile glp) { final GL gl = (GL) createInstance(glp, true, new Object[] { glp, this } ); /* FIXME: refactor dependence on Java 2D / JOGL bridge @@ -1152,11 +1152,11 @@ public abstract class GLContextImpl extends GLContext { * Method calls 'void finalizeInit()' of instance 'gl' as retrieved by reflection, if exist. * </p> */ - private void finalizeInit(GL gl) { + private void finalizeInit(final GL gl) { Method finalizeInit = null; try { finalizeInit = ReflectionUtil.getMethod(gl.getClass(), "finalizeInit", new Class<?>[]{ }); - } catch ( Throwable t ) { + } catch ( final Throwable t ) { if(DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -1198,9 +1198,9 @@ public abstract class GLContextImpl extends GLContext { /** Maps the given "platform-independent" function name to a real function name. Currently this is only used to map "glAllocateMemoryNV" and associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ - protected final String mapToRealGLFunctionName(String glFunctionName) { - Map<String, String> map = getFunctionNameMap(); - String lookup = ( null != map ) ? map.get(glFunctionName) : null; + protected final String mapToRealGLFunctionName(final String glFunctionName) { + final Map<String, String> map = getFunctionNameMap(); + final String lookup = ( null != map ) ? map.get(glFunctionName) : null; if (lookup != null) { return lookup; } @@ -1213,9 +1213,9 @@ public abstract class GLContextImpl extends GLContext { "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a." */ - protected final String mapToRealGLExtensionName(String glExtensionName) { - Map<String, String> map = getExtensionNameMap(); - String lookup = ( null != map ) ? map.get(glExtensionName) : null; + protected final String mapToRealGLExtensionName(final String glExtensionName) { + final Map<String, String> map = getExtensionNameMap(); + final String lookup = ( null != map ) ? map.get(glExtensionName) : null; if (lookup != null) { return lookup; } @@ -1287,12 +1287,12 @@ public abstract class GLContextImpl extends GLContext { * Note: Non ARB ctx is limited to GL 3.0. * </p> */ - private static final VersionNumber getGLVersionNumber(int ctp, String glVersionStr) { + private static final VersionNumber getGLVersionNumber(final int ctp, final String glVersionStr) { if( null != glVersionStr ) { final GLVersionNumber version = GLVersionNumber.create(glVersionStr); if ( version.isValid() ) { - int[] major = new int[] { version.getMajor() }; - int[] minor = new int[] { version.getMinor() }; + final int[] major = new int[] { version.getMajor() }; + final int[] minor = new int[] { version.getMinor() }; if ( GLContext.isValidGLVersion(ctp, major[0], minor[0]) ) { return new VersionNumber(major[0], minor[0], 0); } @@ -1308,7 +1308,7 @@ public abstract class GLContextImpl extends GLContext { * If the GL query fails, major will be zero. * </p> */ - private final boolean getGLIntVersion(int[] glIntMajor, int[] glIntMinor) { + private final boolean getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) { glIntMajor[0] = 0; // clear final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); final long _glGetIntegerv = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv"); @@ -1319,8 +1319,8 @@ public abstract class GLContextImpl extends GLContext { } return false; } else { - glGetIntegervInt(GL2GL3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); - glGetIntegervInt(GL2GL3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); + glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); + glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); return true; } } @@ -1361,8 +1361,8 @@ public abstract class GLContextImpl extends GLContext { * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT * @see javax.media.opengl.GLContext#CTX_IMPL_ES2_COMPAT */ - protected final boolean setGLFunctionAvailability(boolean force, int major, int minor, int ctxProfileBits, - boolean strictMatch, boolean withinGLVersionsMapping) { + protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits, + final boolean strictMatch, final boolean withinGLVersionsMapping) { if(null!=this.gl && null!=glProcAddressTable && !force) { return true; // already done and not forced } @@ -1666,10 +1666,10 @@ public abstract class GLContextImpl extends GLContext { } private final void setRendererQuirks(final AbstractGraphicsDevice adevice, final GLDrawableFactoryImpl factory, - int reqMajor, int reqMinor, int reqCTP, - int major, int minor, int ctp, final VersionNumberString vendorVersion, - boolean withinGLVersionsMapping) { - int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) + final int reqMajor, final int reqMinor, final int reqCTP, + final int major, final int minor, final int ctp, final VersionNumberString vendorVersion, + final boolean withinGLVersionsMapping) { + final int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) int i = 0; final String MesaSP = "Mesa "; @@ -1938,7 +1938,7 @@ public abstract class GLContextImpl extends GLContext { } } - private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) { + private static final boolean hasFBOImpl(final int major, final int ctp, final ExtensionAvailabilityCache extCache) { return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0 major >= 3 || // any >= 3.0 GL ctx (core, compat and ES) @@ -1954,7 +1954,7 @@ public abstract class GLContextImpl extends GLContext { extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded } - private final void removeCachedVersion(int major, int minor, int ctxProfileBits) { + private final void removeCachedVersion(final int major, final int minor, int ctxProfileBits) { if(!isCurrentContextHardwareRasterizer()) { ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT; } @@ -2006,14 +2006,14 @@ public abstract class GLContextImpl extends GLContext { protected abstract StringBuilder getPlatformExtensionsStringImpl(); @Override - public final boolean isFunctionAvailable(String glFunctionName) { + public final boolean isFunctionAvailable(final String glFunctionName) { // Check GL 1st (cached) if(null!=glProcAddressTable) { // null if this context wasn't not created try { if( glProcAddressTable.isFunctionAvailable( glFunctionName ) ) { return true; } - } catch (Exception e) {} + } catch (final Exception e) {} } // Check platform extensions 2nd (cached) - context had to be enabled once @@ -2023,25 +2023,25 @@ public abstract class GLContextImpl extends GLContext { if( pTable.isFunctionAvailable( glFunctionName ) ) { return true; } - } catch (Exception e) {} + } catch (final Exception e) {} } // dynamic function lookup at last incl name aliasing (not cached) final DynamicLookupHelper dynLookup = getDrawableImpl().getGLDynamicLookupHelper(); final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true); boolean res = false; - int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); + final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); for(int i = 0; !res && i < variants; i++) { final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i); try { res = dynLookup.isFunctionAvailable(tmp); - } catch (Exception e) { } + } catch (final Exception e) { } } return res; } @Override - public final boolean isExtensionAvailable(String glExtensionName) { + public final boolean isExtensionAvailable(final String glExtensionName) { if(null!=extensionAvailability) { return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName)); } @@ -2081,7 +2081,7 @@ public abstract class GLContextImpl extends GLContext { return false; } - protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits) { + protected static String getContextFQN(final AbstractGraphicsDevice device, final int major, final int minor, int ctxProfileBits) { // remove non-key values ctxProfileBits &= CTX_IMPL_CACHE_MASK; @@ -2170,7 +2170,7 @@ public abstract class GLContextImpl extends GLContext { * Method exists merely for code validation of {@link #isCurrent()}. * </p> */ - public final boolean isOwner(Thread thread) { + public final boolean isOwner(final Thread thread) { return lock.isOwner(thread); } @@ -2208,7 +2208,7 @@ public abstract class GLContextImpl extends GLContext { * * <p>Does not throw an exception if <code>target</code> is unknown or <code>framebufferName</code> invalid.</p> */ - public final void setBoundFramebuffer(int target, int framebufferName) { + public final void setBoundFramebuffer(final int target, final int framebufferName) { if(0 > framebufferName) { return; // ignore invalid name } @@ -2217,22 +2217,22 @@ public abstract class GLContextImpl extends GLContext { boundFBOTarget[0] = framebufferName; // draw boundFBOTarget[1] = framebufferName; // read break; - case GL2GL3.GL_DRAW_FRAMEBUFFER: + case GL2ES3.GL_DRAW_FRAMEBUFFER: boundFBOTarget[0] = framebufferName; // draw break; - case GL2GL3.GL_READ_FRAMEBUFFER: + case GL2ES3.GL_READ_FRAMEBUFFER: boundFBOTarget[1] = framebufferName; // read break; default: // ignore untracked target } } @Override - public final int getBoundFramebuffer(int target) { + public final int getBoundFramebuffer(final int target) { switch(target) { case GL.GL_FRAMEBUFFER: - case GL2GL3.GL_DRAW_FRAMEBUFFER: + case GL2ES3.GL_DRAW_FRAMEBUFFER: return boundFBOTarget[0]; // draw - case GL2GL3.GL_READ_FRAMEBUFFER: + case GL2ES3.GL_READ_FRAMEBUFFER: return boundFBOTarget[1]; // read default: throw new InternalError("Invalid FBO target name: "+toHexString(target)); @@ -2266,7 +2266,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void setContextCreationFlags(int flags) { + public final void setContextCreationFlags(final int flags) { if(!isCreated()) { additionalCtxCreationFlags = flags & GLContext.CTX_OPTION_DEBUG; } @@ -2276,12 +2276,12 @@ public abstract class GLContextImpl extends GLContext { public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); } @Override - public final void setGLDebugSynchronous(boolean synchronous) { + public final void setGLDebugSynchronous(final boolean synchronous) { glDebugHandler.setSynchronous(synchronous); } @Override - public final void enableGLDebugMessage(boolean enable) throws GLException { + public final void enableGLDebugMessage(final boolean enable) throws GLException { if(!isCreated()) { if(enable) { additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG; @@ -2295,17 +2295,17 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void addGLDebugListener(GLDebugListener listener) { + public final void addGLDebugListener(final GLDebugListener listener) { glDebugHandler.addListener(listener); } @Override - public final void removeGLDebugListener(GLDebugListener listener) { + public final void removeGLDebugListener(final GLDebugListener listener) { glDebugHandler.removeListener(listener); } @Override - public final void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled) { + public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final IntBuffer ids, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, enabled); } else if(glDebugHandler.isExtensionAMD()) { @@ -2314,7 +2314,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled) { + public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final int[] ids, final int ids_offset, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, ids_offset, enabled); } else if(glDebugHandler.isExtensionAMD()) { @@ -2323,7 +2323,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void glDebugMessageInsert(int source, int type, int id, int severity, String buf) { + public final void glDebugMessageInsert(final int source, final int type, final int id, final int severity, final String buf) { final int len = (null != buf) ? buf.length() : 0; if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageInsert(source, type, id, severity, len, buf); diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java index c057c904c..209707f33 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java +++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java @@ -143,7 +143,7 @@ public class GLContextShareSet { if (lastContext == null) { throw new IllegalArgumentException("Last context is null"); } - ShareSet share = entryFor(lastContext); + final ShareSet share = entryFor(lastContext); if (share == null) { throw new GLException("Last context is unknown: "+lastContext); } @@ -159,8 +159,8 @@ public class GLContextShareSet { System.err.println("GLContextShareSet: unregisterSharing: " + toHexString(lastContext.getHandle())+", entries: "+s.size()); } - for(Iterator<GLContext> iter = s.iterator() ; iter.hasNext() ; ) { - GLContext ctx = iter.next(); + for(final Iterator<GLContext> iter = s.iterator() ; iter.hasNext() ; ) { + final GLContext ctx = iter.next(); if(null == removeEntry(ctx)) { throw new GLException("Removal of shareSet for context failed"); } @@ -207,7 +207,7 @@ public class GLContextShareSet { } /** Returns true if the given GLContext has shared and created GLContext left including itself, otherwise false. */ - public static synchronized boolean hasCreatedSharedLeft(GLContext context) { + public static synchronized boolean hasCreatedSharedLeft(final GLContext context) { final Set<GLContext> s = getCreatedSharesImpl(context); return null != s && s.size() > 0; } @@ -279,7 +279,7 @@ public class GLContextShareSet { return shareMap.remove(context); } - private static String toHexString(long hex) { + private static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } } diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 2c947693c..7519d568b 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -32,11 +32,14 @@ import java.security.PrivilegedAction; import java.util.ArrayList; import javax.media.nativewindow.NativeWindowException; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLDebugListener; import javax.media.opengl.GLDebugMessage; import javax.media.opengl.GLException; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.os.Platform; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.GLExtensions; @@ -84,7 +87,7 @@ public class GLDebugMessageHandler { * @param ctx the associated GLContext * @param glDebugExtension chosen extension to use */ - public GLDebugMessageHandler(GLContextImpl ctx) { + public GLDebugMessageHandler(final GLContextImpl ctx) { this.ctx = ctx; this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>(); this.glDebugMessageCallbackProcAddress = 0; @@ -95,7 +98,7 @@ public class GLDebugMessageHandler { this.synchronous = true; } - public void init(boolean enable) { + public void init(final boolean enable) { if(DEBUG) { System.err.println("GLDebugMessageHandler.init("+enable+")"); } @@ -113,7 +116,7 @@ public class GLDebugMessageHandler { public Long run() { try { return Long.valueOf( table.getAddressFor(functionName) ); - } catch (IllegalArgumentException iae) { + } catch (final IllegalArgumentException iae) { return Long.valueOf(0); } } @@ -132,7 +135,7 @@ public class GLDebugMessageHandler { } return; } - if(Platform.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) { + if(PlatformPropsImpl.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) { // Currently buggy, ie. throws an exception after leaving the native callback. // Probably a 32bit on 64bit JVM / OpenGL-driver issue. if(DEBUG) { @@ -216,7 +219,7 @@ public class GLDebugMessageHandler { /** * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean) */ - public final void setSynchronous(boolean synchronous) { + public final void setSynchronous(final boolean synchronous) { this.synchronous = synchronous; if( isEnabled() ) { setSynchronousImpl(); @@ -225,9 +228,9 @@ public class GLDebugMessageHandler { private final void setSynchronousImpl() { if(isExtensionARB()) { if(synchronous) { - ctx.getGL().glEnable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); + ctx.getGL().glEnable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { - ctx.getGL().glDisable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); + ctx.getGL().glDisable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } if(DEBUG) { System.err.println("GLDebugMessageHandler: synchronous "+synchronous); @@ -238,14 +241,14 @@ public class GLDebugMessageHandler { /** * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean) */ - public final void enable(boolean enable) throws GLException { + public final void enable(final boolean enable) throws GLException { ctx.validateCurrent(); if(!isAvailable()) { return; } enableImpl(enable); } - final void enableImpl(boolean enable) throws GLException { + final void enableImpl(final boolean enable) throws GLException { if(enable) { if(0 == handle) { setSynchronousImpl(); @@ -271,19 +274,19 @@ public class GLDebugMessageHandler { return listenerImpl.size(); } - public final void addListener(GLDebugListener listener) { + public final void addListener(final GLDebugListener listener) { listenerImpl.addListener(-1, listener); } - public final void addListener(int index, GLDebugListener listener) { + public final void addListener(final int index, final GLDebugListener listener) { listenerImpl.addListener(index, listener); } - public final void removeListener(GLDebugListener listener) { + public final void removeListener(final GLDebugListener listener) { listenerImpl.removeListener(listener); } - private final void sendMessage(GLDebugMessage msg) { + private final void sendMessage(final GLDebugMessage msg) { synchronized(listenerImpl) { if(DEBUG) { System.err.println("GLDebugMessageHandler: "+msg); @@ -298,11 +301,11 @@ public class GLDebugMessageHandler { public static class StdErrGLDebugListener implements GLDebugListener { boolean threadDump; - public StdErrGLDebugListener(boolean threadDump) { + public StdErrGLDebugListener(final boolean threadDump) { this.threadDump = threadDump; } @Override - public void messageSent(GLDebugMessage event) { + public void messageSent(final GLDebugMessage event) { System.err.println(event); if(threadDump) { Thread.dumpStack(); @@ -314,12 +317,12 @@ public class GLDebugMessageHandler { // native -> java // - protected final void glDebugMessageARB(int source, int type, int id, int severity, String msg) { + protected final void glDebugMessageARB(final int source, final int type, final int id, final int severity, final String msg) { final GLDebugMessage event = new GLDebugMessage(ctx, System.currentTimeMillis(), source, type, id, severity, msg); sendMessage(event); } - protected final void glDebugMessageAMD(int id, int category, int severity, String msg) { + protected final void glDebugMessageAMD(final int id, final int category, final int severity, final String msg) { final GLDebugMessage event = GLDebugMessage.translateAMDEvent(ctx, System.currentTimeMillis(), id, category, severity, msg); sendMessage(event); } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index a401944ef..fd8052b96 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -95,7 +95,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { if( null != device) { return getOrCreateSharedResourceImpl( device ); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); gle.printStackTrace(); @@ -112,7 +112,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. */ - public final GLContext getOrCreateSharedContext(AbstractGraphicsDevice device) { + public final GLContext getOrCreateSharedContext(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getContext(); @@ -121,7 +121,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - protected final boolean createSharedResourceImpl(AbstractGraphicsDevice device) { + protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.isValid(); @@ -130,7 +130,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device) { + public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getRendererQuirks(); @@ -145,7 +145,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. */ - protected final AbstractGraphicsDevice getOrCreateSharedDevice(AbstractGraphicsDevice device) { + protected final AbstractGraphicsDevice getOrCreateSharedDevice(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getDevice(); @@ -164,7 +164,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // Dispatching GLDrawable construction in respect to the NativeSurface Capabilities // @Override - public final GLDrawable createGLDrawable(NativeSurface target) { + public final GLDrawable createGLDrawable(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -252,16 +252,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp); @Override - public final GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, - int height, - GLContext shareWith) { + public final GLPbuffer createGLPbuffer(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, + final int height, + final GLContext shareWith) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } - AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); + final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } @@ -285,8 +285,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // @Override - public final boolean canCreateFBO(AbstractGraphicsDevice deviceReq, GLProfile glp) { - AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); + public final boolean canCreateFBO(final AbstractGraphicsDevice deviceReq, final GLProfile glp) { + final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } @@ -294,11 +294,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height, - GLContext shareWith) { + public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height, + final GLContext shareWith) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); drawable.setRealized(true); final GLContext context = drawable.createContext(shareWith); @@ -309,10 +309,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height) { + public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); drawable.setRealized(true); if(drawable instanceof GLFBODrawableImpl) { @@ -322,7 +322,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + public final GLAutoDrawable createDummyAutoDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { final GLDrawable drawable = createDummyDrawable(deviceReq, createNewDevice, capsRequested, chooser); drawable.setRealized(true); final GLAutoDrawable sharedDrawable = new GLAutoDrawableDelegate(drawable, null, null, true /*ownDevice*/, null) { }; @@ -330,10 +330,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height) { + public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } @@ -355,7 +355,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + public final GLDrawable createDummyDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { final AbstractGraphicsDevice device = createNewDevice ? getOrCreateSharedDevice(deviceReq) : deviceReq; if(null == device) { throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice); @@ -374,7 +374,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } /** Creates a platform independent unrealized FBO offscreen GLDrawable */ - protected final GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected final GLFBODrawable createFBODrawableImpl(final NativeSurface dummySurface, final GLCapabilitiesImmutable fboCaps, final int textureUnit) { final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); return new GLFBODrawableImpl(this, dummyDrawable, dummySurface, fboCaps, textureUnit); } @@ -424,8 +424,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. */ - public final ProxySurface createDummySurface(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, - int width, int height) { + public final ProxySurface createDummySurface(final AbstractGraphicsDevice deviceReq, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, + final int width, final int height) { final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); @@ -461,8 +461,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // @Override - public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, - GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + public ProxySurface createProxySurface(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, + final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); @@ -520,7 +520,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ - public static GLDrawableFactoryImpl getFactoryImpl(GLProfile glp) { + public static GLDrawableFactoryImpl getFactoryImpl(final GLProfile glp) { return (GLDrawableFactoryImpl) getFactory(glp); } @@ -579,7 +579,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @throws IllegalArgumentException if any of the parameters were * out-of-bounds */ - public boolean setDisplayGamma(float gamma, float brightness, float contrast) throws IllegalArgumentException { + public boolean setDisplayGamma(final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { if ((brightness < -1.0f) || (brightness > 1.0f)) { throw new IllegalArgumentException("Brightness must be between -1.0 and 1.0"); } @@ -587,13 +587,13 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { throw new IllegalArgumentException("Contrast must be greater than 0.0"); } // FIXME: ensure gamma is > 1.0? Are smaller / negative values legal? - int rampLength = getGammaRampLength(); + final int rampLength = getGammaRampLength(); if (rampLength == 0) { return false; } - float[] gammaRamp = new float[rampLength]; + final float[] gammaRamp = new float[rampLength]; for (int i = 0; i < rampLength; i++) { - float intensity = (float) i / (float) (rampLength - 1); + final float intensity = (float) i / (float) (rampLength - 1); // apply gamma float rampEntry = (float) java.lang.Math.pow(intensity, gamma); // apply brightness @@ -631,7 +631,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** Sets the gamma ramp for the main screen. Returns false if gamma ramp changes were not supported. */ - protected boolean setGammaRamp(float[] ramp) { + protected boolean setGammaRamp(final float[] ramp) { return false; } @@ -644,7 +644,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** Resets the gamma ramp, potentially using the specified Buffer as data to restore the original values. */ - protected void resetGammaRamp(Buffer originalGammaRamp) { + protected void resetGammaRamp(final Buffer originalGammaRamp) { } // Shutdown hook mechanism for resetting gamma diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index bf791822f..aea9a5b7b 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -60,6 +60,8 @@ import javax.media.opengl.GLFBODrawable; import javax.media.opengl.GLRunnable; import javax.media.opengl.GLSharedContextSetter; +import com.jogamp.common.util.PropertyAccess; + /** Encapsulates the implementation of most of the GLAutoDrawable's methods to be able to share it between GLAutoDrawable implementations like GLAutoDrawableBase, GLCanvas and GLJPanel. */ public class GLDrawableHelper { @@ -68,7 +70,7 @@ public class GLDrawableHelper { static { Debug.initSingleton(); - PERF_STATS = Debug.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true); + PERF_STATS = PropertyAccess.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true); } protected static final boolean DEBUG = GLDrawableImpl.DEBUG; @@ -108,7 +110,7 @@ public class GLDrawableHelper { sharedAutoDrawable = null; } - public final void setSharedContext(GLContext thisContext, GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext thisContext, final GLContext sharedContext) throws IllegalStateException { if( null == sharedContext ) { throw new IllegalStateException("Null shared GLContext"); } @@ -124,7 +126,7 @@ public class GLDrawableHelper { this.sharedContext = sharedContext; } - public final void setSharedAutoDrawable(GLAutoDrawable thisAutoDrawable, GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable thisAutoDrawable, final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { if( null == sharedAutoDrawable ) { throw new IllegalStateException("Null shared GLAutoDrawable"); } @@ -146,7 +148,7 @@ public class GLDrawableHelper { * @return true if initialization is pending due to a set shared GLAutoDrawable or GLContext * which is not ready yet. Otherwise false. */ - public boolean isSharedGLContextPending(GLContext[] shared) { + public boolean isSharedGLContextPending(final GLContext[] shared) { final GLContext shareWith; final boolean pending; if ( null != sharedAutoDrawable ) { @@ -168,12 +170,12 @@ public class GLDrawableHelper { @Override public final String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("GLAnimatorControl: "+animatorCtrl+", "); synchronized(listenersLock) { sb.append("GLEventListeners num "+listeners.size()+" ["); for (int i=0; i < listeners.size(); i++) { - Object l = listeners.get(i); + final Object l = listeners.get(i); sb.append(l); sb.append("[init "); sb.append( !listenersToBeInit.contains(l) ); @@ -195,7 +197,7 @@ public class GLDrawableHelper { * </p> * @param ctx */ - public static final void forceNativeRelease(GLContext ctx) { + public static final void forceNativeRelease(final GLContext ctx) { int releaseCount = 0; do { ctx.release(); @@ -236,7 +238,7 @@ public class GLDrawableHelper { * * @see GLAutoDrawable#setContext(GLContext, boolean) */ - public static final void switchContext(GLDrawable drawable, GLContext oldCtx, boolean destroyOldCtx, GLContext newCtx, int newCtxCreationFlags) { + public static final void switchContext(final GLDrawable drawable, final GLContext oldCtx, final boolean destroyOldCtx, final GLContext newCtx, final int newCtxCreationFlags) { if( null != oldCtx ) { if( destroyOldCtx ) { oldCtx.destroy(); @@ -268,7 +270,7 @@ public class GLDrawableHelper { * @param context maybe null * @return the new drawable */ - public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) { + public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, final GLContext context) { if( ! drawable.isRealized() ) { return drawable; } @@ -335,7 +337,7 @@ public class GLDrawableHelper { * @throws NativeWindowException is drawable is not offscreen or it's surface lock couldn't be claimed * @throws GLException may be thrown a resize operation */ - public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, GLContext context, int newWidth, int newHeight) + public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, final GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { final NativeSurface ns = drawable.getNativeSurface(); @@ -385,11 +387,11 @@ public class GLDrawableHelper { return drawable; } - public final void addGLEventListener(GLEventListener listener) { + public final void addGLEventListener(final GLEventListener listener) { addGLEventListener(-1, listener); } - public final void addGLEventListener(int index, GLEventListener listener) { + public final void addGLEventListener(int index, final GLEventListener listener) { synchronized(listenersLock) { if(0>index) { index = listeners.size(); @@ -408,7 +410,7 @@ public class GLDrawableHelper { * Consider calling {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}. * @return the removed listener, or null if listener was not added */ - public final GLEventListener removeGLEventListener(GLEventListener listener) { + public final GLEventListener removeGLEventListener(final GLEventListener listener) { synchronized(listenersLock) { listenersToBeInit.remove(listener); return listeners.remove(listener) ? listener : null; @@ -447,13 +449,13 @@ public class GLDrawableHelper { } } - public final boolean getGLEventListenerInitState(GLEventListener listener) { + public final boolean getGLEventListenerInitState(final GLEventListener listener) { synchronized(listenersLock) { return !listenersToBeInit.contains(listener); } } - public final void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public final void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { synchronized(listenersLock) { if(initialized) { listenersToBeInit.remove(listener); @@ -478,7 +480,7 @@ public class GLDrawableHelper { * @param remove if true, the listener gets removed * @return the disposed and/or removed listener, otherwise null if neither action is performed */ - public final GLEventListener disposeGLEventListener(GLAutoDrawable autoDrawable, GLEventListener listener, boolean remove) { + public final GLEventListener disposeGLEventListener(final GLAutoDrawable autoDrawable, final GLEventListener listener, final boolean remove) { synchronized(listenersLock) { if( remove ) { if( listeners.remove(listener) ) { @@ -512,7 +514,7 @@ public class GLDrawableHelper { * @param autoDrawable * @return the disposal count */ - public final int disposeAllGLEventListener(GLAutoDrawable autoDrawable, boolean remove) { + public final int disposeAllGLEventListener(final GLAutoDrawable autoDrawable, final boolean remove) { int disposeCount = 0; synchronized(listenersLock) { if( remove ) { @@ -613,7 +615,7 @@ public class GLDrawableHelper { } } - private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) { + private final void init(final GLEventListener l, final GLAutoDrawable drawable, final boolean sendReshape, final boolean setViewport) { l.init(drawable); if(sendReshape) { reshape(l, drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), setViewport, false /* checkInit */); @@ -624,7 +626,7 @@ public class GLDrawableHelper { * The default init action to be called once after ctx is being created @ 1st makeCurrent(). * @param sendReshape set to true if the subsequent display call won't reshape, otherwise false to avoid double reshape. **/ - public final void init(GLAutoDrawable drawable, boolean sendReshape) { + public final void init(final GLAutoDrawable drawable, final boolean sendReshape) { synchronized(listenersLock) { final ArrayList<GLEventListener> _listeners = listeners; final int listenerCount = _listeners.size(); @@ -645,13 +647,13 @@ public class GLDrawableHelper { } } - public final void display(GLAutoDrawable drawable) { + public final void display(final GLAutoDrawable drawable) { displayImpl(drawable); if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0 displayImpl(drawable); } } - private final void displayImpl(GLAutoDrawable drawable) { + private final void displayImpl(final GLAutoDrawable drawable) { synchronized(listenersLock) { final ArrayList<GLEventListener> _listeners = listeners; final int listenerCount = _listeners.size(); @@ -667,8 +669,8 @@ public class GLDrawableHelper { } } - private final void reshape(GLEventListener listener, GLAutoDrawable drawable, - int x, int y, int width, int height, boolean setViewport, boolean checkInit) { + private final void reshape(final GLEventListener listener, final GLAutoDrawable drawable, + final int x, final int y, final int width, final int height, final boolean setViewport, final boolean checkInit) { if(checkInit) { // GLEventListener may need to be init, // in case this one is added after the realization of the GLAutoDrawable @@ -692,7 +694,7 @@ public class GLDrawableHelper { listener.reshape(drawable, x, y, width, height); } - public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public final void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { synchronized(listenersLock) { for (int i=0; i < listeners.size(); i++) { reshape(listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */); @@ -700,7 +702,7 @@ public class GLDrawableHelper { } } - private final boolean execGLRunnables(GLAutoDrawable drawable) { // glRunnables.size()>0 + private final boolean execGLRunnables(final GLAutoDrawable drawable) { // glRunnables.size()>0 boolean res = true; // swap one-shot list asap final ArrayList<GLRunnableTask> _glRunnables; @@ -742,7 +744,7 @@ public class GLDrawableHelper { } } - public final void setAnimator(GLAnimatorControl animator) throws GLException { + public final void setAnimator(final GLAnimatorControl animator) throws GLException { synchronized(glRunnablesLock) { if(animatorCtrl!=animator && null!=animator && null!=animatorCtrl) { throw new GLException("Trying to register GLAnimatorControl "+animator+", where "+animatorCtrl+" is already registered. Unregister first."); @@ -789,14 +791,14 @@ public class GLDrawableHelper { * @param glRunnable the {@link GLRunnable} to execute within {@link #display()} * @return <code>true</code> if the {@link GLRunnable} has been processed or queued, otherwise <code>false</code>. */ - public final boolean invoke(GLAutoDrawable drawable, boolean wait, GLRunnable glRunnable) { + public final boolean invoke(final GLAutoDrawable drawable, boolean wait, final GLRunnable glRunnable) { if( null == glRunnable || null == drawable || wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; } GLRunnableTask rTask = null; - Object rTaskLock = new Object(); + final Object rTaskLock = new Object(); Throwable throwable = null; synchronized(rTaskLock) { final boolean deferred; @@ -815,7 +817,7 @@ public class GLDrawableHelper { } else if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -829,7 +831,7 @@ public class GLDrawableHelper { return true; } - public final boolean invoke(GLAutoDrawable drawable, boolean wait, List<GLRunnable> newGLRunnables) { + public final boolean invoke(final GLAutoDrawable drawable, boolean wait, final List<GLRunnable> newGLRunnables) { if( null == newGLRunnables || newGLRunnables.size() == 0 || null == drawable || wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; @@ -837,7 +839,7 @@ public class GLDrawableHelper { final int count = newGLRunnables.size(); GLRunnableTask rTask = null; - Object rTaskLock = new Object(); + final Object rTaskLock = new Object(); Throwable throwable = null; synchronized(rTaskLock) { final boolean deferred; @@ -859,7 +861,7 @@ public class GLDrawableHelper { } else if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -873,7 +875,7 @@ public class GLDrawableHelper { return true; } - public final void enqueue(GLRunnable glRunnable) { + public final void enqueue(final GLRunnable glRunnable) { if( null == glRunnable) { return; } @@ -882,7 +884,7 @@ public class GLDrawableHelper { } } - public final void setAutoSwapBufferMode(boolean enable) { + public final void setAutoSwapBufferMode(final boolean enable) { autoSwapBufferMode = enable; } @@ -921,7 +923,7 @@ public class GLDrawableHelper { * @return previous exclusive context thread * @throws GLException If an exclusive thread is still active but a new one is attempted to be set */ - public final Thread setExclusiveContextThread(Thread t, GLContext context) throws GLException { + public final Thread setExclusiveContextThread(final Thread t, final GLContext context) throws GLException { if (DEBUG) { System.err.println("GLDrawableHelper.setExclusiveContextThread(): START switch "+getExclusiveContextSwitchString()+", thread "+exclusiveContextThread+" -> "+t+" -- currentThread "+Thread.currentThread()); } @@ -938,7 +940,7 @@ public class GLDrawableHelper { if( null != context && context.isCurrent() ) { try { forceNativeRelease(context); - } catch (Throwable ex) { + } catch (final Throwable ex) { ex.printStackTrace(); throw new GLException(ex); } @@ -982,7 +984,7 @@ public class GLDrawableHelper { final Runnable initAction) { if(null==context) { if (DEBUG) { - Exception e = new GLException(getThreadName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); + final Exception e = new GLException(getThreadName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); e.printStackTrace(); } return; @@ -1010,7 +1012,7 @@ public class GLDrawableHelper { * @param destroyContext destroy context in the end while holding the lock */ public final void disposeGL(final GLAutoDrawable autoDrawable, - final GLContext context, boolean destroyContext) { + final GLContext context, final boolean destroyContext) { // Support for recursive makeCurrent() calls as well as calling // other drawables' display() methods from within another one's GLContext lastContext = GLContext.getCurrent(); @@ -1044,7 +1046,7 @@ public class GLDrawableHelper { forceNativeRelease(context); } flushGLRunnables(); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1130,7 +1132,7 @@ public class GLDrawableHelper { if( releaseContext ) { try { context.release(); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1188,14 +1190,14 @@ public class GLDrawableHelper { } } - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); long tdA = 0; // makeCurrent long tdR = 0; // render time long tdS = 0; // swapBuffers long tdX = 0; // release boolean ctxClaimed = false; boolean ctxReleased = false; - boolean ctxDestroyed = false; + final boolean ctxDestroyed = false; try { final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { @@ -1236,7 +1238,7 @@ public class GLDrawableHelper { try { context.release(); ctxReleased = true; - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1252,7 +1254,7 @@ public class GLDrawableHelper { } } } - long td = System.currentTimeMillis() - t0; + final long td = System.currentTimeMillis() - t0; System.err.println("td0 "+td+"ms, fps "+(1.0/(td/1000.0))+", td-makeCurrent: "+tdA+"ms, td-render "+tdR+"ms, td-swap "+tdS+"ms, td-release "+tdX+"ms, ctx claimed: "+ctxClaimed+", ctx release: "+ctxReleased+", ctx destroyed "+ctxDestroyed); } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index 2070c2f4e..3bb22612f 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -54,11 +54,11 @@ import javax.media.opengl.GLProfile; public abstract class GLDrawableImpl implements GLDrawable { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; - protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + protected GLDrawableImpl(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { this(factory, comp, (GLCapabilitiesImmutable) comp.getGraphicsConfiguration().getRequestedCapabilities(), realized); } - protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, GLCapabilitiesImmutable requestedCapabilities, boolean realized) { + protected GLDrawableImpl(final GLDrawableFactory factory, final NativeSurface comp, final GLCapabilitiesImmutable requestedCapabilities, final boolean realized) { this.factory = factory; this.surface = comp; this.realized = realized; @@ -120,7 +120,7 @@ public abstract class GLDrawableImpl implements GLDrawable { */ protected abstract void swapBuffersImpl(boolean doubleBuffered); - public final static String toHexString(long hex) { + public final static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } @@ -170,14 +170,14 @@ public abstract class GLDrawableImpl implements GLDrawable { } @Override - public final void setRealized(boolean realizedArg) { + public final void setRealized(final boolean realizedArg) { if ( realized != realizedArg ) { // volatile: OK (locked below) final boolean isProxySurface = surface instanceof ProxySurface; if(DEBUG) { System.err.println(getThreadName() + ": setRealized: drawable "+getClass().getSimpleName()+", surface "+surface.getClass().getSimpleName()+", isProxySurface "+isProxySurface+": "+realized+" -> "+realizedArg); Thread.dumpStack(); } - AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice(); if(realizedArg) { if(isProxySurface) { ((ProxySurface)surface).createNotify(); @@ -238,7 +238,7 @@ public abstract class GLDrawableImpl implements GLDrawable { * @param ctx the just bounded or unbounded context * @param bound if <code>true</code> create an association, otherwise remove it */ - protected void associateContext(GLContext ctx, boolean bound) { } + protected void associateContext(final GLContext ctx, final boolean bound) { } /** * Callback for special implementations, allowing GLContext to trigger GL related lifecycle: <code>makeCurrent</code>, <code>release</code>. @@ -253,14 +253,14 @@ public abstract class GLDrawableImpl implements GLDrawable { * </p> * @see #associateContext(GLContext, boolean) */ - protected void contextMadeCurrent(GLContext glc, boolean current) { } + protected void contextMadeCurrent(final GLContext glc, final boolean current) { } /** Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.*/ protected int getDefaultDrawFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */ protected int getDefaultReadFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */ - protected int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + protected int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead) { if( gl.isGLES() || hasDedicatedDrawableRead || getChosenGLCapabilities().getDoubleBuffered() ) { // Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glReadBuffer // Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java index 421f06205..95e13e26a 100644 --- a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java @@ -32,7 +32,7 @@ import com.jogamp.common.os.DynamicLibraryBundle; public class GLDynamicLookupHelper extends DynamicLibraryBundle { - public GLDynamicLookupHelper(GLDynamicLibraryBundleInfo info) { + public GLDynamicLookupHelper(final GLDynamicLibraryBundleInfo info) { super(info); } diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index bf6a56afe..6046527d1 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -11,6 +11,7 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import javax.media.opengl.GLFBODrawable; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionUtil; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.opengl.FBObject; @@ -43,7 +44,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { static { Debug.initSingleton(); DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject"); - DEBUG_SWAP = DEBUG || Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true); + DEBUG_SWAP = DEBUG || PropertyAccess.isPropertyDefined("jogl.debug.FBObject.Swap", true); } private final GLDrawableImpl parent; @@ -84,8 +85,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { * @param fboCaps the requested FBO capabilities * @param textureUnit */ - protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface, - GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected GLFBODrawableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final NativeSurface surface, + final GLCapabilitiesImmutable fboCaps, final int textureUnit) { super(factory, surface, fboCaps, false); this.initialized = false; @@ -101,7 +102,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { this.swapBufferContext = null; } - private final void initialize(boolean realize, GL gl) { + private final void initialize(final boolean realize, final GL gl) { if( !initialized && !realize ) { if( DEBUG ) { System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!"); @@ -175,11 +176,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - public final void setSwapBufferContext(SwapBufferContext sbc) { + public final void setSwapBufferContext(final SwapBufferContext sbc) { swapBufferContext = sbc; } - private final void reset(GL gl, int idx, int width, int height, int samples, int alphaBits, int stencilBits) { + private final void reset(final GL gl, final int idx, final int width, final int height, final int samples, final int alphaBits, final int stencilBits) { if( !fboResetQuirk ) { try { fbos[idx].reset(gl, width, height, samples, false); @@ -187,7 +188,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbos[idx]); } return; - } catch (GLException e) { + } catch (final GLException e) { fboResetQuirk = true; if(DEBUG) { if(!resetQuirkInfoDumped) { @@ -227,7 +228,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void reset(GL gl, int newSamples) throws GLException { + private final void reset(final GL gl, int newSamples) throws GLException { if(!initialized) { // NOP if not yet initializes return; @@ -275,7 +276,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final GLCapabilities fboCapsNative = (GLCapabilities) surface.getGraphicsConfiguration().getChosenCapabilities(); fbos[0].formatToGLCapabilities(fboCapsNative); } - } catch (Throwable t) { + } catch (final Throwable t) { tFBO = t; } finally { try { @@ -283,7 +284,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { if(ctxSwitch) { curContext.makeCurrent(); } - } catch (Throwable t) { + } catch (final Throwable t) { tGL = t; } } @@ -303,7 +304,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { final GLContext ctx = parent.createContext(shareWith); ctx.setGLDrawable(this, false); return ctx; @@ -325,7 +326,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected final int getDefaultReadFramebuffer() { return initialized ? fbos[fboIFront].getReadFramebuffer() : 0; } @Override - protected final int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + protected final int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead) { return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; } @@ -345,12 +346,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - protected void associateContext(GLContext glc, boolean bound) { + protected void associateContext(final GLContext glc, final boolean bound) { initialize(bound, glc.getGL()); } @Override - protected final void contextMadeCurrent(GLContext glc, boolean current) { + protected final void contextMadeCurrent(final GLContext glc, final boolean current) { final GL gl = glc.getGL(); if(current) { if( !initialized ) { @@ -371,7 +372,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - protected void swapBuffersImpl(boolean doubleBuffered) { + protected void swapBuffersImpl(final boolean doubleBuffered) { final GLContext ctx = GLContext.getCurrent(); boolean doPostSwap; if( null != ctx && ctx.getGLDrawable() == this && fboBound ) { @@ -392,7 +393,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void swapFBOImplPost(GLContext glc) { + private final void swapFBOImplPost(final GLContext glc) { // Safely reset the previous front FBO - after completing propagating swap if(0 <= pendingFBOReset) { final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); @@ -401,12 +402,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void swapFBOImpl(GLContext glc) { + private final void swapFBOImpl(final GLContext glc) { final GL gl = glc.getGL(); fbos[fboIBack].markUnbound(); // fast path, use(gl,..) is called below if(DEBUG) { - int _fboIFront = ( fboIFront + 1 ) % fbos.length; + final int _fboIFront = ( fboIFront + 1 ) % fbos.length; if(_fboIFront != fboIBack) { throw new InternalError("XXX: "+_fboIFront+"!="+fboIBack); } } fboIFront = fboIBack; @@ -446,7 +447,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final void resetSize(GL gl) throws GLException { + public final void resetSize(final GL gl) throws GLException { reset(gl, samples); } @@ -454,20 +455,20 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { public final int getTextureUnit() { return texUnit; } @Override - public final void setTextureUnit(int u) { texUnit = u; } + public final void setTextureUnit(final int u) { texUnit = u; } @Override public final int getNumSamples() { return samples; } @Override - public void setNumSamples(GL gl, int newSamples) throws GLException { + public void setNumSamples(final GL gl, final int newSamples) throws GLException { if(samples != newSamples) { reset(gl, newSamples); } } @Override - public final int setNumBuffers(int bufferCount) throws GLException { + public final int setNumBuffers(final int bufferCount) throws GLException { // FIXME: Implement return bufferCount; } @@ -495,7 +496,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } */ @Override - public FBObject getFBObject(int bufferName) throws IllegalArgumentException { + public FBObject getFBObject(final int bufferName) throws IllegalArgumentException { if(!initialized) { return null; } @@ -518,7 +519,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException { + public final TextureAttachment getTextureBuffer(final int bufferName) throws IllegalArgumentException { if(!initialized) { return null; } @@ -559,17 +560,17 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } public static class ResizeableImpl extends GLFBODrawableImpl implements GLFBODrawable.Resizeable { - protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface, - GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected ResizeableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final ProxySurface surface, + final GLCapabilitiesImmutable fboCaps, final int textureUnit) { super(factory, parent, surface, fboCaps, textureUnit); } @Override - public final void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { + public final void setSurfaceSize(final GLContext context, final int newWidth, final int newHeight) throws NativeWindowException, GLException { if(DEBUG) { System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle())); } - int lockRes = lockSurface(); + final int lockRes = lockSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { throw new NativeWindowException("Could not lock surface: "+this); } diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java index 5c6b475b2..90d18eb60 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java @@ -37,8 +37,8 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser; public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurationFactory { - protected static int chooseCapabilities(CapabilitiesChooser chooser, CapabilitiesImmutable capsRequested, - List<? extends CapabilitiesImmutable> availableCaps, int recommendedIndex) { + protected static int chooseCapabilities(CapabilitiesChooser chooser, final CapabilitiesImmutable capsRequested, + final List<? extends CapabilitiesImmutable> availableCaps, final int recommendedIndex) { if (null == capsRequested) { throw new NativeWindowException("Null requested capabilities"); } @@ -69,7 +69,7 @@ public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurati } return chosenIndex; } - } catch (NativeWindowException e) { + } catch (final NativeWindowException e) { if (DEBUG) { e.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java index 702fb77de..1fb27cfcf 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java @@ -45,7 +45,7 @@ public class GLGraphicsConfigurationUtil { public static final int FBO_BIT = 1 << 3; // generic bit must be mapped to native one at impl. level public static final int ALL_BITS = WINDOW_BIT | BITMAP_BIT | PBUFFER_BIT | FBO_BIT ; - public static final StringBuilder winAttributeBits2String(StringBuilder sb, int winattrbits) { + public static final StringBuilder winAttributeBits2String(StringBuilder sb, final int winattrbits) { if(null==sb) { sb = new StringBuilder(); } @@ -101,7 +101,7 @@ public class GLGraphicsConfigurationUtil { /** * @return bitmask representing the input boolean in exclusive or logic, ie only one bit will be set. */ - public static final int getExclusiveWinAttributeBits(boolean isOnscreen, boolean isFBO, boolean isPBuffer, boolean isBitmap) { + public static final int getExclusiveWinAttributeBits(final boolean isOnscreen, final boolean isFBO, final boolean isPBuffer, final boolean isBitmap) { final int winattrbits; if(isOnscreen) { winattrbits = WINDOW_BIT; @@ -120,11 +120,11 @@ public class GLGraphicsConfigurationUtil { /** * @see #getExclusiveWinAttributeBits(boolean, boolean, boolean, boolean) */ - public static final int getExclusiveWinAttributeBits(GLCapabilitiesImmutable caps) { + public static final int getExclusiveWinAttributeBits(final GLCapabilitiesImmutable caps) { return getExclusiveWinAttributeBits(caps.isOnscreen(), caps.isFBO(), caps.isPBuffer(), caps.isBitmap()); } - public static final GLCapabilities fixWinAttribBitsAndHwAccel(AbstractGraphicsDevice device, int winattrbits, GLCapabilities caps) { + public static final GLCapabilities fixWinAttribBitsAndHwAccel(final AbstractGraphicsDevice device, final int winattrbits, final GLCapabilities caps) { caps.setBitmap ( 0 != ( BITMAP_BIT & winattrbits ) ); caps.setPBuffer ( 0 != ( PBUFFER_BIT & winattrbits ) ); caps.setFBO ( 0 != ( FBO_BIT & winattrbits ) ); @@ -150,15 +150,15 @@ public class GLGraphicsConfigurationUtil { * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ - public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested, - GLDrawableFactory factory, AbstractGraphicsDevice device) { + public static GLCapabilitiesImmutable fixGLCapabilities(final GLCapabilitiesImmutable capsRequested, + final GLDrawableFactory factory, final AbstractGraphicsDevice device) { if( !capsRequested.isOnscreen() ) { return fixOffscreenGLCapabilities(capsRequested, factory, device); } return capsRequested; } - public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) { // fix caps .. @@ -172,7 +172,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable fixOffscreenBitOnly(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixOffscreenBitOnly(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() ) { // fix caps .. @@ -195,8 +195,8 @@ public class GLGraphicsConfigurationUtil { * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ - public static GLCapabilitiesImmutable fixOffscreenGLCapabilities(GLCapabilitiesImmutable capsRequested, - GLDrawableFactory factory, AbstractGraphicsDevice device) { + public static GLCapabilitiesImmutable fixOffscreenGLCapabilities(final GLCapabilitiesImmutable capsRequested, + final GLDrawableFactory factory, AbstractGraphicsDevice device) { if(null == device) { device = factory.getDefaultDevice(); } @@ -250,7 +250,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() || !capsRequested.isPBuffer() || @@ -268,7 +268,7 @@ public class GLGraphicsConfigurationUtil { } /** Fix opaque setting while preserve alpha bits */ - public static GLCapabilities fixOpaqueGLCapabilities(GLCapabilities capsRequested, boolean isOpaque) + public static GLCapabilities fixOpaqueGLCapabilities(final GLCapabilities capsRequested, final boolean isOpaque) { if( capsRequested.isBackgroundOpaque() != isOpaque) { final int alphaBits = capsRequested.getAlphaBits(); @@ -279,7 +279,7 @@ public class GLGraphicsConfigurationUtil { } /** Fix double buffered setting */ - public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean doubleBuffered) + public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(final GLCapabilitiesImmutable capsRequested, final boolean doubleBuffered) { if( capsRequested.getDoubleBuffered() != doubleBuffered) { final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); @@ -289,7 +289,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555, boolean allowAlpha) + public static GLCapabilitiesImmutable clipRGBAGLCapabilities(final GLCapabilitiesImmutable caps, final boolean allowRGB555, final boolean allowAlpha) { final int iR = caps.getRedBits(); final int iG = caps.getGreenBits(); @@ -320,7 +320,7 @@ public class GLGraphicsConfigurationUtil { return compOut; } - public static GLCapabilitiesImmutable fixGLProfile(GLCapabilitiesImmutable caps, GLProfile glp) + public static GLCapabilitiesImmutable fixGLProfile(final GLCapabilitiesImmutable caps, final GLProfile glp) { if( caps.getGLProfile() != glp ) { final GLCapabilities caps2 = (GLCapabilities) caps.cloneMutable(); diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java index edfebdcfe..95c4ceb98 100644 --- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java @@ -52,12 +52,12 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen * @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}. * @param lock optional upstream lock, may be null */ - public GLOffscreenAutoDrawableImpl(GLDrawable drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { + public GLOffscreenAutoDrawableImpl(final GLDrawable drawable, final GLContext context, final Object upstreamWidget, final RecursiveLock lock) { super(drawable, context, upstreamWidget, true, lock); } @Override - public void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException { + public void setSurfaceSize(final int newWidth, final int newHeight) throws NativeWindowException, GLException { this.defaultWindowResizedOp(newWidth, newHeight); } @@ -71,7 +71,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen * @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}. * @param lock optional upstream lock, may be null */ - public FBOImpl(GLFBODrawableImpl drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { + public FBOImpl(final GLFBODrawableImpl drawable, final GLContext context, final Object upstreamWidget, final RecursiveLock lock) { super(drawable, context, upstreamWidget, lock); } @@ -86,7 +86,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } @Override - public final void setTextureUnit(int unit) { + public final void setTextureUnit(final int unit) { ((GLFBODrawableImpl)drawable).setTextureUnit(unit); } @@ -96,13 +96,13 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } @Override - public final void setNumSamples(GL gl, int newSamples) throws GLException { + public final void setNumSamples(final GL gl, final int newSamples) throws GLException { ((GLFBODrawableImpl)drawable).setNumSamples(gl, newSamples); windowRepaintOp(); } @Override - public final int setNumBuffers(int bufferCount) throws GLException { + public final int setNumBuffers(final int bufferCount) throws GLException { return ((GLFBODrawableImpl)drawable).setNumBuffers(bufferCount); } @@ -123,17 +123,17 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } */ @Override - public final FBObject getFBObject(int bufferName) { + public final FBObject getFBObject(final int bufferName) { return ((GLFBODrawableImpl)drawable).getFBObject(bufferName); } @Override - public final FBObject.TextureAttachment getTextureBuffer(int bufferName) { + public final FBObject.TextureAttachment getTextureBuffer(final int bufferName) { return ((GLFBODrawableImpl)drawable).getTextureBuffer(bufferName); } @Override - public void resetSize(GL gl) throws GLException { + public void resetSize(final GL gl) throws GLException { ((GLFBODrawableImpl)drawable).resetSize(gl); } } diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index c32957b86..ac5487961 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -50,7 +50,7 @@ import com.jogamp.common.util.locks.RecursiveLock; @SuppressWarnings("deprecation") public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { - public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContextImpl pbufferContext) { + public GLPbufferImpl(final GLDrawableImpl pbufferDrawable, final GLContextImpl pbufferContext) { super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext } diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java index 6de92f533..0ceef6bf7 100644 --- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java +++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java @@ -44,7 +44,7 @@ public class GLRunnableTask implements GLRunnable { Throwable runnableException; - public GLRunnableTask(GLRunnable runnable, Object notifyObject, boolean catchExceptions) { + public GLRunnableTask(final GLRunnable runnable, final Object notifyObject, final boolean catchExceptions) { this.runnable = runnable ; this.notifyObject = notifyObject ; this.catchExceptions = catchExceptions; @@ -53,12 +53,12 @@ public class GLRunnableTask implements GLRunnable { } @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { boolean res = true; if(null == notifyObject) { try { res = runnable.run(drawable); - } catch (Throwable t) { + } catch (final Throwable t) { runnableException = t; if(catchExceptions) { runnableException.printStackTrace(); @@ -72,7 +72,7 @@ public class GLRunnableTask implements GLRunnable { synchronized (notifyObject) { try { res = runnable.run(drawable); - } catch (Throwable t) { + } catch (final Throwable t) { runnableException = t; if(catchExceptions) { runnableException.printStackTrace(); diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index 706d51323..d532a2567 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -78,7 +78,7 @@ public class GLStateTracker { /** * set (client) pixel-store state, deep copy */ - private final void setPixelStateMap(IntIntHashMap pixelStateMap) { + private final void setPixelStateMap(final IntIntHashMap pixelStateMap) { this.pixelStateMap = (IntIntHashMap) pixelStateMap.clone(); } @@ -102,7 +102,7 @@ public class GLStateTracker { pixelStateMap.clear(); } - public final void setEnabled(boolean on) { + public final void setEnabled(final boolean on) { enabled = on; } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index 431c1a387..ddcd9626e 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -39,7 +39,7 @@ public class GLVersionNumber extends VersionNumberString { private final boolean valid; - private GLVersionNumber(int[] val, int strEnd, short state, String versionString, boolean valid) { + private GLVersionNumber(final int[] val, final int strEnd, final short state, final String versionString, final boolean valid) { super(val[0], val[1], val[2], strEnd, state, versionString); this.valid = valid; } @@ -56,8 +56,8 @@ public class GLVersionNumber extends VersionNumberString { } private static volatile java.util.regex.Pattern _Pattern = null; - public static final GLVersionNumber create(String versionString) { - int[] val = new int[] { 0, 0, 0 }; + public static final GLVersionNumber create(final String versionString) { + final int[] val = new int[] { 0, 0, 0 }; int strEnd = 0; short state = 0; boolean valid = false; @@ -67,7 +67,7 @@ public class GLVersionNumber extends VersionNumberString { if (versionString.startsWith("GL_VERSION_")) { versionPattern = getUnderscorePattern(); } else { - versionPattern = VersionNumberString.getDefaultVersionNumberPattern(); + versionPattern = VersionNumber.getDefaultVersionNumberPattern(); } final VersionNumberString version = new VersionNumberString(versionString, versionPattern); strEnd = version.endOfStringMatch(); @@ -76,7 +76,7 @@ public class GLVersionNumber extends VersionNumberString { state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component! - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); System.err.println("Info: ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: " + e); val[0] = 1; @@ -101,7 +101,7 @@ public class GLVersionNumber extends VersionNumberString { * 4.3.0 NVIDIA 310.32 -> 310.32 (310.32) * </pre> */ - public static final VersionNumberString createVendorVersion(String versionString) { + public static final VersionNumberString createVendorVersion(final String versionString) { if (versionString == null || versionString.length() <= 0) { return null; } diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index 100b46a5e..131e6f3ac 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -86,7 +86,7 @@ public class GLWorkerThread { thread.start(); try { lock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } } @@ -149,7 +149,7 @@ public class GLWorkerThread { } } - public static void invoke(boolean wait, Runnable runnable) + public static void invoke(final boolean wait, final Runnable runnable) throws InvocationTargetException, InterruptedException { if(wait) { invokeAndWait(runnable); @@ -158,13 +158,13 @@ public class GLWorkerThread { } } - public static void invokeAndWait(Runnable runnable) + public static void invokeAndWait(final Runnable runnable) throws InvocationTargetException, InterruptedException { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeAndWait on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -179,19 +179,19 @@ public class GLWorkerThread { lockTemp.notifyAll(); lockTemp.wait(); if (exception != null) { - Throwable localException = exception; + final Throwable localException = exception; exception = null; throw new InvocationTargetException(localException); } } } - public static void invokeLater(Runnable runnable) { + public static void invokeLater(final Runnable runnable) { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeLater on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -237,7 +237,7 @@ public class GLWorkerThread { try { // Avoid race conditions with wanting to release contexts on this thread lock.wait(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } if (GLContext.getCurrent() != null) { @@ -256,7 +256,7 @@ public class GLWorkerThread { if (work != null) { try { work.run(); - } catch (Throwable t) { + } catch (final Throwable t) { exception = t; } finally { work = null; @@ -266,19 +266,19 @@ public class GLWorkerThread { while (!queue.isEmpty()) { try { - Runnable curAsync = queue.remove(0); + final Runnable curAsync = queue.remove(0); curAsync.run(); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println(getThreadName()+": Exception occurred on JOGL OpenGL worker thread:"); t.printStackTrace(); } } // See about releasing current context - GLContext curContext = GLContext.getCurrent(); + final GLContext curContext = GLContext.getCurrent(); if (curContext != null && (curContext instanceof GLContextImpl)) { - GLContextImpl impl = (GLContextImpl) curContext; + final GLContextImpl impl = (GLContextImpl) curContext; if (impl.hasWaiters()) { impl.release(); } diff --git a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java index a64a2f5cd..12384ad1e 100644 --- a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java +++ b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java @@ -58,18 +58,18 @@ public class ListenerSyncedImplStub<E> { return listeners.size(); } - public synchronized final void addListener(E listener) { + public synchronized final void addListener(final E listener) { addListener(-1, listener); } - public synchronized final void addListener(int index, E listener) { + public synchronized final void addListener(int index, final E listener) { if(0>index) { index = listeners.size(); } listeners.add(index, listener); } - public synchronized final void removeListener(E listener) { + public synchronized final void removeListener(final E listener) { listeners.remove(listener); } diff --git a/src/jogl/classes/jogamp/opengl/MemoryObject.java b/src/jogl/classes/jogamp/opengl/MemoryObject.java index 6ebefc517..942d62b9e 100644 --- a/src/jogl/classes/jogamp/opengl/MemoryObject.java +++ b/src/jogl/classes/jogamp/opengl/MemoryObject.java @@ -43,13 +43,13 @@ public class MemoryObject { private final long size; private final int hash; private ByteBuffer buffer=null; - public MemoryObject(long addr, long size) { + public MemoryObject(final long addr, final long size) { this.addr = addr; this.size = size; this.hash = HashUtil.getAddrSizeHash32_EqualDist(addr, size); } - public void setBuffer(ByteBuffer buffer) { + public void setBuffer(final ByteBuffer buffer) { this.buffer = buffer; } @@ -76,7 +76,7 @@ public class MemoryObject { * @return true of reference is equal or <code>obj</code> is of type <code>MemoryObject</code> * and <code>addr</code> and <code>size</code> is equal.<br> */ - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(obj instanceof MemoryObject) { final MemoryObject m = (MemoryObject) obj; @@ -90,7 +90,7 @@ public class MemoryObject { * @param obj0 the MemoryObject * @return either the already mapped MemoryObject - not changing the map, or the newly mapped one. */ - public static MemoryObject getOrAddSafe(HashMap<MemoryObject,MemoryObject> map, MemoryObject obj0) { + public static MemoryObject getOrAddSafe(final HashMap<MemoryObject,MemoryObject> map, final MemoryObject obj0) { final MemoryObject obj1 = map.get(obj0); // get identity (fast) if(null == obj1) { map.put(obj0, obj0); diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 91fcbd7a4..2c7989237 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -158,7 +158,7 @@ public class ProjectFloat { * @param bottom * @param top */ - public void gluOrtho2D(GLMatrixFunc gl, float left, float right, float bottom, float top) { + public void gluOrtho2D(final GLMatrixFunc gl, final float left, final float right, final float bottom, final float top) { gl.glOrthof(left, right, bottom, top, -1, 1); } @@ -170,7 +170,7 @@ public class ProjectFloat { * @param zNear * @param zFar */ - public void gluPerspective(GLMatrixFunc gl, float fovy, float aspect, float zNear, float zFar) { + public void gluPerspective(final GLMatrixFunc gl, final float fovy, final float aspect, final float zNear, final float zFar) { gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy / 2 * (float) Math.PI / 180, aspect, zNear, zFar), 0); } @@ -187,10 +187,10 @@ public class ProjectFloat { * @param upy * @param upz */ - public void gluLookAt(GLMatrixFunc gl, - float eyex, float eyey, float eyez, - float centerx, float centery, float centerz, - float upx, float upy, float upz) { + public void gluLookAt(final GLMatrixFunc gl, + final float eyex, final float eyey, final float eyez, + final float centerx, final float centery, final float centerz, + final float upx, final float upy, final float upz) { mat4Tmp2[0+0] = eyex; mat4Tmp2[1+0] = eyey; mat4Tmp2[2+0] = eyez; @@ -235,11 +235,11 @@ public class ProjectFloat { /** * Map object coordinates to window coordinates. */ - public boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - int[] viewport, int viewport_offset, - float[] win_pos, int win_pos_offset ) { + public boolean gluProject(final float objx, final float objy, final float objz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final int[] viewport, final int viewport_offset, + final float[] win_pos, final int win_pos_offset ) { final float[] in = this.mat4Tmp1; final float[] out = this.mat4Tmp2; @@ -283,11 +283,11 @@ public class ProjectFloat { * * @return */ - public boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer win_pos) { + public boolean gluProject(final float objx, final float objy, final float objz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final IntBuffer viewport, + final FloatBuffer win_pos) { final float[] in = this.mat4Tmp1; final float[] out = this.mat4Tmp2; @@ -337,11 +337,11 @@ public class ProjectFloat { * @param obj_pos_offset * @return true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z) */ - public boolean gluUnProject(float winx, float winy, float winz, - float[] modelMatrix, int modelMatrix_offset, - float[] projMatrix, int projMatrix_offset, - int[] viewport, int viewport_offset, - float[] obj_pos, int obj_pos_offset) { + public boolean gluUnProject(final float winx, final float winy, final float winz, + final float[] modelMatrix, final int modelMatrix_offset, + final float[] projMatrix, final int projMatrix_offset, + final int[] viewport, final int viewport_offset, + final float[] obj_pos, final int obj_pos_offset) { return FloatUtil.mapWinToObjCoords(winx, winy, winz, modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, @@ -422,11 +422,11 @@ public class ProjectFloat { * * @return true if successful, otherwise false (failed to invert matrix, or becomes z is infinity) */ - public boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer obj_pos) { + public boolean gluUnProject(final float winx, final float winy, final float winz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final IntBuffer viewport, + final FloatBuffer obj_pos) { final int vPos = viewport.position(); final int oPos = obj_pos.position(); @@ -580,7 +580,7 @@ public class ProjectFloat { */ public void gluPickMatrix(final GLMatrixFunc gl, final float x, final float y, - float deltaX, final float deltaY, + final float deltaX, final float deltaY, final IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index 1688d1044..93a4eb32e 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -89,17 +89,17 @@ public class SharedResourceRunner implements Runnable { String initConnection; String releaseConnection; - private boolean getDeviceTried(String connection) { // synchronized call + private boolean getDeviceTried(final String connection) { // synchronized call return devicesTried.contains(connection); } - private void addDeviceTried(String connection) { // synchronized call + private void addDeviceTried(final String connection) { // synchronized call devicesTried.add(connection); } - private void removeDeviceTried(String connection) { // synchronized call + private void removeDeviceTried(final String connection) { // synchronized call devicesTried.remove(connection); } - public SharedResourceRunner(Implementation impl) { + public SharedResourceRunner(final Implementation impl) { this.impl = impl; resetState(); } @@ -144,7 +144,7 @@ public class SharedResourceRunner implements Runnable { while (!running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } } } @@ -164,14 +164,14 @@ public class SharedResourceRunner implements Runnable { while (running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } } } } } - public SharedResourceRunner.Resource getOrCreateShared(AbstractGraphicsDevice device) { + public SharedResourceRunner.Resource getOrCreateShared(final AbstractGraphicsDevice device) { SharedResourceRunner.Resource sr = null; if(null != device) { synchronized (this) { @@ -198,7 +198,7 @@ public class SharedResourceRunner implements Runnable { return sr; } - public SharedResourceRunner.Resource releaseShared(AbstractGraphicsDevice device) { + public SharedResourceRunner.Resource releaseShared(final AbstractGraphicsDevice device) { SharedResourceRunner.Resource sr = null; if(null != device) { synchronized (this) { @@ -219,7 +219,7 @@ public class SharedResourceRunner implements Runnable { return sr; } - private final void doAndWait(String initConnection, String releaseConnection) { + private final void doAndWait(final String initConnection, final String releaseConnection) { synchronized (this) { // wait until thread becomes ready to init new device, // pass the device and release the sync @@ -230,7 +230,7 @@ public class SharedResourceRunner implements Runnable { while (!ready && running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } if (DEBUG) { System.err.println("SharedResourceRunner.doAndWait() set command: " + initConnection + ", release: "+releaseConnection+" - "+threadName); @@ -243,7 +243,7 @@ public class SharedResourceRunner implements Runnable { while ( running && ( !ready || null != this.initConnection || null != this.releaseConnection ) ) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } if (DEBUG) { System.err.println("SharedResourceRunner.initializeAndWait END init: " + initConnection + ", release: "+releaseConnection+" - "+threadName); @@ -272,7 +272,7 @@ public class SharedResourceRunner implements Runnable { } notifyAll(); this.wait(); - } catch (InterruptedException ex) { + } catch (final InterruptedException ex) { shouldRelease = true; if(DEBUG) { System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+threadName); @@ -293,7 +293,7 @@ public class SharedResourceRunner implements Runnable { Resource sr = null; try { sr = impl.createSharedResource(initConnection); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if (null != sr) { @@ -304,12 +304,12 @@ public class SharedResourceRunner implements Runnable { if (DEBUG) { System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseConnection + " - " + threadName); } - Resource sr = impl.mapGet(releaseConnection); + final Resource sr = impl.mapGet(releaseConnection); if (null != sr) { try { impl.releaseSharedResource(sr); impl.mapPut(releaseConnection, null); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -338,11 +338,11 @@ public class SharedResourceRunner implements Runnable { private void releaseSharedResources() { // synchronized call devicesTried.clear(); - Collection<Resource> sharedResources = impl.mapValues(); - for (Iterator<Resource> iter = sharedResources.iterator(); iter.hasNext();) { + final Collection<Resource> sharedResources = impl.mapValues(); + for (final Iterator<Resource> iter = sharedResources.iterator(); iter.hasNext();) { try { impl.releaseSharedResource(iter.next()); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/SystemUtil.java b/src/jogl/classes/jogamp/opengl/SystemUtil.java index befe1a315..e7f078079 100644 --- a/src/jogl/classes/jogamp/opengl/SystemUtil.java +++ b/src/jogl/classes/jogamp/opengl/SystemUtil.java @@ -5,11 +5,11 @@ public class SystemUtil { private static volatile boolean getenvSupported = true; /** Wrapper for System.getenv(), which doesn't work on platforms earlier than JDK 5 */ - public static String getenv(String variableName) { + public static String getenv(final String variableName) { if (getenvSupported) { try { return System.getenv(variableName); - } catch (Error e) { + } catch (final Error e) { getenvSupported = false; } } diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java index bf700d970..2b017e8e9 100644 --- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java +++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java @@ -43,6 +43,7 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import com.jogamp.common.JogampRuntimeException; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; /** Implementation of the {@link javax.media.opengl.Threading} class. */ @@ -53,7 +54,7 @@ public class ThreadingImpl { public final int id; - Mode(int id){ + Mode(final int id){ this.id = id; } } @@ -76,10 +77,10 @@ public class ThreadingImpl { public ToolkitThreadingPlugin run() { final String singleThreadProp; { - final String w = Debug.getProperty("jogl.1thread", true); + final String w = PropertyAccess.getProperty("jogl.1thread", true); singleThreadProp = null != w ? w.toLowerCase() : null; } - ClassLoader cl = ThreadingImpl.class.getClassLoader(); + final ClassLoader cl = ThreadingImpl.class.getClassLoader(); // Default to using the AWT thread on all platforms except // Windows. On OS X there is instability apparently due to // using the JAWT on non-AWT threads. On X11 platforms there @@ -121,7 +122,7 @@ public class ThreadingImpl { Exception error=null; try { threadingPlugin = (ToolkitThreadingPlugin) ReflectionUtil.createInstance("jogamp.opengl.awt.AWTThreadingPlugin", cl); - } catch (JogampRuntimeException jre) { error = jre; } + } catch (final JogampRuntimeException jre) { error = jre; } if( Mode.ST_AWT == mode && null==threadingPlugin ) { throw new GLException("Mode is AWT, but class 'jogamp.opengl.awt.AWTThreadingPlugin' is not available", error); } @@ -201,7 +202,7 @@ public class ThreadingImpl { false). It is up to the end user to check to see whether the current thread is the OpenGL thread and either execute the Runnable directly or perform the work inside it. */ - public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { if(null!=threadingPlugin) { threadingPlugin.invokeOnOpenGLThread(wait, r); return; @@ -217,13 +218,13 @@ public class ThreadingImpl { } } - public static final void invokeOnWorkerThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnWorkerThread(final boolean wait, final Runnable r) throws GLException { GLWorkerThread.start(); // singleton start via volatile-dbl-checked-locking try { GLWorkerThread.invoke(wait, r); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new GLException(e); } } diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index 5778a1b6c..9aa1c882a 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -41,9 +41,9 @@ import com.jogamp.opengl.util.av.GLMediaPlayer; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; +import jogamp.common.os.PlatformPropsImpl; import jogamp.common.os.android.StaticContext; import jogamp.opengl.util.av.GLMediaPlayerImpl; - import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture.OnFrameAvailableListener; import android.hardware.Camera; @@ -81,7 +81,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { static { boolean _avail = false; - if(Platform.OS_TYPE.equals(Platform.OSType.ANDROID)) { + if(PlatformPropsImpl.OS_TYPE.equals(Platform.OSType.ANDROID)) { if(AndroidVersion.SDK_INT >= 14) { _avail = true; } @@ -116,18 +116,18 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected final boolean setPlaySpeedImpl(float rate) { + protected final boolean setPlaySpeedImpl(final float rate) { // FIXME return false; } @Override - protected final boolean setAudioVolumeImpl(float v) { + protected final boolean setAudioVolumeImpl(final float v) { if(null != mp) { try { mp.setVolume(v, v); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -145,7 +145,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { eos = false; mp.setOnCompletionListener(onCompletionListener); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -156,7 +156,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { cam.startPreview(); } return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -172,7 +172,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { mp.pause(); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -182,7 +182,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { cam.stopPreview(); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -192,7 +192,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected final int seekImpl(int msec) { + protected final int seekImpl(final int msec) { if(null != mp) { mp.seekTo(msec); return mp.getCurrentPosition(); @@ -200,7 +200,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { return 0; } - private void wakeUp(boolean newFrame) { + private void wakeUp(final boolean newFrame) { synchronized(updateSurfaceLock) { if(newFrame) { updateSurface = true; @@ -213,12 +213,12 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { protected final int getAudioPTSImpl() { return null != mp ? mp.getCurrentPosition() : 0; } @Override - protected final void destroyImpl(GL gl) { + protected final void destroyImpl(final GL gl) { if(null != mp) { wakeUp(false); try { mp.stop(); - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -230,7 +230,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { wakeUp(false); try { cam.stopPreview(); - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -241,7 +241,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } public static class SurfaceTextureFrame extends TextureSequence.TextureFrame { - public SurfaceTextureFrame(Texture t, SurfaceTexture stex) { + public SurfaceTextureFrame(final Texture t, final SurfaceTexture stex) { super(t); this.surfaceTex = stex; } @@ -264,7 +264,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { int cameraId = 0; try { cameraId = Integer.valueOf(cameraPath); - } catch (NumberFormatException nfe) {} + } catch (final NumberFormatException nfe) {} if( 0 <= cameraId && cameraId < Camera.getNumberOfCameras() ) { cam = Camera.open(cameraId); } else { @@ -282,17 +282,17 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { final Uri _uri = Uri.parse(getURI().toString()); mp.setDataSource(StaticContext.getContext(), _uri); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { throw new RuntimeException(e); - } catch (SecurityException e) { + } catch (final SecurityException e) { throw new RuntimeException(e); - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { throw new RuntimeException(e); } mp.setSurface(null); try { mp.prepare(); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new IOException("MediaPlayer failed to process stream <"+getURI().toString()+">: "+ioe.getMessage(), ioe); } final int r_aid = GLMediaPlayer.STREAM_ID_NONE == aid ? GLMediaPlayer.STREAM_ID_NONE : 1 /* fake */; @@ -340,7 +340,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { 0, 0, 0, icodec, icodec); } } - private static String camSz2Str(Camera.Size csize) { + private static String camSz2Str(final Camera.Size csize) { if( null != csize ) { return csize.width+"x"+csize.height; } else { @@ -348,7 +348,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } } @Override - protected final void initGLImpl(GL gl) throws IOException, GLException { + protected final void initGLImpl(final GL gl) throws IOException, GLException { // NOP } @@ -359,12 +359,12 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { * </p> */ @Override - protected int validateTextureCount(int desiredTextureCount) { + protected int validateTextureCount(final int desiredTextureCount) { return TEXTURE_COUNT_MIN; } @Override - protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { + protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) { int pts = TimeFrameI.INVALID_PTS; if(null != mp || null != cam) { final SurfaceTextureFrame sTexFrame = null != nextFrame ? (SurfaceTextureFrame) nextFrame : singleSTexFrame; @@ -380,7 +380,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { cam.setPreviewTexture(sTexFrame.surfaceTex); cam.startPreview(); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("MediaPlayer failed to process stream <"+getURI().toString()+">: "+ioe.getMessage(), ioe); } } @@ -401,7 +401,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { if(!updateSurface) { // volatile OK. try { updateSurfaceLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -432,7 +432,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { * </p> */ @Override - protected TextureFrame[] createTexFrames(GL gl, final int count) { + protected TextureFrame[] createTexFrames(final GL gl, final int count) { final int[] texNames = new int[1]; gl.glGenTextures(1, texNames, 0); final int err = gl.glGetError(); @@ -452,7 +452,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { * </p> */ @Override - protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) { + protected final TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) { sTexFrameCount++; if( 1 == sTexFrameCount ) { singleSTexFrame = new SurfaceTextureFrame( createTexImageImpl(gl, texName, getWidth(), getHeight()), new SurfaceTexture(texName) ); @@ -467,7 +467,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { * </p> */ @Override - protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { + protected final void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) { sTexFrameCount--; if( 0 == sTexFrameCount ) { singleSTexFrame = null; @@ -480,14 +480,14 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { private final OnFrameAvailableListener onFrameAvailableListener = new OnFrameAvailableListener() { @Override - public void onFrameAvailable(SurfaceTexture surfaceTexture) { + public void onFrameAvailable(final SurfaceTexture surfaceTexture) { wakeUp(true); } }; private final OnCompletionListener onCompletionListener = new OnCompletionListener() { @Override - public void onCompletion(MediaPlayer mp) { + public void onCompletion(final MediaPlayer mp) { eos = true; } }; diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java index 72c9ac54b..26ec62785 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java @@ -86,7 +86,7 @@ public class AWTThreadingPlugin implements ToolkitThreadingPlugin { } @Override - public final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { switch (ThreadingImpl.getMode()) { case ST_AWT: // FIXME: ideally should run all OpenGL work on the Java2D QFT diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index 1c1d2350a..a5f5b4702 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -83,11 +83,11 @@ public class AWTTilePainter { private Graphics2D g2d = null; private AffineTransform saveAT = null; - public static void dumpHintsAndScale(Graphics2D g2d) { + public static void dumpHintsAndScale(final Graphics2D g2d) { final RenderingHints rHints = g2d.getRenderingHints(); final Set<Entry<Object, Object>> rEntries = rHints.entrySet(); int count = 0; - for(Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) { + for(final Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) { final Entry<Object, Object> rEntry = rEntryIter.next(); System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue()); } @@ -105,7 +105,7 @@ public class AWTTilePainter { /** * @return resulting number of samples by comparing w/ {@link #customNumSamples} and the caps-config, 0 if disabled */ - public int getNumSamples(GLCapabilitiesImmutable caps) { + public int getNumSamples(final GLCapabilitiesImmutable caps) { if( 0 > customNumSamples ) { return 0; } else if( 0 < customNumSamples ) { @@ -137,7 +137,7 @@ public class AWTTilePainter { * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param verbose */ - public AWTTilePainter(TileRenderer renderer, int componentCount, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight, boolean verbose) { + public AWTTilePainter(final TileRenderer renderer, final int componentCount, final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight, final boolean verbose) { this.renderer = renderer; this.renderer.setGLEventListener(preTileGLEL, postTileGLEL); this.componentCount = componentCount; @@ -160,16 +160,16 @@ public class AWTTilePainter { * @param flipVertical if <code>true</code>, the image will be flipped vertically (Default for OpenGL). * @param originBottomLeft if <code>true</code>, the image's origin is on the bottom left (Default for OpenGL). */ - public void setGLOrientation(boolean flipVertical, boolean originBottomLeft) { + public void setGLOrientation(final boolean flipVertical, final boolean originBottomLeft) { this.flipVertical = flipVertical; this.originBottomLeft = originBottomLeft; } - private static Rectangle2D getClipBounds2D(Graphics2D g) { + private static Rectangle2D getClipBounds2D(final Graphics2D g) { final Shape shape = g.getClip(); return null != shape ? shape.getBounds2D() : null; } - private static Rectangle2D clipNegative(Rectangle2D in) { + private static Rectangle2D clipNegative(final Rectangle2D in) { if( null == in ) { return null; } double x=in.getX(), y=in.getY(), width=in.getWidth(), height=in.getHeight(); if( 0 > x ) { @@ -201,7 +201,7 @@ public class AWTTilePainter { * @throws NoninvertibleTransformException if the {@link Graphics2D}'s {@link AffineTransform} {@link AffineTransform#invert() inversion} fails. * Since inversion is tested before scaling the given {@link Graphics2D}, caller shall ignore the whole <i>term</i>. */ - public void setupGraphics2DAndClipBounds(Graphics2D g2d, int width, int height) throws NoninvertibleTransformException { + public void setupGraphics2DAndClipBounds(final Graphics2D g2d, final int width, final int height) throws NoninvertibleTransformException { this.g2d = g2d; saveAT = g2d.getTransform(); if( null == saveAT ) { @@ -278,11 +278,11 @@ public class AWTTilePainter { final GLEventListener preTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) {} + public void init(final GLAutoDrawable drawable) {} @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); if( null == tBuffer ) { final int tWidth = renderer.getParam(TileRenderer.TR_TILE_WIDTH); @@ -302,17 +302,17 @@ public class AWTTilePainter { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; static int _counter = 0; final GLEventListener postTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final DimensionImmutable cis = renderer.getClippedImageSize(); final int tWidth = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH); final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT); @@ -337,7 +337,7 @@ public class AWTTilePainter { final File fout = new File(fname); try { ImageIO.write(tBuffer.image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -368,7 +368,7 @@ public class AWTTilePainter { final File fout = new File(fname); try { ImageIO.write(dstImage, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } _counter++; @@ -395,6 +395,6 @@ public class AWTTilePainter { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; } diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java index dc286ca59..e34ec18b6 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java @@ -59,7 +59,7 @@ public class AWTUtil { isOGLPipelineActive = j2dClazz.getMethod("isOGLPipelineActive", (Class[])null); isQueueFlusherThread = j2dClazz.getMethod("isQueueFlusherThread", (Class[])null); j2dOk = true; - } catch (Exception e) {} + } catch (final Exception e) {} } } @@ -84,7 +84,7 @@ public class AWTUtil { !((Boolean)isQueueFlusherThread.invoke(null, (Object[])null)).booleanValue() ) { NativeWindowFactory.getAWTToolkitLock().lock(); } - } catch (Exception e) { j2dOk=false; } + } catch (final Exception e) { j2dOk=false; } } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().lock(); @@ -107,7 +107,7 @@ public class AWTUtil { !((Boolean)isQueueFlusherThread.invoke(null, (Object[])null)).booleanValue() ) { NativeWindowFactory.getAWTToolkitLock().unlock(); } - } catch (Exception e) { j2dOk=false; } + } catch (final Exception e) { j2dOk=false; } } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().unlock(); diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index 5735b875e..86ca7650f 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -59,6 +59,7 @@ import javax.media.opengl.GLProfile; import com.jogamp.common.os.Platform; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.Debug; @@ -128,7 +129,7 @@ public class Java2D { // OpenGL graphics configuration final GraphicsConfiguration cfg; final String cfgName; - final boolean java2dOGLDisabledByOS = Platform.OS_TYPE == Platform.OSType.MACOS; + final boolean java2dOGLDisabledByOS = PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS; final boolean java2dOGLDisabledByProp; { boolean enabled = true; @@ -160,7 +161,7 @@ public class Java2D { if (isOGLPipelineActive) { try { // Try to get methods we need to integrate - Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities"); + final Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities"); invokeWithOGLContextCurrentMethod = utils.getDeclaredMethod("invokeWithOGLContextCurrent", new Class[] { Graphics.class, @@ -208,7 +209,7 @@ public class Java2D { Graphics.class }); getOGLSurfaceTypeMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { fbObjectSupportInitialized = false; if (DEBUG) { e.printStackTrace(); @@ -223,7 +224,7 @@ public class Java2D { Graphics.class }); getOGLTextureTypeMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); System.err.println("Info: GL_ARB_texture_rectangle FBO support disabled"); @@ -236,7 +237,7 @@ public class Java2D { Class<?> cglSurfaceData = null; try { cglSurfaceData = Class.forName("sun.java2d.opengl.CGLSurfaceData"); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); System.err.println("Info: Unable to find class sun.java2d.opengl.CGLSurfaceData for OS X"); @@ -268,7 +269,7 @@ public class Java2D { destroyOGLContextMethod.setAccessible(true); } } - } catch (Exception e) { + } catch (final Exception e) { caught = e; if (DEBUG) { System.err.println("Info: Disabling Java2D/JOGL integration"); @@ -277,9 +278,9 @@ public class Java2D { isOGLPipelineResourceCompatible = false; } } - } catch (HeadlessException e) { + } catch (final HeadlessException e) { // The AWT is running in headless mode, so the Java 2D / JOGL bridge is clearly disabled - } catch (Error e) { + } catch (final Error e) { // issued on OSX Java7: java.lang.Error: Could not find class: sun.awt.HeadlessGraphicsEnvironment caught = e; } @@ -312,9 +313,9 @@ public class Java2D { try { return ((Boolean) isQueueFlusherThreadMethod.invoke(null, (Object[])null)).booleanValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -322,7 +323,7 @@ public class Java2D { /** Makes current the OpenGL context associated with the passed Graphics object and runs the given Runnable on the Queue Flushing Thread in one atomic action. */ - public static void invokeWithOGLContextCurrent(Graphics g, Runnable r) throws GLException { + public static void invokeWithOGLContextCurrent(final Graphics g, final Runnable r) throws GLException { checkActive(); try { @@ -341,9 +342,9 @@ public class Java2D { } finally { AWTUtil.unlockToolkit(); } - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -356,7 +357,7 @@ public class Java2D { JOGL must share textures and display lists with it. Returns false if the passed GraphicsConfiguration was not an OpenGL GraphicsConfiguration. */ - public static boolean invokeWithOGLSharedContextCurrent(GraphicsConfiguration g, Runnable r) throws GLException { + public static boolean invokeWithOGLSharedContextCurrent(final GraphicsConfiguration g, final Runnable r) throws GLException { checkCompatible(); try { @@ -366,9 +367,9 @@ public class Java2D { } finally { AWTUtil.unlockToolkit(); } - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -379,18 +380,18 @@ public class Java2D { call glViewport() with the returned rectangle's bounds in order to get correct rendering results. Should only be called from the Queue Flusher Thread. */ - public static Rectangle getOGLViewport(Graphics g, - int componentWidth, - int componentHeight) { + public static Rectangle getOGLViewport(final Graphics g, + final int componentWidth, + final int componentHeight) { checkCompatible(); try { return (Rectangle) getOGLViewportMethod.invoke(null, new Object[] {g, new Integer(componentWidth), new Integer(componentHeight)}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -401,14 +402,14 @@ public class Java2D { method should be called and the resulting rectangle's bounds passed to a call to glScissor(). Should only be called from the Queue Flusher Thread. */ - public static Rectangle getOGLScissorBox(Graphics g) { + public static Rectangle getOGLScissorBox(final Graphics g) { checkCompatible(); try { return (Rectangle) getOGLScissorBoxMethod.invoke(null, new Object[] {g}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -419,14 +420,14 @@ public class Java2D { changed and a new external GLDrawable and GLContext should be created (and the old ones destroyed). Should only be called from the Queue Flusher Thread.*/ - public static Object getOGLSurfaceIdentifier(Graphics g) { + public static Object getOGLSurfaceIdentifier(final Graphics g) { checkCompatible(); try { return getOGLSurfaceIdentifierMethod.invoke(null, new Object[] {g}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -434,7 +435,7 @@ public class Java2D { /** Returns the underlying surface type for the given Graphics object. This indicates, in particular, whether Java2D is currently rendering into a pbuffer or FBO. */ - public static int getOGLSurfaceType(Graphics g) { + public static int getOGLSurfaceType(final Graphics g) { checkCompatible(); try { @@ -445,9 +446,9 @@ public class Java2D { } return ((Integer) getOGLSurfaceTypeMethod.invoke(null, new Object[] { g })).intValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -455,7 +456,7 @@ public class Java2D { /** Returns the underlying texture target of the given Graphics object assuming it is rendering to an FBO. Returns either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB. */ - public static int getOGLTextureType(Graphics g) { + public static int getOGLTextureType(final Graphics g) { checkCompatible(); if (getOGLTextureTypeMethod == null) { @@ -464,9 +465,9 @@ public class Java2D { try { return ((Integer) getOGLTextureTypeMethod.invoke(null, new Object[] { g })).intValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -477,7 +478,7 @@ public class Java2D { used for rendering. FIXME: may need to alter the API in the future to indicate which GraphicsDevice the source context is associated with. */ - public static GLContext filterShareContext(GLContext shareContext) { + public static GLContext filterShareContext(final GLContext shareContext) { if (isHeadless) return shareContext; @@ -495,7 +496,7 @@ public class Java2D { context", with which all contexts created by JOGL must share textures and display lists when the FBO option is enabled for the Java2D/OpenGL pipeline. */ - public static GLContext getShareContext(GraphicsDevice device) { + public static GLContext getShareContext(final GraphicsDevice device) { initFBOShareContext(device); // FIXME: for full generality probably need to have multiple of // these, one per GraphicsConfiguration seen? @@ -509,41 +510,41 @@ public class Java2D { /** (Mac OS X-specific) Creates a new OpenGL context on the surface associated with the given Graphics object, sharing textures and display lists with the specified (CGLContextObj) share context. */ - public static long createOGLContextOnSurface(Graphics g, long shareCtx) { + public static long createOGLContextOnSurface(final Graphics g, final long shareCtx) { checkCompatible(); try { return ((Long) createOGLContextOnSurfaceMethod.invoke(null, new Object[] { g, new Long(shareCtx) })).longValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } /** (Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object. */ - public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) { + public static boolean makeOGLContextCurrentOnSurface(final Graphics g, final long ctx) { checkCompatible(); try { return ((Boolean) makeOGLContextCurrentOnSurfaceMethod.invoke(null, new Object[] { g, new Long(ctx) })).booleanValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } /** (Mac OS X-specific) Destroys the given OpenGL context. */ - public static void destroyOGLContext(long ctx) { + public static void destroyOGLContext(final long ctx) { checkCompatible(); try { destroyOGLContextMethod.invoke(null, new Object[] { new Long(ctx) }); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -565,15 +566,15 @@ public class Java2D { } private static int getOGLUtilitiesIntField(final String name) { - Integer i = AccessController.doPrivileged(new PrivilegedAction<Integer>() { + final Integer i = AccessController.doPrivileged(new PrivilegedAction<Integer>() { @Override public Integer run() { try { - Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities"); - Field f = utils.getField(name); + final Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities"); + final Field f = utils.getField(name); f.setAccessible(true); return (Integer) f.get(null); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java index 9173a38cb..2f87f01a9 100644 --- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java +++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java @@ -31,12 +31,12 @@ public class VersionApplet extends Applet { TextArea tareaCaps; GLCanvas canvas; - public static void main(String[] args) { - Frame frame = new Frame("JOGL Version Applet"); + public static void main(final String[] args) { + final Frame frame = new Frame("JOGL Version Applet"); frame.setSize(800, 600); frame.setLayout(new BorderLayout()); - VersionApplet va = new VersionApplet(); + final VersionApplet va = new VersionApplet(); frame.addWindowListener(new ClosingWindowAdapter(frame, va)); va.init(); @@ -50,12 +50,12 @@ public class VersionApplet extends Applet { static class ClosingWindowAdapter extends WindowAdapter { Frame f; VersionApplet va; - public ClosingWindowAdapter(Frame f, VersionApplet va) { + public ClosingWindowAdapter(final Frame f, final VersionApplet va) { this.f = f; this.va = va; } @Override - public void windowClosing(WindowEvent ev) { + public void windowClosing(final WindowEvent ev) { f.setVisible(false); va.stop(); va.destroy(); @@ -70,8 +70,8 @@ public class VersionApplet extends Applet { setEnabled(true); - GLProfile glp = GLProfile.getDefault(); - GLCapabilities glcaps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getDefault(); + final GLCapabilities glcaps = new GLCapabilities(glp); setLayout(new BorderLayout()); String s; @@ -96,16 +96,16 @@ public class VersionApplet extends Applet { tareaVersion.append(s); tareaCaps = new TextArea(120, 20); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); - List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); for(int i=0; i<availCaps.size(); i++) { - s = ((GLCapabilitiesImmutable) availCaps.get(i)).toString(); + s = availCaps.get(i).toString(); System.err.println(s); tareaCaps.append(s); tareaCaps.append(Platform.getNewline()); } - Container grid = new Container(); + final Container grid = new Container(); grid.setLayout(new GridLayout(2, 1)); grid.add(tareaVersion); grid.add(tareaCaps); @@ -160,23 +160,23 @@ public class VersionApplet extends Applet { class GLInfo implements GLEventListener { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); - String s = JoglVersion.getGLInfo(gl, null).toString(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + final String s = JoglVersion.getGLInfo(gl, null).toString(); System.err.println(s); tareaVersion.append(s); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } } diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index 7b85c3e75..8c6091273 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -49,18 +49,18 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index da1c8aa47..964401244 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -65,13 +65,13 @@ public class EGLContext extends GLContextImpl { // EGL extension functions. private EGLExtProcAddressTable eglExtProcAddressTable; - EGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + EGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { eglQueryStringInitialized = false; eglQueryStringAvailable = false; eglExtProcAddressTable = null; @@ -140,12 +140,12 @@ public class EGLContext extends GLContextImpl { } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { return 0; // FIXME } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ @@ -175,7 +175,7 @@ public class EGLContext extends GLContextImpl { if( !EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API) ) { throw new GLException("Caught: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError())); } - } catch (GLException glex) { + } catch (final GLException glex) { if (DEBUG) { glex.printStackTrace(); } @@ -272,7 +272,7 @@ public class EGLContext extends GLContextImpl { @Override protected final StringBuilder getPlatformExtensionsStringImpl() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); if (!eglQueryStringInitialized) { eglQueryStringAvailable = getDrawableImpl().getGLDynamicLookupHelper().isFunctionAvailable("eglQueryString"); eglQueryStringInitialized = true; @@ -288,7 +288,7 @@ public class EGLContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) { return false; } @@ -299,11 +299,11 @@ public class EGLContext extends GLContextImpl { // Accessible .. // - /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { + /* pp */ void mapCurrentAvailableGLVersion(final AbstractGraphicsDevice device) { mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } /* pp */ int getContextOptions() { return ctxOptions; } - /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { + /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); @@ -319,7 +319,7 @@ public class EGLContext extends GLContextImpl { } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) { + /* pp */ static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { // ES1, ES2, ES3, .. mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp); @@ -329,28 +329,28 @@ public class EGLContext extends GLContextImpl { } } } - private static void mapStaticGLVersion(AbstractGraphicsDevice device, int reqMajor, int major, int minor, int ctp) { + private static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); GLContext.mapAvailableGLVersion(eglDevice, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); } } - protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } - protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } - protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { GLContext.setAvailableGLVersionsSet(device); } - protected static String toHexString(int hex) { + protected static String toHexString(final int hex) { return GLContext.toHexString(hex); } - protected static String toHexString(long hex) { + protected static String toHexString(final long hex) { return GLContext.toHexString(hex); } @@ -359,17 +359,17 @@ public class EGLContext extends GLContextImpl { // @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { throw new GLException("Not yet implemented"); } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { throw new GLException("Should not call this"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index c5f76f667..9499c70f4 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -75,7 +75,7 @@ public class EGLDisplayUtil { * </p> */ static EGLDisplayRef getOrCreateOpened(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { - EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); + final EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); if( null == o ) { if( EGL.eglInitialize(eglDisplay, major, minor) ) { final EGLDisplayRef n = new EGLDisplayRef(eglDisplay); @@ -123,7 +123,7 @@ public class EGLDisplayUtil { return o; } - private EGLDisplayRef(long eglDisplay) { + private EGLDisplayRef(final long eglDisplay) { this.eglDisplay = eglDisplay; this.initRefCount = 0; this.createdStack = DEBUG ? new Throwable() : null; @@ -144,7 +144,7 @@ public class EGLDisplayUtil { /** * @return number of unclosed EGL Displays.<br> */ - public static int shutdown(boolean verbose) { + public static int shutdown(final boolean verbose) { if(DEBUG || verbose || openEGLDisplays.size() > 0 ) { System.err.println("EGLDisplayUtil.EGLDisplays: Shutdown (open: "+openEGLDisplays.size()+")"); if(DEBUG) { @@ -160,7 +160,7 @@ public class EGLDisplayUtil { public static void dumpOpenDisplayConnections() { System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+openEGLDisplays.size()); int i=0; - for(Iterator<LongObjectHashMap.Entry> iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { + for(final Iterator<LongObjectHashMap.Entry> iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { final LongObjectHashMap.Entry e = iter.next(); final EGLDisplayRef v = (EGLDisplayRef) e.value; System.err.println("EGLDisplayUtil: Open["+i+"]: 0x"+Long.toHexString(e.key)+": "+v); @@ -170,9 +170,9 @@ public class EGLDisplayUtil { } } - /* pp */ static synchronized void setSingletonEGLDisplayOnly(boolean v) { useSingletonEGLDisplay = v; } + /* pp */ static synchronized void setSingletonEGLDisplayOnly(final boolean v) { useSingletonEGLDisplay = v; } - private static synchronized long eglGetDisplay(long nativeDisplay_id) { + private static synchronized long eglGetDisplay(final long nativeDisplay_id) { if( useSingletonEGLDisplay && null != singletonEGLDisplay ) { if(DEBUG) { System.err.println("EGLDisplayUtil.eglGetDisplay.s: eglDisplay("+EGLContext.toHexString(nativeDisplay_id)+"): "+ @@ -198,7 +198,7 @@ public class EGLDisplayUtil { * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { + private static synchronized boolean eglInitialize(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -222,7 +222,7 @@ public class EGLDisplayUtil { * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized int eglGetDisplayAndInitialize(long nativeDisplayID, long[] eglDisplay, int[] eglErr, IntBuffer major, IntBuffer minor) { + private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final IntBuffer major, final IntBuffer minor) { eglDisplay[0] = EGL.EGL_NO_DISPLAY; final long _eglDisplay = eglGetDisplay( nativeDisplayID ); if ( EGL.EGL_NO_DISPLAY == _eglDisplay ) { @@ -247,7 +247,7 @@ public class EGLDisplayUtil { * @return the initialized EGL display ID * @throws GLException if not successful */ - private static synchronized long eglGetDisplayAndInitialize(long[] nativeDisplayID) { + private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID) { final long[] eglDisplay = new long[1]; final int[] eglError = new int[1]; int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, null, null); @@ -271,7 +271,7 @@ public class EGLDisplayUtil { * @param eglDisplay the EGL display handle * @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false */ - private static synchronized boolean eglTerminate(long eglDisplay) { + private static synchronized boolean eglTerminate(final long eglDisplay) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -286,11 +286,11 @@ public class EGLDisplayUtil { private static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { @Override - public long eglGetAndInitDisplay(long[] nativeDisplayID) { + public long eglGetAndInitDisplay(final long[] nativeDisplayID) { return eglGetDisplayAndInitialize(nativeDisplayID); } @Override - public void eglTerminate(long eglDisplayHandle) { + public void eglTerminate(final long eglDisplayHandle) { EGLDisplayUtil.eglTerminate(eglDisplayHandle); } }; @@ -309,7 +309,7 @@ public class EGLDisplayUtil { * @param unitID * @return an uninitialized {@link EGLGraphicsDevice} */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final long nativeDisplayID, final String connection, final int unitID) { return new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback); } @@ -325,7 +325,7 @@ public class EGLDisplayUtil { * @param surface * @return an uninitialized EGLGraphicsDevice */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final NativeSurface surface) { final long nativeDisplayID; if( NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false) ) { nativeDisplayID = surface.getSurfaceHandle(); // don't even ask .. diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 76c6e5beb..bacf9f18e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -52,7 +52,7 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public abstract class EGLDrawable extends GLDrawableImpl { - protected EGLDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException { + protected EGLDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { super(factory, component, false); } @@ -131,7 +131,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } } - protected static boolean isValidEGLSurface(long eglDisplayHandle, long surfaceHandle) { + protected static boolean isValidEGLSurface(final long eglDisplayHandle, final long surfaceHandle) { if( 0 == surfaceHandle ) { return false; } @@ -154,7 +154,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) surface.getGraphicsConfiguration().getScreen().getDevice(); // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers() diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index e50cb7262..71e5afe33 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -65,6 +65,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; @@ -77,6 +78,7 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; @@ -88,14 +90,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { static { Debug.initSingleton(); - QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); + QUERY_EGL_ES_NATIVE_TK = PropertyAccess.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; - private static final boolean isANGLE(GLDynamicLookupHelper dl) { - if(Platform.OSType.WINDOWS == Platform.OS_TYPE) { + private static final boolean isANGLE(final GLDynamicLookupHelper dl) { + if(Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE) { return dl.isFunctionAvailable("eglQuerySurfacePointerANGLE") || dl.isFunctionAvailable("glBlitFramebufferANGLE") || dl.isFunctionAvailable("glRenderbufferStorageMultisampleANGLE"); @@ -104,7 +106,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private static final boolean includesES1(GLDynamicLookupHelper dl) { + private static final boolean includesES1(final GLDynamicLookupHelper dl) { return dl.isFunctionAvailable("glLoadIdentity") && dl.isFunctionAvailable("glEnableClientState") && dl.isFunctionAvailable("glColorPointer"); @@ -122,7 +124,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { hasX11 = true; try { ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } // FIXME: Probably need to move EGL from a static model @@ -136,7 +138,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -157,7 +159,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -214,9 +216,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(DEBUG) { dumpMap(); } - Collection<SharedResource> srl = sharedMap.values(); - for(Iterator<SharedResource> sri = srl.iterator(); sri.hasNext(); ) { - SharedResource sr = sri.next(); + final Collection<SharedResource> srl = sharedMap.values(); + for(final Iterator<SharedResource> sri = srl.iterator(); sri.hasNext(); ) { + final SharedResource sr = sri.next(); if(DEBUG) { System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString()); } @@ -253,10 +255,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { synchronized(sharedMap) { System.err.println("EGLDrawableFactory.map "+sharedMap.size()); int i=0; - Set<String> keys = sharedMap.keySet(); - for(Iterator<String> keyI = keys.iterator(); keyI.hasNext(); i++) { - String key = keyI.next(); - SharedResource sr = sharedMap.get(key); + final Set<String> keys = sharedMap.keySet(); + for(final Iterator<String> keyI = keys.iterator(); keyI.hasNext(); i++) { + final String key = keyI.next(); + final SharedResource sr = sharedMap.get(key); System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", "+ "es1 [avail "+sr.wasES1ContextCreated+", pbuffer "+sr.hasPBufferES1+", quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+ "es2/3 [es2 "+sr.wasES2ContextCreated+", es3 "+sr.wasES3ContextCreated+", [pbuffer "+sr.hasPBufferES3ES2+", quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]]"); @@ -287,10 +289,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private final boolean hasPBufferES1; private final boolean hasPBufferES3ES2; - SharedResource(EGLGraphicsDevice dev, - boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, - boolean wasContextES2Created, boolean wasContextES3Created, - boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) { + SharedResource(final EGLGraphicsDevice dev, + final boolean wasContextES1Created, final boolean hasPBufferES1, final GLRendererQuirks rendererQuirksES1, final int ctpES1, + final boolean wasContextES2Created, final boolean wasContextES3Created, + final boolean hasPBufferES3ES2, final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) { this.device = dev; // this.contextES1 = ctxES1; this.wasES1ContextCreated = wasContextES1Created; @@ -340,12 +342,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types. return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper; } - private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(EGLGraphicsDevice eglDisplay, GLCapabilitiesImmutable caps) { + private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) { final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) { throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError())); @@ -368,8 +370,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { System.err.println(prefix+"EGL vendor "+eglVendor+", version "+eglVersion+", clientAPIs "+eglClientAPIs); } - private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int[] esProfile, - boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) { + private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, final int[] esProfile, + final boolean[] hasPBuffer, final GLRendererQuirks[] rendererQuirks, final int[] ctp) { final String profileString; switch( esProfile[0] ) { case 3: @@ -532,7 +534,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } } - } catch (Throwable t) { + } catch (final Throwable t) { if (DEBUG) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: context create/makeCurrent failed"); t.printStackTrace(); @@ -543,7 +545,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } drawable.setRealized(false); } - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); @@ -565,7 +567,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return success; } - private final boolean needsToCreateSharedResource(String key, SharedResource[] existing) { + private final boolean needsToCreateSharedResource(final String key, final SharedResource[] existing) { synchronized(sharedMap) { final SharedResource sr = sharedMap.get(key); if( null == sr ) { @@ -584,7 +586,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return null; } @@ -617,16 +619,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) { + private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { final boolean madeCurrentES1; - boolean[] hasPBufferES1 = new boolean[] { false }; - boolean[] hasPBufferES3ES2 = new boolean[] { false }; + final boolean[] hasPBufferES1 = new boolean[] { false }; + final boolean[] hasPBufferES3ES2 = new boolean[] { false }; // EGLContext[] eglCtxES1 = new EGLContext[] { null }; // EGLContext[] eglCtxES2 = new EGLContext[] { null }; - GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; - GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; - int[] ctpES1 = new int[] { -1 }; - int[] ctpES3ES2 = new int[] { -1 }; + final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; + final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; + final int[] ctpES1 = new int[] { -1 }; + final int[] ctpES3ES2 = new int[] { -1 }; if (DEBUG) { @@ -682,7 +684,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return sr; } - private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) { + private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) { if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); } @@ -698,7 +700,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) { if ( 2==esProfile || 3==esProfile ) { return eglES2DynamicLookupHelper; } else if (1==esProfile) { @@ -709,7 +711,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return new ArrayList<GLCapabilitiesImmutable>(); // null } @@ -717,7 +719,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -725,12 +727,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { throw new GLException("Non pbuffer not yet implemented"); } @@ -739,16 +741,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { // SharedResource sr = getOrCreateEGLSharedResource(device); // return sr.hasES1PBuffer() || sr.hasES2PBuffer(); return true; } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; if( createNewDevice || ! (deviceReq instanceof EGLGraphicsDevice) ) { @@ -770,8 +772,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } @@ -782,10 +784,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { * @param useTexture * @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle */ - protected static MutableSurface createPBufferSurfaceImpl(MutableSurface ms, boolean useTexture) { + protected static MutableSurface createPBufferSurfaceImpl(final MutableSurface ms, final boolean useTexture) { return null; } - protected static long createPBufferSurfaceImpl(EGLGraphicsConfiguration config, int width, int height, boolean useTexture) { + protected static long createPBufferSurfaceImpl(final EGLGraphicsConfiguration config, final int width, final int height, final boolean useTexture) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) config.getScreen().getDevice(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int texFormat; @@ -811,7 +813,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq; final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID()); device.open(); @@ -822,12 +824,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { @Override protected GLContext createExternalGLContextImpl() { - AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); + final AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); return new EGLExternalContext(absScreen); } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 205a94951..f00d7059d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -17,12 +17,12 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public EGLDummyUpstreamSurfaceHook(int width, int height) { + public EGLDummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); eglDevice.lock(); try { @@ -41,7 +41,7 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index ebe8f49c8..05dae0b9d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -33,6 +33,7 @@ import com.jogamp.common.os.Platform; import java.util.*; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.*; /** @@ -61,7 +62,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle */ @Override public final boolean shallLookupGlobal() { - if ( Platform.OSType.ANDROID == Platform.OS_TYPE ) { + if ( Platform.OSType.ANDROID == PlatformPropsImpl.OS_TYPE ) { // Android requires global symbol lookup return true; } @@ -71,18 +72,18 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { if ( AndroidVersion.isAvailable ) { // Android requires global dlsym lookup return false; @@ -92,7 +93,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle } protected final List<String> getEGLLibNamesList() { - List<String> eglLibNames = new ArrayList<String>(); + final List<String> eglLibNames = new ArrayList<String>(); // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java index aff18fc81..babea4240 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java @@ -43,7 +43,7 @@ import javax.media.nativewindow.*; public class EGLExternalContext extends EGLContext { - public EGLExternalContext(AbstractGraphicsScreen screen) { + public EGLExternalContext(final AbstractGraphicsScreen screen) { super(null, null); GLContextShareSet.contextCreated(this); if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_ES, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index e28b53235..a8dd7d5c8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -52,7 +52,7 @@ public class EGLGLCapabilities extends GLCapabilities { * * May throw GLException if given GLProfile is not compatible w/ renderableType */ - public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) { + public EGLGLCapabilities(final long eglcfg, final int eglcfgid, final int visualID, final GLProfile glp, final int renderableType) { super( glp ); this.eglcfg = eglcfg; this.eglcfgid = eglcfgid; @@ -73,19 +73,19 @@ public class EGLGLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } - final protected void setEGLConfig(long v) { eglcfg=v; } + final protected void setEGLConfig(final long v) { eglcfg=v; } final public long getEGLConfig() { return eglcfg; } final public int getEGLConfigID() { return eglcfgid; } final public int getRenderableType() { return renderableType; } final public int getNativeVisualID() { return nativeVisualID; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case EGL_CONFIG: @@ -97,7 +97,7 @@ public class EGLGLCapabilities extends GLCapabilities { } } - public static boolean isCompatible(GLProfile glp, int renderableType) { + public static boolean isCompatible(final GLProfile glp, final int renderableType) { if(null == glp) { return true; } @@ -116,7 +116,7 @@ public class EGLGLCapabilities extends GLCapabilities { return false; } - public static GLProfile getCompatible(EGLGraphicsDevice device, int renderableType) { + public static GLProfile getCompatible(final EGLGraphicsDevice device, final int renderableType) { if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && GLProfile.isAvailable(device, GLProfile.GLES3)) { return GLProfile.get(device, GLProfile.GLES3); } @@ -132,7 +132,7 @@ public class EGLGLCapabilities extends GLCapabilities { return null; } - public static StringBuilder renderableTypeToString(StringBuilder sink, int renderableType) { + public static StringBuilder renderableTypeToString(StringBuilder sink, final int renderableType) { if(null == sink) { sink = new StringBuilder(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 88ed0be92..1d90e63af 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -72,8 +72,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID(); } - EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, - EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + EGLGraphicsConfiguration(final AbstractGraphicsScreen absScreen, + final EGLGLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(absScreen, capsChosen, capsRequested); this.chooser = chooser; } @@ -85,7 +85,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @return * @throws GLException if invalid EGL display. */ - public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) { + public static EGLGraphicsConfiguration create(final GLCapabilitiesImmutable capsRequested, final AbstractGraphicsScreen absScreen, final int eglConfigID) { final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); @@ -110,8 +110,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } void updateGraphicsConfiguration() { - CapabilitiesImmutable capsChosen = getChosenCapabilities(); - EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) + final CapabilitiesImmutable capsChosen = getChosenCapabilities(); + final EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration( capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); if(null!=newConfig) { @@ -123,7 +123,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } } - public static long EGLConfigId2EGLConfig(long display, int configID) { + public static long EGLConfigId2EGLConfig(final long display, final int configID) { final IntBuffer attrs = Buffers.newDirectIntBuffer(new int[] { EGL.EGL_CONFIG_ID, configID, EGL.EGL_NONE @@ -142,7 +142,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return configs.get(0); } - public static boolean isEGLConfigValid(long display, long config) { + public static boolean isEGLConfigValid(final long display, final long config) { if(0 == config) { return false; } @@ -190,8 +190,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @param forceTransparentFlag * @return */ - public static EGLGLCapabilities EGLConfig2Capabilities(GLRendererQuirks defaultQuirks, EGLGraphicsDevice device, GLProfile glp, - long config, int winattrmask, boolean forceTransparentFlag) { + public static EGLGLCapabilities EGLConfig2Capabilities(final GLRendererQuirks defaultQuirks, final EGLGraphicsDevice device, GLProfile glp, + final long config, final int winattrmask, final boolean forceTransparentFlag) { final long display = device.getHandle(); final int cfgID; final int rType; @@ -267,7 +267,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return null; } caps = new EGLGLCapabilities(config, cfgID, visualID, glp, rType); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("config "+toHexString(config)+": "+gle); } @@ -381,7 +381,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) { + public static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps) { final IntBuffer attrs = Buffers.newDirectIntBuffer(32); int idx=0; @@ -480,8 +480,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return attrs; } - public static IntBuffer CreatePBufferSurfaceAttribList(int width, int height, int texFormat) { - IntBuffer attrs = Buffers.newDirectIntBuffer(16); + public static IntBuffer CreatePBufferSurfaceAttribList(final int width, final int height, final int texFormat) { + final IntBuffer attrs = Buffers.newDirectIntBuffer(16); int idx=0; attrs.put(idx++, EGL.EGL_WIDTH); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 5cfa378cb..9962c0617 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -77,7 +77,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; static void registerFactory() { - GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); + final GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); // become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected final String nwType = NativeWindowFactory.getNativeWindowType(false); @@ -117,8 +117,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl ( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen == null) { throw new IllegalArgumentException("This NativeWindowFactory accepts only AbstractGraphicsDevice objects"); } @@ -137,7 +137,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -181,7 +181,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return cfg; } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final EGLDrawableFactory factory, final AbstractGraphicsDevice device) { final EGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -192,7 +192,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("null eglDisplay"); } List<GLCapabilitiesImmutable> availableCaps = null; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -201,7 +201,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) no configs"); } - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs)) { throw new GLException("Graphics configuration get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -216,10 +216,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, int nativeVisualID, - boolean forceTransparentFlag) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final int nativeVisualID, + final boolean forceTransparentFlag) { if (capsChosen == null) { capsChosen = new GLCapabilities(null); } @@ -227,7 +227,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null==absScreen) { throw new GLException("Null AbstractGraphicsScreen"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -323,18 +323,18 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } - static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, - int nativeVisualID, boolean forceTransparentFlag) { + static EGLGraphicsConfiguration eglChooseConfig(final EGLGraphicsDevice device, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, + final int nativeVisualID, final boolean forceTransparentFlag) { final long eglDisplay = device.getHandle(); final GLProfile glp = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen); List<GLCapabilitiesImmutable> availableCaps = null; int recommendedIndex = -1; long recommendedEGLConfig = -1; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -353,7 +353,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen); - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); // 1st choice: get GLCapabilities based on users GLCapabilities // setting recommendedIndex as preferred choice @@ -428,7 +428,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) { // implies !hasEGLChosenCaps - List<GLCapabilitiesImmutable> removedCaps = new ArrayList<GLCapabilitiesImmutable>(); + final List<GLCapabilitiesImmutable> removedCaps = new ArrayList<GLCapabilitiesImmutable>(); for(int i=0; i<availableCaps.size(); ) { final GLCapabilitiesImmutable aCap = availableCaps.get(i); if(aCap.getVisualID(VIDType.NATIVE) != nativeVisualID) { @@ -475,9 +475,9 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return res; } - static List<GLCapabilitiesImmutable> eglConfigs2GLCaps(EGLGraphicsDevice device, GLProfile glp, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag, boolean onlyFirstValid) { + static List<GLCapabilitiesImmutable> eglConfigs2GLCaps(final EGLGraphicsDevice device, final GLProfile glp, final PointerBuffer configs, final int num, final int winattrmask, final boolean forceTransparentFlag, final boolean onlyFirstValid) { final GLRendererQuirks defaultQuirks = GLRendererQuirks.getStickyDeviceQuirks( GLDrawableFactory.getEGLFactory().getDefaultDevice() ); - List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(num); + final List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(num); for(int i=0; i<num; i++) { final GLCapabilitiesImmutable caps = EGLGraphicsConfiguration.EGLConfig2Capabilities(defaultQuirks, device, glp, configs.get(i), winattrmask, forceTransparentFlag); if(null != caps) { @@ -490,7 +490,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return bucket; } - static void printCaps(String prefix, List<GLCapabilitiesImmutable> caps, PrintStream out) { + static void printCaps(final String prefix, final List<GLCapabilitiesImmutable> caps, final PrintStream out) { for(int i=0; i<caps.size(); i++) { out.println(prefix+"["+i+"] "+caps.get(i)); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java index 065f80dcb..4c018fe25 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java @@ -44,17 +44,17 @@ import javax.media.opengl.*; import javax.media.nativewindow.*; public class EGLOnscreenDrawable extends EGLDrawable { - protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException { + protected EGLOnscreenDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { super(factory, component); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new EGLContext(this, shareWith); } @Override - protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { + protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) { return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java index 45e39f5d1..8842edbc0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java @@ -46,17 +46,17 @@ import javax.media.opengl.GLContext; public class EGLPbufferDrawable extends EGLDrawable { protected static final boolean useTexture = false; // No yet .. - protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) { + protected EGLPbufferDrawable(final EGLDrawableFactory factory, final NativeSurface target) { super(factory, target); } @Override - protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { + protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) { return EGLDrawableFactory.createPBufferSurfaceImpl(config, width, height, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new EGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index 052872122..305899fff 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -25,7 +25,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { private final NativeSurface upstreamSurface; private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; - public EGLUpstreamSurfaceHook(NativeSurface upstream) { + public EGLUpstreamSurfaceHook(final NativeSurface upstream) { upstreamSurface = upstream; if(upstreamSurface instanceof ProxySurface) { final UpstreamSurfaceHook ush = ((ProxySurface)upstreamSurface).getUpstreamSurfaceHook(); @@ -52,14 +52,14 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { public final NativeSurface getUpstreamSurface() { return upstreamSurface; } @Override - public final void setSurfaceSize(int width, int height) { + public final void setSurfaceSize(final int width, final int height) { if(null != upstreamSurfaceHookMutableSize) { upstreamSurfaceHookMutableSize.setSurfaceSize(width, height); } } @Override - public final void create(ProxySurface surface) { + public final void create(final ProxySurface surface) { final String dbgPrefix; if(DEBUG) { dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create( up "+upstreamSurface.getClass().getSimpleName()+" -> this "+surface.getClass().getSimpleName()+" ): "; @@ -84,7 +84,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } } - private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) { + private final void evalUpstreamSurface(final String dbgPrefix, final ProxySurface surface) { // // evaluate nature of upstreamSurface, may create EGL instances if required // @@ -195,7 +195,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final void destroy(ProxySurface surface) { + public final void destroy(final ProxySurface surface) { if(EGLDrawableFactory.DEBUG) { System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } @@ -206,12 +206,12 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return upstreamSurface.getSurfaceWidth(); } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return upstreamSurface.getSurfaceHeight(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java index 4a5113b51..89024eed3 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java @@ -13,14 +13,14 @@ import jogamp.nativewindow.WrappedSurface; */ public class EGLWrappedSurface extends WrappedSurface { - public static EGLWrappedSurface get(NativeSurface surface) { + public static EGLWrappedSurface get(final NativeSurface surface) { if(surface instanceof EGLWrappedSurface) { return (EGLWrappedSurface)surface; } return new EGLWrappedSurface(surface); } - public EGLWrappedSurface(NativeSurface surface) { + public EGLWrappedSurface(final NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLWrappedSurface.ctor(): "+this); diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java index e0ec0f401..f0922644b 100644 --- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java +++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java @@ -190,7 +190,7 @@ public class ProjectDouble { upBuf = slice(locbuf, pos, sz); } - private static DoubleBuffer slice(DoubleBuffer buf, int pos, int len) { + private static DoubleBuffer slice(final DoubleBuffer buf, final int pos, final int len) { buf.position(pos); buf.limit(pos + len); return buf.slice(); @@ -199,8 +199,8 @@ public class ProjectDouble { /** * Make matrix an identity matrix */ - private void __gluMakeIdentityd(DoubleBuffer m) { - int oldPos = m.position(); + private void __gluMakeIdentityd(final DoubleBuffer m) { + final int oldPos = m.position(); m.put(IDENTITY_MATRIX); m.position(oldPos); } @@ -208,7 +208,7 @@ public class ProjectDouble { /** * Make matrix an identity matrix */ - private void __gluMakeIdentityd(double[] m) { + private void __gluMakeIdentityd(final double[] m) { for (int i = 0; i < 16; i++) { m[i] = IDENTITY_MATRIX[i]; } @@ -221,7 +221,7 @@ public class ProjectDouble { * @param in * @param out */ - private void __gluMultMatrixVecd(double[] matrix, int matrix_offset, double[] in, double[] out) { + private void __gluMultMatrixVecd(final double[] matrix, final int matrix_offset, final double[] in, final double[] out) { for (int i = 0; i < 4; i++) { out[i] = in[0] * matrix[0*4+i+matrix_offset] + @@ -238,10 +238,10 @@ public class ProjectDouble { * @param in * @param out */ - private void __gluMultMatrixVecd(DoubleBuffer matrix, DoubleBuffer in, DoubleBuffer out) { - int inPos = in.position(); - int outPos = out.position(); - int matrixPos = matrix.position(); + private void __gluMultMatrixVecd(final DoubleBuffer matrix, final DoubleBuffer in, final DoubleBuffer out) { + final int inPos = in.position(); + final int outPos = out.position(); + final int matrixPos = matrix.position(); for (int i = 0; i < 4; i++) { out.put(i + outPos, in.get(0+inPos) * matrix.get(0*4+i+matrixPos) + @@ -257,10 +257,10 @@ public class ProjectDouble { * * @return */ - private boolean __gluInvertMatrixd(double[] src, double[] inverse) { + private boolean __gluInvertMatrixd(final double[] src, final double[] inverse) { int i, j, k, swap; double t; - double[][] temp = tempMatrix; + final double[][] temp = tempMatrix; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { @@ -327,14 +327,14 @@ public class ProjectDouble { * * @return */ - private boolean __gluInvertMatrixd(DoubleBuffer src, DoubleBuffer inverse) { + private boolean __gluInvertMatrixd(final DoubleBuffer src, final DoubleBuffer inverse) { int i, j, k, swap; double t; - int srcPos = src.position(); - int invPos = inverse.position(); + final int srcPos = src.position(); + final int invPos = inverse.position(); - DoubleBuffer temp = tempMatrixBuf; + final DoubleBuffer temp = tempMatrixBuf; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { @@ -401,7 +401,7 @@ public class ProjectDouble { * @param b * @param r */ - private void __gluMultMatricesd(double[] a, int a_offset, double[] b, int b_offset, double[] r) { + private void __gluMultMatricesd(final double[] a, final int a_offset, final double[] b, final int b_offset, final double[] r) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { r[i*4+j] = @@ -419,10 +419,10 @@ public class ProjectDouble { * @param b * @param r */ - private void __gluMultMatricesd(DoubleBuffer a, DoubleBuffer b, DoubleBuffer r) { - int aPos = a.position(); - int bPos = b.position(); - int rPos = r.position(); + private void __gluMultMatricesd(final DoubleBuffer a, final DoubleBuffer b, final DoubleBuffer r) { + final int aPos = a.position(); + final int bPos = b.position(); + final int rPos = r.position(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { @@ -440,10 +440,10 @@ public class ProjectDouble { * * @param v */ - private static void normalize(DoubleBuffer v) { + private static void normalize(final DoubleBuffer v) { double r; - int vPos = v.position(); + final int vPos = v.position(); r = Math.sqrt(v.get(0+vPos) * v.get(0+vPos) + v.get(1+vPos) * v.get(1+vPos) + @@ -468,10 +468,10 @@ public class ProjectDouble { * @param v2 * @param result */ - private static void cross(DoubleBuffer v1, DoubleBuffer v2, DoubleBuffer result) { - int v1Pos = v1.position(); - int v2Pos = v2.position(); - int rPos = result.position(); + private static void cross(final DoubleBuffer v1, final DoubleBuffer v2, final DoubleBuffer result) { + final int v1Pos = v1.position(); + final int v2Pos = v2.position(); + final int rPos = result.position(); result.put(0+rPos, v1.get(1+v1Pos) * v2.get(2+v2Pos) - v1.get(2+v1Pos) * v2.get(1+v2Pos)); result.put(1+rPos, v1.get(2+v1Pos) * v2.get(0+v2Pos) - v1.get(0+v1Pos) * v2.get(2+v2Pos)); @@ -486,7 +486,7 @@ public class ProjectDouble { * @param bottom * @param top */ - public void gluOrtho2D(GL2 gl, double left, double right, double bottom, double top) { + public void gluOrtho2D(final GL2 gl, final double left, final double right, final double bottom, final double top) { gl.glOrtho(left, right, bottom, top, -1, 1); } @@ -498,9 +498,9 @@ public class ProjectDouble { * @param zNear * @param zFar */ - public void gluPerspective(GL2 gl, double fovy, double aspect, double zNear, double zFar) { + public void gluPerspective(final GL2 gl, final double fovy, final double aspect, final double zNear, final double zFar) { double sine, cotangent, deltaZ; - double radians = fovy / 2 * Math.PI / 180; + final double radians = fovy / 2 * Math.PI / 180; deltaZ = zFar - zNear; sine = Math.sin(radians); @@ -536,19 +536,19 @@ public class ProjectDouble { * @param upy * @param upz */ - public void gluLookAt(GL2 gl, - double eyex, - double eyey, - double eyez, - double centerx, - double centery, - double centerz, - double upx, - double upy, - double upz) { - DoubleBuffer forward = this.forwardBuf; - DoubleBuffer side = this.sideBuf; - DoubleBuffer up = this.upBuf; + public void gluLookAt(final GL2 gl, + final double eyex, + final double eyey, + final double eyez, + final double centerx, + final double centery, + final double centerz, + final double upx, + final double upy, + final double upz) { + final DoubleBuffer forward = this.forwardBuf; + final DoubleBuffer side = this.sideBuf; + final DoubleBuffer up = this.upBuf; forward.put(0, centerx - eyex); forward.put(1, centery - eyey); @@ -597,20 +597,20 @@ public class ProjectDouble { * * @return */ - public boolean gluProject(double objx, - double objy, - double objz, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double[] win_pos, - int win_pos_offset ) { - - double[] in = this.in; - double[] out = this.out; + public boolean gluProject(final double objx, + final double objy, + final double objz, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double[] win_pos, + final int win_pos_offset ) { + + final double[] in = this.in; + final double[] out = this.out; in[0] = objx; in[1] = objy; @@ -651,16 +651,16 @@ public class ProjectDouble { * * @return */ - public boolean gluProject(double objx, - double objy, - double objz, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - DoubleBuffer win_pos) { + public boolean gluProject(final double objx, + final double objy, + final double objz, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final DoubleBuffer win_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; in.put(0, objx); in.put(1, objy); @@ -681,8 +681,8 @@ public class ProjectDouble { in.put(2, in.get(2) * in.get(3) + 0.5f); // Map x,y to viewport - int vPos = viewport.position(); - int wPos = win_pos.position(); + final int vPos = viewport.position(); + final int wPos = win_pos.position(); win_pos.put(0+wPos, in.get(0) * viewport.get(2+vPos) + viewport.get(0+vPos)); win_pos.put(1+wPos, in.get(1) * viewport.get(3+vPos) + viewport.get(1+vPos)); win_pos.put(2+wPos, in.get(2)); @@ -704,19 +704,19 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject(double winx, - double winy, - double winz, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double[] obj_pos, - int obj_pos_offset) { - double[] in = this.in; - double[] out = this.out; + public boolean gluUnProject(final double winx, + final double winy, + final double winz, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double[] obj_pos, + final int obj_pos_offset) { + final double[] in = this.in; + final double[] out = this.out; __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix); @@ -765,15 +765,15 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject(double winx, - double winy, - double winz, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - DoubleBuffer obj_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + public boolean gluUnProject(final double winx, + final double winy, + final double winz, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final DoubleBuffer obj_pos) { + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; __gluMultMatricesd(modelMatrix, projMatrix, matrixBuf); @@ -786,8 +786,8 @@ public class ProjectDouble { in.put(3, 1.0); // Map x and y from window coordinates - int vPos = viewport.position(); - int oPos = obj_pos.position(); + final int vPos = viewport.position(); + final int oPos = obj_pos.position(); in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos)); in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos)); @@ -827,22 +827,22 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject4(double winx, - double winy, - double winz, - double clipw, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double near, - double far, - double[] obj_pos, - int obj_pos_offset ) { - double[] in = this.in; - double[] out = this.out; + public boolean gluUnProject4(final double winx, + final double winy, + final double winz, + final double clipw, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double near, + final double far, + final double[] obj_pos, + final int obj_pos_offset ) { + final double[] in = this.in; + final double[] out = this.out; __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix); @@ -892,18 +892,18 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject4(double winx, - double winy, - double winz, - double clipw, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - double near, - double far, - DoubleBuffer obj_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + public boolean gluUnProject4(final double winx, + final double winy, + final double winz, + final double clipw, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final double near, + final double far, + final DoubleBuffer obj_pos) { + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; __gluMultMatricesd(modelMatrix, projMatrix, matrixBuf); @@ -916,7 +916,7 @@ public class ProjectDouble { in.put(3, clipw); // Map x and y from window coordinates - int vPos = viewport.position(); + final int vPos = viewport.position(); in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos)); in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos)); in.put(2, (in.get(2) - near) / (far - near)); @@ -931,7 +931,7 @@ public class ProjectDouble { if (out.get(3) == 0.0) return false; - int oPos = obj_pos.position(); + final int oPos = obj_pos.position(); obj_pos.put(0+oPos, out.get(0)); obj_pos.put(1+oPos, out.get(1)); obj_pos.put(2+oPos, out.get(2)); @@ -949,18 +949,18 @@ public class ProjectDouble { * @param deltaY * @param viewport */ - public void gluPickMatrix(GL2 gl, - double x, - double y, - double deltaX, - double deltaY, - IntBuffer viewport) { + public void gluPickMatrix(final GL2 gl, + final double x, + final double y, + final double deltaX, + final double deltaY, + final IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ - int vPos = viewport.position(); + final int vPos = viewport.position(); gl.glTranslated((viewport.get(2+vPos) - 2 * (x - viewport.get(0+vPos))) / deltaX, (viewport.get(3+vPos) - 2 * (y - viewport.get(1+vPos))) / deltaY, 0); @@ -977,13 +977,13 @@ public class ProjectDouble { * @param viewport * @param viewport_offset */ - public void gluPickMatrix(GL2 gl, - double x, - double y, - double deltaX, - double deltaY, - int[] viewport, - int viewport_offset) { + public void gluPickMatrix(final GL2 gl, + final double x, + final double y, + final double deltaX, + final double deltaY, + final int[] viewport, + final int viewport_offset) { if (deltaX <= 0 || deltaY <= 0) { return; } diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 717b1255c..977881e6b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -132,7 +132,7 @@ import com.jogamp.opengl.util.glsl.ShaderState; */ public class GLUquadricImpl implements GLUquadric { - private boolean useGLSL; + private final boolean useGLSL; private int drawStyle; private int orientation; private boolean textureFlag; @@ -149,7 +149,7 @@ public class GLUquadricImpl implements GLUquadric { private ImmModeSink immModeSink=null; - public GLUquadricImpl(GL gl, boolean useGLSL, ShaderState st, int shaderProgram) { + public GLUquadricImpl(final GL gl, final boolean useGLSL, final ShaderState st, final int shaderProgram) { this.gl=gl; this.useGLSL = useGLSL; this.drawStyle = GLU.GLU_FILL; @@ -165,7 +165,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void enableImmModeSink(boolean val) { + public void enableImmModeSink(final boolean val) { if(gl.isGL2()) { immModeSinkEnabled=val; } else { @@ -182,7 +182,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void setImmMode(boolean val) { + public void setImmMode(final boolean val) { if(immModeSinkEnabled) { immModeSinkImmediate=val; } else { @@ -199,7 +199,7 @@ public class GLUquadricImpl implements GLUquadric { public ImmModeSink replaceImmModeSink() { if(!immModeSinkEnabled) return null; - ImmModeSink res = immModeSink; + final ImmModeSink res = immModeSink; if(useGLSL) { if(null != shaderState) { immModeSink = ImmModeSink.createGLSL (32, @@ -228,7 +228,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void resetImmModeSink(GL gl) { + public void resetImmModeSink(final GL gl) { if(immModeSinkEnabled) { immModeSink.reset(gl); } @@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param drawStyle The drawStyle to set */ - public void setDrawStyle(int drawStyle) { + public void setDrawStyle(final int drawStyle) { this.drawStyle = drawStyle; } @@ -269,7 +269,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param normals The normals to set */ - public void setNormals(int normals) { + public void setNormals(final int normals) { this.normals = normals; } @@ -286,7 +286,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param orientation The orientation to set */ - public void setOrientation(int orientation) { + public void setOrientation(final int orientation) { this.orientation = orientation; } @@ -301,7 +301,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param textureFlag The textureFlag to set */ - public void setTextureFlag(boolean textureFlag) { + public void setTextureFlag(final boolean textureFlag) { this.textureFlag = textureFlag; } @@ -363,7 +363,7 @@ public class GLUquadricImpl implements GLUquadric { * @param slices Specifies the number of subdivisions around the z axis. * @param stacks Specifies the number of subdivisions along the z axis. */ - public void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) { + public void drawCylinder(final GL gl, final float baseRadius, final float topRadius, final float height, final int slices, final int stacks) { float da, r, dr, dz; float x, y, z, nz, nsign; @@ -446,8 +446,8 @@ public class GLUquadricImpl implements GLUquadric { } glEnd(gl); } else if (drawStyle == GLU.GLU_FILL) { - float ds = 1.0f / slices; - float dt = 1.0f / stacks; + final float ds = 1.0f / slices; + final float dt = 1.0f / stacks; float t = 0.0f; z = 0.0f; r = baseRadius; @@ -505,7 +505,7 @@ public class GLUquadricImpl implements GLUquadric { * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at * (0, -r, 0) it is (0.5, 0). */ - public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops) + public void drawDisk(final GL gl, final float innerRadius, final float outerRadius, final int slices, final int loops) { float da, dr; @@ -529,12 +529,12 @@ public class GLUquadricImpl implements GLUquadric { * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] * (linear mapping) */ - float dtc = 2.0f * outerRadius; + final float dtc = 2.0f * outerRadius; float sa, ca; float r1 = innerRadius; int l; for (l = 0; l < loops; l++) { - float r2 = r1 + dr; + final float r2 = r1 + dr; if (orientation == GLU.GLU_OUTSIDE) { int s; glBegin(gl, ImmModeSink.GL_QUAD_STRIP); @@ -580,22 +580,22 @@ public class GLUquadricImpl implements GLUquadric { int l, s; /* draw loops */ for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glBegin(gl, GL.GL_LINE_LOOP); for (s = 0; s < slices; s++) { - float a = s * da; + final float a = s * da; glVertex2f(gl, r * sin(a), r * cos(a)); } glEnd(gl); } /* draw spokes */ for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); glBegin(gl, GL.GL_LINE_STRIP); for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glVertex2f(gl, r * x, r * y); } glEnd(gl); @@ -607,12 +607,12 @@ public class GLUquadricImpl implements GLUquadric { int s; glBegin(gl, GL.GL_POINTS); for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); int l; for (l = 0; l <= loops; l++) { - float r = innerRadius * l * dr; + final float r = innerRadius * l * dr; glVertex2f(gl, r * x, r * y); } } @@ -625,8 +625,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0.0f; a < 2.0 * PI; a += da) { - float x = innerRadius * sin(a); - float y = innerRadius * cos(a); + final float x = innerRadius * sin(a); + final float y = innerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -635,8 +635,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0; a < 2.0f * PI; a += da) { - float x = outerRadius * sin(a); - float y = outerRadius * cos(a); + final float x = outerRadius * sin(a); + final float y = outerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -671,16 +671,16 @@ public class GLUquadricImpl implements GLUquadric { * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), * and at (0, -r, 0) it is (0.5, 0). */ - public void drawPartialDisk(GL gl, - float innerRadius, - float outerRadius, + public void drawPartialDisk(final GL gl, + final float innerRadius, + final float outerRadius, int slices, - int loops, + final int loops, float startAngle, float sweepAngle) { int i, j; - float[] sinCache = new float[CACHE_SIZE]; - float[] cosCache = new float[CACHE_SIZE]; + final float[] sinCache = new float[CACHE_SIZE]; + final float[] cosCache = new float[CACHE_SIZE]; float angle; float sintemp, costemp; float deltaRadius; @@ -952,7 +952,7 @@ public class GLUquadricImpl implements GLUquadric { * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 * at the -x axis, and back to 1.0 at the +y axis. */ - public void drawSphere(GL gl, float radius, int slices, int stacks) { + public void drawSphere(final GL gl, final float radius, final int slices, final int stacks) { // TODO float rho, drho, theta, dtheta; @@ -1121,7 +1121,7 @@ public class GLUquadricImpl implements GLUquadric { private static final float PI = (float)Math.PI; private static final int CACHE_SIZE = 240; - private final void glBegin(GL gl, int mode) { + private final void glBegin(final GL gl, final int mode) { if(immModeSinkEnabled) { immModeSink.glBegin(mode); } else { @@ -1129,7 +1129,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glEnd(GL gl) { + private final void glEnd(final GL gl) { if(immModeSinkEnabled) { immModeSink.glEnd(gl, immModeSinkImmediate); } else { @@ -1137,7 +1137,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex2f(GL gl, float x, float y) { + private final void glVertex2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glVertex2f(x, y); } else { @@ -1145,7 +1145,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex3f(GL gl, float x, float y, float z) { + private final void glVertex3f(final GL gl, final float x, final float y, final float z) { if(immModeSinkEnabled) { immModeSink.glVertex3f(x, y, z); } else { @@ -1153,10 +1153,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_s(GL gl, float x, float y, float z) { - short a=(short)(x*0xFFFF); - short b=(short)(y*0xFFFF); - short c=(short)(z*0xFFFF); + private final void glNormal3f_s(final GL gl, final float x, final float y, final float z) { + final short a=(short)(x*0xFFFF); + final short b=(short)(y*0xFFFF); + final short c=(short)(z*0xFFFF); if(immModeSinkEnabled) { immModeSink.glNormal3s(a, b, c); } else { @@ -1164,10 +1164,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_b(GL gl, float x, float y, float z) { - byte a=(byte)(x*0xFF); - byte b=(byte)(y*0xFF); - byte c=(byte)(z*0xFF); + private final void glNormal3f_b(final GL gl, final float x, final float y, final float z) { + final byte a=(byte)(x*0xFF); + final byte b=(byte)(y*0xFF); + final byte c=(byte)(z*0xFF); if(immModeSinkEnabled) { immModeSink.glNormal3b(a, b, c); } else { @@ -1175,7 +1175,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f(GL gl, float x, float y, float z) { + private final void glNormal3f(final GL gl, final float x, final float y, final float z) { switch(normalType) { case GL.GL_FLOAT: if(immModeSinkEnabled) { @@ -1193,7 +1193,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glTexCoord2f(GL gl, float x, float y) { + private final void glTexCoord2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glTexCoord2f(x, y); } else { @@ -1208,7 +1208,7 @@ public class GLUquadricImpl implements GLUquadric { * @param y * @param z */ - private void normal3f(GL gl, float x, float y, float z) { + private void normal3f(final GL gl, float x, float y, float z) { float mag; mag = (float)Math.sqrt(x * x + y * y + z * z); @@ -1220,15 +1220,15 @@ public class GLUquadricImpl implements GLUquadric { glNormal3f(gl, x, y, z); } - private final void TXTR_COORD(GL gl, float x, float y) { + private final void TXTR_COORD(final GL gl, final float x, final float y) { if (textureFlag) glTexCoord2f(gl, x,y); } - private float sin(float r) { + private float sin(final float r) { return (float)Math.sin(r); } - private float cos(float r) { + private float cos(final float r) { return (float)Math.cos(r); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/Glue.java b/src/jogl/classes/jogamp/opengl/glu/Glue.java index 2ad3d8c89..fc85b137f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/Glue.java +++ b/src/jogl/classes/jogamp/opengl/glu/Glue.java @@ -94,7 +94,7 @@ public class Glue { public Glue() { } - public static String __gluNURBSErrorString( int errno ) { + public static String __gluNURBSErrorString( final int errno ) { return( __gluNurbsErrors[ errno ] ); } @@ -108,7 +108,7 @@ public class Glue { "need combine callback" }; - public static String __gluTessErrorString( int errno ) { + public static String __gluTessErrorString( final int errno ) { return( __gluTessErrors[ errno ] ); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java index ffb8d9471..235c59717 100644 --- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java +++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java @@ -76,7 +76,7 @@ public class Error { public Error() { } - public static String gluErrorString( int errorCode ) { + public static String gluErrorString( final int errorCode ) { if( errorCode == 0 ) { return( "no error" ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java index 4213dfd46..96da49a80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -55,7 +22,7 @@ class GL2CurveEvaluator implements CurveEvaluator { /** * OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Not used @@ -130,8 +97,8 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param ps control points */ @Override - public void map1f(int type, float ulo, float uhi, int stride, int order, - CArrayOfFloats ps) { + public void map1f(final int type, final float ulo, final float uhi, final int stride, final int order, + final CArrayOfFloats ps) { if (output_triangles) { // TODO code for callback (output_triangles probably indicates callback) // System.out.println("TODO curveevaluator.map1f-output_triangles"); @@ -157,7 +124,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { // DONE gl.glEnable(type); } @@ -169,7 +136,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param u2 high u */ @Override - public void mapgrid1f(int nu, float u1, float u2) { + public void mapgrid1f(final int nu, final float u1, final float u2) { if (output_triangles) { // System.out.println("TODO curveevaluator.mapgrid1f"); } else @@ -185,7 +152,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param to highest param */ @Override - public void mapmesh1f(int style, int from, int to) { + public void mapmesh1f(final int style, final int from, final int to) { /* //DEBUG drawing control points this.poradi++; if (poradi % 2 == 0) @@ -200,10 +167,10 @@ class GL2CurveEvaluator implements CurveEvaluator { switch (style) { case Backend.N_MESHFILL: case Backend.N_MESHLINE: - gl.glEvalMesh1(GL2.GL_LINE, from, to); + gl.glEvalMesh1(GL2GL3.GL_LINE, from, to); break; case Backend.N_MESHPOINT: - gl.glEvalMesh1(GL2.GL_POINT, from, to); + gl.glEvalMesh1(GL2GL3.GL_POINT, from, to); break; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java index e9c9fca3f..e5cb715ab 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -50,7 +17,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { /** * JOGL OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Output triangles (callback) @@ -90,18 +57,18 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param style polygon mode (N_MESHFILL/N_MESHLINE/N_MESHPOINT) */ @Override - public void polymode(int style) { + public void polymode(final int style) { if (!output_triangles) { switch (style) { default: case NurbsConsts.N_MESHFILL: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL); break; case NurbsConsts.N_MESHLINE: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_LINE); break; case NurbsConsts.N_MESHPOINT: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_POINT); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_POINT); break; } } @@ -130,7 +97,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vhi */ @Override - public void domain2f(float ulo, float uhi, float vlo, float vhi) { + public void domain2f(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE } @@ -144,7 +111,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param v1 highest v */ @Override - public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) { + public void mapgrid2f(final int nu, final float u0, final float u1, final int nv, final float v0, final float v1) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles"); @@ -163,7 +130,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vmax maximum V */ @Override - public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) { + public void mapmesh2f(final int style, final int umin, final int umax, final int vmin, final int vmax) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles"); } else { @@ -176,13 +143,13 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { */ switch (style) { case NurbsConsts.N_MESHFILL: - gl.glEvalMesh2(GL2.GL_FILL, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_FILL, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHLINE: - gl.glEvalMesh2(GL2.GL_LINE, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_LINE, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHPOINT: - gl.glEvalMesh2(GL2.GL_POINT, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_POINT, umin, umax, vmin, vmax); break; } } @@ -202,8 +169,8 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param pts control points */ @Override - public void map2f(int type, float ulo, float uhi, int ustride, int uorder, - float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) { + public void map2f(final int type, final float ulo, final float uhi, final int ustride, final int uorder, + final float vlo, final float vhi, final int vstride, final int vorder, final CArrayOfFloats pts) { // TODO Auto-generated method stub if (output_triangles) { // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles"); @@ -218,7 +185,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { //DONE gl.glEnable(type); } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index f83b3a805..338d7e6d6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -67,17 +67,17 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Matrixes autoloading */ - private boolean autoloadmode; + private final boolean autoloadmode; /** * Using callback */ - private int callBackFlag; + private final int callBackFlag; /** * Object for error call backs */ - private Object errorCallback; + private final Object errorCallback; /** * List of map definitions @@ -122,7 +122,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object holding rendering settings */ - private Renderhints renderhints; + private final Renderhints renderhints; /** * Display list @@ -132,7 +132,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object for subdividing curves and surfaces */ - private Subdivider subdivider; + private final Subdivider subdivider; /** * Object responsible for rendering @@ -221,13 +221,13 @@ public class GLUgl2nurbsImpl implements GLUnurbs { defineMap(GL2.GL_MAP1_INDEX, 0, 1); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE, (float) 50.0); @@ -276,7 +276,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_u_rate(double d) { + private void set_domain_distance_u_rate(final double d) { // DONE subdivider.set_domain_distance_u_rate(d); } @@ -287,7 +287,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_v_rate(double d) { + private void set_domain_distance_v_rate(final double d) { // DONE subdivider.set_domain_distance_v_rate(d); } @@ -297,7 +297,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgncurve() { // DONE - O_curve o_curve = new O_curve(); + final O_curve o_curve = new O_curve(); thread("do_bgncurve", o_curve); } @@ -309,9 +309,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param arg * parameter to be passed to called method */ - private void thread(String name, Object arg) { + private void thread(final String name, final Object arg) { // DONE - Class partype[] = new Class[1]; + final Class partype[] = new Class[1]; partype[0] = arg.getClass(); Method m; try { @@ -321,7 +321,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { } else { m.invoke(this, new Object[] { arg }); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } @@ -333,16 +333,16 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param name * name of a method to be called */ - private void thread2(String name) { + private void thread2(final String name) { // DONE try { - Method m = this.getClass().getMethod(name, (Class[]) null); + final Method m = this.getClass().getMethod(name, (Class[]) null); if (dl != null) { dl.append(this, m, null); } else { m.invoke(this, (Object[]) null); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -353,7 +353,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_curve * curve object */ - public void do_bgncurve(O_curve o_curve) { + public void do_bgncurve(final O_curve o_curve) { if (inCurve > 0) { do_nurbserror(6); endcurve(); @@ -385,7 +385,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_surface * surface object */ - public void do_bgnsurface(O_surface o_surface) { + public void do_bgnsurface(final O_surface o_surface) { // DONE if (inSurface > 0) { do_nurbserror(27); @@ -507,7 +507,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * error code */ - private void do_nurbserror(int i) { + private void do_nurbserror(final int i) { // TODO nurberror // System.out.println("TODO nurbserror " + i); } @@ -553,10 +553,10 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param realType * type of the curve */ - public void nurbscurve(int nknots, float[] knot, int stride, - float[] ctlarray, int order, int realType) { + public void nurbscurve(final int nknots, final float[] knot, final int stride, + final float[] ctlarray, final int order, final int realType) { // DONE - Mapdesc mapdesc = maplist.locate(realType); + final Mapdesc mapdesc = maplist.locate(realType); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -572,14 +572,14 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector knots = new Knotvector(nknots, stride, order, knot); + final Knotvector knots = new Knotvector(nknots, stride, order, knot); if (!do_check_knots(knots, "curve")) return; - O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); + final O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); o_nurbscurve.bezier_curves = new Quilt(mapdesc); - CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); o_nurbscurve.bezier_curves.toBezier(knots, ctrlcarr, mapdesc .getNCoords()); thread("do_nurbscurve", o_nurbscurve); @@ -594,9 +594,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * error message * @return knot vector is / is not valid */ - public boolean do_check_knots(Knotvector knots, String msg) { + public boolean do_check_knots(final Knotvector knots, final String msg) { // DONE - int status = knots.validate(); + final int status = knots.validate(); if (status > 0) { do_nurbserror(status); if (renderhints.errorchecking != NurbsConsts.N_NOMSG) @@ -611,7 +611,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbscurve * NURBS curve object */ - public void do_nurbscurve(O_nurbscurve o_nurbscurve) { + public void do_nurbscurve(final O_nurbscurve o_nurbscurve) { // DONE if (inCurve <= 0) { @@ -664,7 +664,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbssurface * NURBS surface object */ - public void do_nurbssurface(O_nurbssurface o_nurbssurface) { + public void do_nurbssurface(final O_nurbssurface o_nurbssurface) { // DONE if (inSurface <= 0) { bgnsurface(); @@ -712,7 +712,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param ncoords * number of control point coordinates */ - public void defineMap(int type, int rational, int ncoords) { + public void defineMap(final int type, final int rational, final int ncoords) { // DONE maplist.define(type, rational, ncoords); } @@ -727,9 +727,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param value * property value */ - public void setnurbsproperty(int type, int tag, float value) { + public void setnurbsproperty(final int type, final int tag, final float value) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); return; @@ -738,7 +738,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { do_nurbserror(26); return; } - Property prop = new Property(type, tag, value); + final Property prop = new Property(type, tag, value); thread("do_setnurbsproperty2", prop); } @@ -748,8 +748,8 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property */ - public void do_setnurbsproperty2(Property prop) { - Mapdesc mapdesc = maplist.find(prop.type); + public void do_setnurbsproperty2(final Property prop) { + final Mapdesc mapdesc = maplist.find(prop.type); mapdesc.setProperty(prop.tag, prop.value); } @@ -759,7 +759,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property to be set */ - public void do_setnurbsproperty(Property prop) { + public void do_setnurbsproperty(final Property prop) { // DONE renderhints.setProperty(prop); // TODO freeproperty? @@ -771,7 +771,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * domain distance sampling flag */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE subdivider.set_is_domain_distance_sampling(i); } @@ -781,7 +781,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgnsurface() { // DONE - O_surface o_surface = new O_surface(); + final O_surface o_surface = new O_surface(); // TODO nuid // System.out.println("TODO glunurbs.bgnsurface nuid"); thread("do_bgnsurface", o_surface); @@ -827,11 +827,11 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param type * NURBS surface type (rational,...) */ - public void nurbssurface(int sknot_count, float[] sknot, int tknot_count, - float[] tknot, int s_stride, int t_stride, float[] ctlarray, - int sorder, int torder, int type) { + public void nurbssurface(final int sknot_count, final float[] sknot, final int tknot_count, + final float[] tknot, final int s_stride, final int t_stride, final float[] ctlarray, + final int sorder, final int torder, final int type) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -842,19 +842,19 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, + final Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, sknot); if (!do_check_knots(sknotvector, "surface")) return; - Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, + final Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, tknot); if (!do_check_knots(tknotvector, "surface")) return; - O_nurbssurface o_nurbssurface = new O_nurbssurface(type); + final O_nurbssurface o_nurbssurface = new O_nurbssurface(type); o_nurbssurface.bezier_patches = new Quilt(mapdesc); - CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); o_nurbssurface.bezier_patches.toBezier(sknotvector, tknotvector, ctrlarr, mapdesc.getNCoords()); thread("do_nurbssurface", o_nurbssurface); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index 81a99beab..337d93b80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -46,9 +46,15 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; + import jogamp.opengl.Debug; + import com.jogamp.common.nio.Buffers; + import java.nio.*; import java.io.*; @@ -65,9 +71,9 @@ public class BuildMipmap { public BuildMipmap() { } - public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int widthPowerOf2, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { + public static int gluBuild1DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int widthPowerOf2, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { int newwidth; int level, levels; ShortBuffer newImage = null; @@ -75,9 +81,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer imageTemp = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 ); @@ -90,40 +96,40 @@ public class BuildMipmap { Mipmap.retrieveStoreModes( gl, psm ); try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, - GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes was set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = userLevel; level <= levels; level++ ) { if( newImage_width == newwidth ) { // user newimage for this level if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, format, - GL2.GL_UNSIGNED_SHORT, newImage ); + GL.GL_UNSIGNED_SHORT, newImage ); } } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth, 1, format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -136,26 +142,26 @@ public class BuildMipmap { newImage_width = newwidth; if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, - format, GL2.GL_UNSIGNED_SHORT, newImage ); + format, GL.GL_UNSIGNED_SHORT, newImage ); } } if( newwidth > 1 ) { newwidth /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, ByteBuffer data ) { - int newwidth[] = new int[1]; - int newheight[] = new int[1]; + public static int bitmapBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int newwidth[] = new int[1]; + final int newheight[] = new int[1]; int level, levels; ShortBuffer newImage = null; int newImage_width; @@ -163,9 +169,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer tempImage = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); Mipmap.retrieveStoreModes( gl, psm ); @@ -179,8 +185,8 @@ public class BuildMipmap { try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, - format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -189,30 +195,30 @@ public class BuildMipmap { Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes is set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level < levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -227,7 +233,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } if( newheight[0] > 1 ) { newwidth[0] /= 2; @@ -236,38 +242,38 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int widthPowerOf2, int heightPowerOf2, - int format, int type, int userLevel, int baseLevel, int maxLevel, - ByteBuffer data ) { // PointerWrapper data + public static int gluBuild2DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int widthPowerOf2, final int heightPowerOf2, + final int format, final int type, final int userLevel, final int baseLevel, final int maxLevel, + final ByteBuffer data ) { // PointerWrapper data int newwidth; int newheight; int level, levels; - int usersImage; + final int usersImage; ByteBuffer srcImage = null; ByteBuffer dstImage = null; ByteBuffer tempImage = null; - int newImage_width; - int newImage_height; - short[] SWAP_IMAGE = null; + final int newImage_width; + final int newImage_height; + final short[] SWAP_IMAGE = null; int memReq; - int maxsize; + final int maxsize; int cmpts; int mark=-1; boolean myswap_bytes; int groups_per_line, element_size, group_size; int rowsize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 ); @@ -310,9 +316,9 @@ public class BuildMipmap { mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; data.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); level = userLevel; @@ -324,11 +330,11 @@ public class BuildMipmap { gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } int nextWidth = newwidth / 2; @@ -345,97 +351,97 @@ public class BuildMipmap { try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -462,36 +468,36 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } // level userLevel+1 is in srcImage; level userLevel already saved @@ -500,113 +506,113 @@ public class BuildMipmap { memReq = Mipmap.image_size( newwidth, newheight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } data.position( mark ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; @@ -634,36 +640,36 @@ public class BuildMipmap { memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -671,7 +677,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { srcImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); @@ -691,63 +697,63 @@ public class BuildMipmap { srcImage.rewind(); dstImage.rewind(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -768,7 +774,7 @@ public class BuildMipmap { newheight /= 2; } // compute amount to pad per row if any - int rowPad = rowsize % psm.getUnpackAlignment(); + final int rowPad = rowsize % psm.getUnpackAlignment(); // should row be padded if( rowPad == 0 ) { @@ -788,21 +794,21 @@ public class BuildMipmap { } } else { // compute length of new row in bytes, including padding - int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; + final int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; int ii, jj; - int dstTrav; - int srcTrav; + final int dstTrav; + final int srcTrav; // allocate new image for mipmap of size newRowLength x newheight ByteBuffer newMipmapImage = null; try { newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } srcImage.rewind(); @@ -828,19 +834,19 @@ public class BuildMipmap { } } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, - int components, int width, int height, int format, int type, ByteBuffer data ) { - int[] newwidth = new int[1]; - int[] newheight = new int[1]; + public static int fastBuild2DMipmaps( final GL gl, final PixelStorageModes psm, final int target, + final int components, final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int[] newwidth = new int[1]; + final int[] newheight = new int[1]; int level, levels; ByteBuffer newImage; int newImage_width; @@ -848,7 +854,7 @@ public class BuildMipmap { ByteBuffer otherImage; ByteBuffer imageTemp; int memReq; - int maxsize; + final int maxsize; int cmpts; Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, @@ -876,12 +882,12 @@ public class BuildMipmap { int elements_per_line; int start; int iter; - int iter2; + final int iter2; int i, j; try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) ); - } catch( OutOfMemoryError err ) { + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL.GL_UNSIGNED_BYTE ) ); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -907,29 +913,29 @@ public class BuildMipmap { } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level <= levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { // use newImage for this level newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_BYTE ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); try { otherImage = Buffers.newDirectByteBuffer( memReq ); - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -942,7 +948,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } if( newwidth[0] > 1 ) { newwidth[0] /= 2; @@ -951,30 +957,30 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( 0 ); } - public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, - int depthPowerOf2, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { + public static int gluBuild3DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int widthPowerOf2, final int heightPowerOf2, + final int depthPowerOf2, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { int newWidth; int newHeight; int newDepth; int level, levels; ByteBuffer usersImage; ByteBuffer srcImage, dstImage, tempImage; - int newImageWidth; - int newImageHeight; - int newImageDepth; + final int newImageWidth; + final int newImageHeight; + final int newImageDepth; int memReq; - int maxSize; + final int maxSize; int cmpts; int mark=-1; @@ -982,7 +988,7 @@ public class BuildMipmap { int groupsPerLine, elementSize, groupSize; int rowsPerImage, imageSize; int rowSize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 && depth >= 1 ); @@ -1041,11 +1047,11 @@ public class BuildMipmap { psm.getUnpackSkipImages() * imageSize; usersImage.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0 ); level = userLevel; @@ -1056,13 +1062,13 @@ public class BuildMipmap { 0, format, type, usersImage ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } int nextWidth = newWidth / 2; @@ -1082,44 +1088,44 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, @@ -1129,7 +1135,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1139,7 +1145,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1149,7 +1155,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1159,7 +1165,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1169,7 +1175,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1179,7 +1185,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1189,53 +1195,53 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1268,38 +1274,38 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1309,38 +1315,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1371,38 +1377,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -1410,7 +1416,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { usersImage.position( mark ); gl.getGL2().glTexImage3D( target, level, internalFormat, width, height, depth, @@ -1419,7 +1425,7 @@ public class BuildMipmap { level++; for( ; level <= levels; level++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1429,7 +1435,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1439,7 +1445,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1449,7 +1455,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1459,7 +1465,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1469,7 +1475,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1479,7 +1485,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1489,51 +1495,51 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1563,22 +1569,22 @@ public class BuildMipmap { 0, format, type, usersImage ); } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } private static final int TARGA_HEADER_SIZE = 18; - private static void writeTargaFile(String filename, ByteBuffer data, - int width, int height) { + private static void writeTargaFile(final String filename, final ByteBuffer data, + final int width, final int height) { try { - FileOutputStream fos = new FileOutputStream(new File(filename)); - ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); + final FileOutputStream fos = new FileOutputStream(new File(filename)); + final ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); header.put(0, (byte) 0).put(1, (byte) 0); header.put(2, (byte) 2); // uncompressed type header.put(12, (byte) (width & 0xFF)); // width @@ -1590,7 +1596,7 @@ public class BuildMipmap { fos.write(data.array()); data.clear(); fos.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java index 0c155ff96..fe9c15e60 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java @@ -57,7 +57,7 @@ public class Extract1010102 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1010102 implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; + extractComponents[0] = ( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0x00000003 ) ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java index 5208ea537..d619502be 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java @@ -57,7 +57,7 @@ public class Extract1555rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1555rev implements Extract { // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x003E ) >> 5 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x7C00 ) >> 10) / 31.0f; + extractComponents[3] = ( ushort & 0x8000 ) >> 15; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java index 1bf8abcc3..9d00badcb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java @@ -57,7 +57,7 @@ public class Extract2101010rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract2101010rev implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; + extractComponents[0] = ( ( uint & 0x000003FF ) ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java index c86b39e63..3bc797518 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java @@ -57,18 +57,18 @@ public class Extract233rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; - extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0x07) ) / 7.0f; + extractComponents[1] = ((ubyte & 0x38) >> 3) / 7.0f; + extractComponents[2] = ((ubyte & 0xC0) >> 6) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java index 706f0c3f2..93983f1d7 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java @@ -57,18 +57,18 @@ public class Extract332 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; - extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0xe0) >> 5) / 7.0f; + extractComponents[1] = ((ubyte & 0x1c) >> 2) / 7.0f; + extractComponents[2] = ((ubyte & 0x03)) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java index 182d66ce2..323ca7f1a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java @@ -57,7 +57,7 @@ public class Extract4444 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444 implements Extract { // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[0] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0x000F ) ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java index 52ecdc17c..267286519 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java @@ -57,7 +57,7 @@ public class Extract4444rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444rev implements Extract { // 00001111,00000000 == 0x0F00 // 11110000,00000000 == 0xF000 - extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[0] = ( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java index 21f53aa1d..ee33ca7c1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java @@ -57,7 +57,7 @@ public class Extract5551 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract5551 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) ); + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) ); } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java index 7408c45b2..d63943a2e 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java @@ -57,7 +57,7 @@ public class Extract565 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565 implements Extract { // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0x001F ) ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java index adaafa7ea..cfea71487 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java @@ -57,7 +57,7 @@ public class Extract565rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565rev implements Extract { // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00111111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java index be155d578..f6fe92c82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java @@ -57,7 +57,7 @@ public class Extract8888 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[0] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[1] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[3] = ( ( uint & 0x000000FF ) ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java index 294e60e12..942f6d88a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java @@ -57,7 +57,7 @@ public class Extract8888rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888rev implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[0] = ( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[1] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[3] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java index 1dd8bff8a..09d70e492 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java @@ -57,7 +57,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer data ) { + public double extract( final boolean isSwap, final ByteBuffer data ) { float f = 0; if( isSwap ) { f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); @@ -69,7 +69,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 1.0); data.asFloatBuffer().put( index, (float)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java index dcbe52a40..e9b021413 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java @@ -57,14 +57,14 @@ public class ExtractSByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer sbyte ) { - byte b = sbyte.get(); + public double extract( final boolean isSwap, final ByteBuffer sbyte ) { + final byte b = sbyte.get(); assert( b <= 127 ); return( b ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { data.position( index ); data.put( (byte)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java index 547bd944a..9532fdade 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java @@ -57,7 +57,7 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { int i = 0; if( isSwap ) { i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < Integer.MAX_VALUE); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java index 7dc172976..6e14f89c0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java @@ -57,7 +57,7 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { short s = 0; if( isSwap ) { s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 32768.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java index 3e933811c..d9db0019b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java @@ -57,14 +57,14 @@ public class ExtractUByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ubyte ) { - int i = 0x000000FF & ubyte.get(); + public double extract( final boolean isSwap, final ByteBuffer ubyte ) { + final int i = 0x000000FF & ubyte.get(); assert( i <= 255 ); return( i ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 256.0); data.position( index ); data.put( (byte)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java index 1c34828b3..3e4ad41c2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java @@ -57,7 +57,7 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { long i = 0; if( isSwap ) { i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 0xFFFFFFFF); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java index 8e0d25c42..b121c1054 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java @@ -57,7 +57,7 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { int i = 0; if( isSwap ) { i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 65536.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 184c5fda8..100c6ba1f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -57,8 +57,8 @@ public class HalveImage { private static final int BOX4 = 4; private static final int BOX8 = 8; - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { + public static void halveImage( final int components, final int width, final int height, + final ShortBuffer datain, final ShortBuffer dataout ) { int i, j, k; int newwidth, newheight; int delta; @@ -92,9 +92,9 @@ public class HalveImage { } } - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halveImage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; int s; @@ -134,9 +134,9 @@ public class HalveImage { } } - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -170,10 +170,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -203,12 +203,12 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { + public static void halveImage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, final int element_size, + final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; byte temp = (byte)0; @@ -245,9 +245,9 @@ public class HalveImage { } } - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = width / 2; int src = 0; @@ -276,10 +276,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assert only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -304,12 +304,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; // handle case where there is only 1 column/row @@ -365,9 +366,9 @@ public class HalveImage { } } - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -384,7 +385,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -402,10 +403,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -414,7 +415,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -438,12 +439,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; short temp = (short)0; // handle case where there is only 1 column/row @@ -472,7 +474,7 @@ public class HalveImage { temp += datain.getShort(); temp += 2; temp /= 4; - dataout.put( (short)temp ); + dataout.put( temp ); t += element_size; } t += group_size; @@ -483,8 +485,8 @@ public class HalveImage { for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { - short b; - int buf; + final short b; + final int buf; datain.position( t ); temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); datain.position( t + group_size ); @@ -505,9 +507,9 @@ public class HalveImage { } } - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -524,7 +526,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -542,10 +544,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -554,7 +556,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -578,12 +580,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; double temp = 0; @@ -644,9 +647,9 @@ public class HalveImage { } } - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -663,7 +666,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -681,10 +684,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -693,7 +696,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -717,12 +720,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; @@ -786,9 +790,9 @@ public class HalveImage { } } - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -805,7 +809,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -823,10 +827,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -835,7 +839,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -859,12 +863,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; float temp = 0.0f; // handle case where there is only 1 column/row @@ -921,9 +926,9 @@ public class HalveImage { } } - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -940,7 +945,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -958,10 +963,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -970,7 +975,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -994,9 +999,9 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); halve1DimagePackedPixel( components, extract, width, height, datain, dataout, @@ -1005,16 +1010,16 @@ public class HalveImage { } int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; datain.position( src ); @@ -1046,9 +1051,9 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halve1DimagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -1066,8 +1071,8 @@ public class HalveImage { // one horizontal row with possible pad bytes for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; datain.position( src ); @@ -1088,7 +1093,7 @@ public class HalveImage { // skip over to next group of 2 src += pixelSizeInBytes + pixelSizeInBytes; } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; assert( src == rowSizeInBytes ); @@ -1102,8 +1107,8 @@ public class HalveImage { // average two at a time for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; // average two at a time, instead of four datain.position( src ); @@ -1129,16 +1134,16 @@ public class HalveImage { } } - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixelSlice( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1148,8 +1153,8 @@ public class HalveImage { assert( depth >= 2 ); for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX2][4]; int cc; dataIn.position( src ); @@ -1178,8 +1183,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1199,7 +1204,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1212,8 +1217,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1233,7 +1238,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1244,16 +1249,16 @@ public class HalveImage { } } - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImageSlice( final int components, final ExtractPrimitive extract, final int width, + final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1265,8 +1270,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; + final double[] totals = new double[4]; + final double[][] extractTotals = new double[BOX2][4]; int kk; dataIn.position( src ); @@ -1281,7 +1286,7 @@ public class HalveImage { for( kk = 0; kk < BOX2; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX2; + totals[cc] /= BOX2; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1301,8 +1306,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1321,7 +1326,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1343,8 +1348,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1364,7 +1369,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1381,10 +1386,10 @@ public class HalveImage { } } - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImage3D( final int components, final ExtractPrimitive extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { assert( depth > 1 ); // horizontal/vertical/onecolumn slice viewed from top @@ -1399,11 +1404,11 @@ public class HalveImage { int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { @@ -1412,8 +1417,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX8][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1437,7 +1442,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX8; + totals[cc] /= BOX8; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1457,10 +1462,10 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel3D( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); @@ -1476,18 +1481,18 @@ public class HalveImage { } int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; + final float totals[] = new float[4]; // 4 is max components + final float extractTotals[][] = new float[BOX8][4]; int cc; dataIn.position( src ); @@ -1514,7 +1519,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (float)BOX8; + totals[cc] /= BOX8; } extract.shove( totals, outIndex, dataOut ); outIndex++; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index 18f814dde..ef77f3555 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -46,6 +46,9 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; + import java.nio.*; /** @@ -58,14 +61,14 @@ public class Image { public Image() { } - public static short getShortFromByteArray( byte[] array, int index ) { + public static short getShortFromByteArray( final byte[] array, final int index ) { short s; s = (short)(array[index] << 8 ); s |= (short)(0x00FF & array[index+1]); return( s ); } - public static int getIntFromByteArray( byte[] array, int index ) { + public static int getIntFromByteArray( final byte[] array, final int index ) { int i; i = ( array[index] << 24 ) & 0xFF000000; i |= ( array[index+1] << 16 ) & 0x00FF0000; @@ -74,8 +77,8 @@ public class Image { return( i ); } - public static float getFloatFromByteArray( byte[] array, int index ) { - int i = getIntFromByteArray( array, index ); + public static float getFloatFromByteArray( final byte[] array, final int index ) { + final int i = getIntFromByteArray( array, index ); return( Float.intBitsToFloat(i) ); } @@ -83,9 +86,9 @@ public class Image { * Extract array from user's data applying all pixel store modes. * The internal format used is an array of unsigned shorts. */ - public static void fill_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, ByteBuffer userdata, - ShortBuffer newimage ) { + public static void fill_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, final ByteBuffer userdata, + final ShortBuffer newimage ) { int components; int element_size; int rowsize; @@ -102,40 +105,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -214,74 +217,74 @@ public class Image { iter = start; userdata.position( iter ); //*************************************** for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - float[] extractComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] extractComponents = new float[4]; userdata.position( iter ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { newimage.put( iter2++, (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; } else { newimage.put( iter2++, (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { newimage.put( iter2++, userdata.get() ); //userdata[iter]; } else { newimage.put( iter2++, (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswap_bytes ) { widget.setUB1( userdata.get() ); widget.setUB0( userdata.get() ); @@ -289,7 +292,7 @@ public class Image { widget.setUB0( userdata.get() ); widget.setUB1( userdata.get() ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( index_format ) { newimage.put( iter2++, widget.getS0() ); } else { @@ -299,33 +302,33 @@ public class Image { newimage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswap_bytes ) { widget.setUB3( userdata.get() ); widget.setUB2( userdata.get() ); @@ -337,13 +340,13 @@ public class Image { widget.setUB2( userdata.get() ); widget.setUB3( userdata.get() ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( index_format ) { newimage.put( iter2++, (short)widget.getF() ); } else { newimage.put( iter2++, (short)(widget.getF() * 65535 ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { newimage.put( iter2++, (short)( widget.getUI() ) ); } else { @@ -380,9 +383,9 @@ public class Image { * Theinternal format is an array of unsigned shorts. * empty_image() because it is the opposet of fill_image(). */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, - ShortBuffer oldimage, ByteBuffer userdata ) { + public static void empty_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, + final ShortBuffer oldimage, final ByteBuffer userdata ) { int components; int element_size; @@ -400,40 +403,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -499,7 +502,7 @@ public class Image { start += rowsize; } } else { - float shoveComponents[] = new float[4]; + final float shoveComponents[] = new float[4]; element_size = Mipmap.bytes_per_element( type ); group_size = element_size * components; @@ -519,22 +522,22 @@ public class Image { for( i = 0; i < height; i++ ) { iter = start; for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); + final Type_Widget widget = new Type_Widget(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -543,7 +546,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -552,7 +555,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -569,7 +572,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -586,7 +589,7 @@ public class Image { userdata.put( iter, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -603,7 +606,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -620,7 +623,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -637,7 +640,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -654,9 +657,9 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( index_format ) { widget.setS0( oldimage.get( iter2++ ) ); } else { @@ -677,7 +680,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -695,7 +698,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -713,7 +716,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -731,7 +734,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -749,16 +752,16 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( index_format ) { widget.setF( oldimage.get( iter2++ ) ); } else { widget.setF( oldimage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { widget.setUI( oldimage.get( iter2++ ) ); } else { @@ -800,9 +803,9 @@ public class Image { } } - public static void fillImage3D( PixelStorageModes psm, int width, int height, - int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, - ShortBuffer newImage ) { + public static void fillImage3D( final PixelStorageModes psm, final int width, final int height, + final int depth, final int format, final int type, final boolean indexFormat, final ByteBuffer userImage, + final ShortBuffer newImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -817,46 +820,46 @@ public class Image { int iter = 0; int iter2 = 0; int ww, hh, dd, k; - Type_Widget widget = new Type_Widget(); - float extractComponents[] = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float extractComponents[] = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -903,78 +906,78 @@ public class Image { for( ww = 0; ww < elementsPerLine; ww++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); } else { newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { newImage.put( iter2++, userImage.get( iter ) ); } else { newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 1 ) ); widget.setUB1( userImage.get( iter ) ); @@ -982,7 +985,7 @@ public class Image { widget.setUB0( userImage.get( iter ) ); widget.setUB1( userImage.get( iter + 1 ) ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( indexFormat ) { newImage.put( iter2++, widget.getUS0() ); } else { @@ -992,36 +995,36 @@ public class Image { newImage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 3 ) ); widget.setUB1( userImage.get( iter + 2 ) ); @@ -1033,13 +1036,13 @@ public class Image { widget.setUB2( userImage.get( iter + 2 ) ); widget.setUB3( userImage.get( iter + 3 ) ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getF() ); } else { newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getUI() ); } else { @@ -1075,8 +1078,8 @@ public class Image { psm.getUnpackSkipImages() * imageSize ); } - public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, - int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { + public static void emptyImage3D( final PixelStorageModes psm, final int width, final int height, final int depth, + final int format, final int type, final boolean indexFormat, final ShortBuffer oldImage, final ByteBuffer userImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -1090,46 +1093,46 @@ public class Image { int ii, jj, dd, k; int rowsPerImage; int imageSize; - Type_Widget widget = new Type_Widget(); - float[] shoveComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] shoveComponents = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -1182,33 +1185,33 @@ public class Image { for( jj = 0; jj < elementsPerLine; jj++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); } else { userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); } else { userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1220,7 +1223,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1232,7 +1235,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1244,7 +1247,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1256,7 +1259,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1268,7 +1271,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1280,16 +1283,16 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( indexFormat ) { - widget.setS0( (short)oldImage.get( iter2++ ) ); + widget.setS0( oldImage.get( iter2++ ) ); } else { widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); } } else { - widget.setUS0( (short)oldImage.get( iter2++ ) ); + widget.setUS0( oldImage.get( iter2++ ) ); } if( myswapBytes ) { userImage.put( iter, widget.getUB1() ); @@ -1299,7 +1302,7 @@ public class Image { userImage.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1313,7 +1316,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1327,7 +1330,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1341,7 +1344,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1355,16 +1358,16 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( indexFormat ) { widget.setF( oldImage.get( iter2++ ) ); } else { widget.setF( oldImage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { widget.setUI( oldImage.get( iter2++ ) ); } else { diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index 938873ec5..fba6a231a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -46,10 +46,14 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLException; + import java.nio.*; + import com.jogamp.common.nio.Buffers; /** @@ -108,7 +112,7 @@ public class Mipmap { return( s ); } - public static int GLU_SWAP_4_BYTES( int i ) { + public static int GLU_SWAP_4_BYTES( final int i ) { int t = i << 24; t |= 0x00FF0000 & ( i << 8 ); t |= 0x0000FF00 & ( i >>> 8 ); @@ -116,17 +120,17 @@ public class Mipmap { return( t ); } - public static float GLU_SWAP_4_BYTES( float f ) { - int i = Float.floatToRawIntBits( f ); - float temp = Float.intBitsToFloat( i ); + public static float GLU_SWAP_4_BYTES( final float f ) { + final int i = Float.floatToRawIntBits( f ); + final float temp = Float.intBitsToFloat( i ); return( temp ); } - public static int checkMipmapArgs( int internalFormat, int format, int type ) { + public static int checkMipmapArgs( final int internalFormat, final int format, final int type ) { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); } - if( format == GL2GL3.GL_STENCIL_INDEX ) { + if( format == GL2ES2.GL_STENCIL_INDEX ) { return( GLU.GLU_INVALID_ENUM ); } if( !isLegalFormatForPackedPixelType( format, type ) ) { @@ -135,19 +139,19 @@ public class Mipmap { return( 0 ); } - public static boolean legalFormat( int format ) { + public static boolean legalFormat( final int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): - case( GL2GL3.GL_STENCIL_INDEX ): - case( GL2GL3.GL_DEPTH_COMPONENT ): - case( GL2GL3.GL_RED ): - case( GL2GL3.GL_GREEN ): - case( GL2GL3.GL_BLUE ): - case( GL2GL3.GL_ALPHA ): - case( GL2GL3.GL_RGB ): - case( GL2GL3.GL_RGBA ): - case( GL2GL3.GL_LUMINANCE ): - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL2ES2.GL_STENCIL_INDEX ): + case( GL2ES2.GL_DEPTH_COMPONENT ): + case( GL2ES2.GL_RED ): + case( GL2ES3.GL_GREEN ): + case( GL2ES3.GL_BLUE ): + case( GL.GL_ALPHA ): + case( GL.GL_RGB ): + case( GL.GL_RGBA ): + case( GL.GL_LUMINANCE ): + case( GL.GL_LUMINANCE_ALPHA ): case( GL2GL3.GL_BGR ): case( GL.GL_BGRA ): return( true ); @@ -156,55 +160,55 @@ public class Mipmap { } } - public static boolean legalType( int type ) { + public static boolean legalType( final int type ) { switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): - case( GL2GL3.GL_FLOAT ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): return( true ); default: return( false ); } } - public static boolean isTypePackedPixel( int type ) { + public static boolean isTypePackedPixel( final int type ) { assert( legalType( type ) ); if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( true ); } return( false ); } - public static boolean isLegalFormatForPackedPixelType( int format, int type ) { + public static boolean isLegalFormatForPackedPixelType( final int format, final int type ) { // if not a packed pixel type then return true if( isTypePackedPixel( type ) ) { return( true ); @@ -212,29 +216,29 @@ public class Mipmap { // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) - & format != GL2GL3.GL_RGB ) { + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL.GL_RGB ) { return( false ); } // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT - if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + if( ( type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) && + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) && (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { return( false ); } return( true ); } - public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, - int totalLevels ) { + public static boolean isLegalLevels( final int userLevel, final int baseLevel, final int maxLevel, + final int totalLevels ) { if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || (totalLevels < maxLevel) ) { return( false ); @@ -249,13 +253,13 @@ public class Mipmap { * advertise the texture extension. * Note that proxy textures are implemented but not according to spec in IMPACT* */ - public static void closestFit( GL gl, int target, int width, int height, int internalFormat, - int format, int type, int[] newWidth, int[] newHeight ) { + public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat, + final int format, final int type, final int[] newWidth, final int[] newHeight ) { // Use proxy textures if OpenGL version >= 1.1 if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; boolean noProxyTextures = false; // Some drivers (in particular, ATI's) seem to set a GL error @@ -265,24 +269,24 @@ public class Mipmap { try { do { // compute level 1 width & height, clamping each at 1 - int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); - int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); + final int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); + final int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); int proxyTarget; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); // does width x height at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { + if( target == GL.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); - } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { + } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); @@ -313,7 +317,7 @@ public class Mipmap { } // else it does fit } while( proxyWidth[0] == 0 ); - } catch (GLException e) { + } catch (final GLException e) { noProxyTextures = true; } // loop must terminate @@ -324,8 +328,8 @@ public class Mipmap { return; } } - int[] maxsize = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0); + final int[] maxsize = new int[1]; + gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize , 0); // clamp user's texture sizes to maximum sizes, if necessary newWidth[0] = nearestPower( width ); if( newWidth[0] > maxsize[0] ) { @@ -337,26 +341,26 @@ public class Mipmap { } } - public static void closestFit3D( GL gl, int target, int width, int height, int depth, - int internalFormat, int format, int type, int[] newWidth, int[] newHeight, - int[] newDepth ) { + public static void closestFit3D( final GL gl, final int target, final int width, final int height, final int depth, + final int internalFormat, final int format, final int type, final int[] newWidth, final int[] newHeight, + final int[] newDepth ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); int depthPowerOf2 = nearestPower( depth ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; do { // compute level 1 width & height & depth, clamping each at 1 - int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; - int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; - int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; + final int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; + final int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; + final int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; int proxyTarget = 0; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); assert( depthAtLevelOne > 0 ); // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { + if( target == GL2ES2.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D; gl.getGL2GL3().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, depthAtLevelOne, 0, format, type, null ); @@ -385,31 +389,31 @@ public class Mipmap { newDepth[0] = depthPowerOf2; } - public static int elements_per_group( int format, int type ) { + public static int elements_per_group( final int format, final int type ) { // Return the number of elements per grtoup of a specified gromat // If the type is packedpixels then answer is 1 if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( 1 ); } // Types are not packed pixels so get elements per group switch( format ) { - case( GL2GL3.GL_RGB ): + case( GL.GL_RGB ): case( GL2GL3.GL_BGR ): return( 3 ); - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL.GL_LUMINANCE_ALPHA ): return( 2 ); case( GL.GL_RGBA ): case( GL.GL_BGRA ): @@ -419,45 +423,45 @@ public class Mipmap { } } - public static int bytes_per_element( int type ) { + public static int bytes_per_element( final int type ) { // return the number of bytes per element, based on the element type switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): return( 1 ); - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): return( 2 ); - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): - case( GL2GL3.GL_FLOAT ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_FLOAT ): return( 4 ); default: return( 4 ); } } - public static boolean is_index( int format ) { - return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); + public static boolean is_index( final int format ) { + return( format == GL2.GL_COLOR_INDEX || format == GL2ES2.GL_STENCIL_INDEX ); } /* Compute memory required for internal packed array of data of given type and format. */ - public static int image_size( int width, int height, int format, int type ) { + public static int image_size( final int width, final int height, final int format, final int type ) { int bytes_per_row; int components; @@ -472,9 +476,9 @@ public class Mipmap { return( bytes_per_row * height * components ); } - public static int imageSize3D( int width, int height, int depth, int format, int type ) { - int components = elements_per_group( format, type ); - int bytes_per_row = bytes_per_element( type ) * width; + public static int imageSize3D( final int width, final int height, final int depth, final int format, final int type ) { + final int components = elements_per_group( format, type ); + final int bytes_per_row = bytes_per_element( type ) * width; assert( width > 0 && height > 0 && depth > 0 ); assert( type != GL2.GL_BITMAP ); @@ -482,28 +486,28 @@ public class Mipmap { return( bytes_per_row * height * depth * components ); } - public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -511,32 +515,32 @@ public class Mipmap { psm.setPackSwapBytes( ( a[0] == 1 ) ); } - public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes3D( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_SKIP_IMAGES, a, 0); psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 ); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0 ); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 ); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -548,17 +552,17 @@ public class Mipmap { psm.setPackImageHeight( a[0] ); } - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, - int typeout, ByteBuffer dataout ) { - int datainPos = datain.position(); - int dataoutPos = dataout.position(); + public static int gluScaleImage( final GL gl, final int format, final int widthin, final int heightin, + final int typein, final ByteBuffer datain, final int widthout, final int heightout, + final int typeout, final ByteBuffer dataout ) { + final int datainPos = datain.position(); + final int dataoutPos = dataout.position(); try { int components; ByteBuffer beforeimage; ByteBuffer afterimage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { return( 0 ); @@ -575,8 +579,8 @@ public class Mipmap { if( !isLegalFormatForPackedPixelType( format, typeout ) ) { return( GLU.GLU_INVALID_OPERATION ); } - beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) ); - afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) ); + beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ); + afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ); if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } @@ -594,15 +598,15 @@ public class Mipmap { } } - public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, - int width, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -625,16 +629,16 @@ public class Mipmap { } } - public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, - int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmaps( final GL gl, final int target, final int internalFormat, final int width, + final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; int levels; - int[] dummy = new int[1]; + final int[] dummy = new int[1]; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -654,14 +658,14 @@ public class Mipmap { } - public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int format, int type, int userLevel, - int baseLevel, int maxLevel, Object data ) { + public static int gluBuild2DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final Object data ) { int dataPos = 0; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -687,23 +691,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -717,15 +721,15 @@ public class Mipmap { } - public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, Object data ) { + public static int gluBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final Object data ) { int dataPos = 0; - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -749,23 +753,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -779,17 +783,17 @@ public class Mipmap { } - public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int[] depthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; + final int[] depthPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -823,14 +827,14 @@ public class Mipmap { } } - public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java index 7eb98db35..9b26647a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java @@ -147,7 +147,7 @@ public class PixelStorageModes { * Setter for property packAlignment. * @param packAlignment New value of property packAlignment. */ - public void setPackAlignment(int packAlignment) { + public void setPackAlignment(final int packAlignment) { this.packAlignment = packAlignment; } @@ -165,7 +165,7 @@ public class PixelStorageModes { * Setter for property packRowLength. * @param packRowLength New value of property packRowLength. */ - public void setPackRowLength(int packRowLength) { + public void setPackRowLength(final int packRowLength) { this.packRowLength = packRowLength; } @@ -183,7 +183,7 @@ public class PixelStorageModes { * Setter for property packSkipRows. * @param packSkipRows New value of property packSkipRows. */ - public void setPackSkipRows(int packSkipRows) { + public void setPackSkipRows(final int packSkipRows) { this.packSkipRows = packSkipRows; } @@ -201,7 +201,7 @@ public class PixelStorageModes { * Setter for property packSkipPixels. * @param packSkipPixels New value of property packSkipPixels. */ - public void setPackSkipPixels(int packSkipPixels) { + public void setPackSkipPixels(final int packSkipPixels) { this.packSkipPixels = packSkipPixels; } @@ -219,7 +219,7 @@ public class PixelStorageModes { * Setter for property packLsbFirst. * @param packLsbFirst New value of property packLsbFirst. */ - public void setPackLsbFirst(boolean packLsbFirst) { + public void setPackLsbFirst(final boolean packLsbFirst) { this.packLsbFirst = packLsbFirst; } @@ -237,7 +237,7 @@ public class PixelStorageModes { * Setter for property packSwapBytes. * @param packSwapBytes New value of property packSwapBytes. */ - public void setPackSwapBytes(boolean packSwapBytes) { + public void setPackSwapBytes(final boolean packSwapBytes) { this.packSwapBytes = packSwapBytes; } @@ -255,7 +255,7 @@ public class PixelStorageModes { * Setter for property packSkipImages. * @param packSkipImages New value of property packSkipImages. */ - public void setPackSkipImages(int packSkipImages) { + public void setPackSkipImages(final int packSkipImages) { this.packSkipImages = packSkipImages; } @@ -273,7 +273,7 @@ public class PixelStorageModes { * Setter for property packImageHeight. * @param packImageHeight New value of property packImageHeight. */ - public void setPackImageHeight(int packImageHeight) { + public void setPackImageHeight(final int packImageHeight) { this.packImageHeight = packImageHeight; } @@ -291,7 +291,7 @@ public class PixelStorageModes { * Setter for property unpackAlignment. * @param unpackAlignment New value of property unpackAlignment. */ - public void setUnpackAlignment(int unpackAlignment) { + public void setUnpackAlignment(final int unpackAlignment) { this.unpackAlignment = unpackAlignment; } @@ -309,7 +309,7 @@ public class PixelStorageModes { * Setter for property unpackRowLength. * @param unpackRowLength New value of property unpackRowLength. */ - public void setUnpackRowLength(int unpackRowLength) { + public void setUnpackRowLength(final int unpackRowLength) { this.unpackRowLength = unpackRowLength; } @@ -327,7 +327,7 @@ public class PixelStorageModes { * Setter for property unpackSkipRows. * @param unpackSkipRows New value of property unpackSkipRows. */ - public void setUnpackSkipRows(int unpackSkipRows) { + public void setUnpackSkipRows(final int unpackSkipRows) { this.unpackSkipRows = unpackSkipRows; } @@ -345,7 +345,7 @@ public class PixelStorageModes { * Setter for property unpackSkipPixels. * @param unpackSkipPixels New value of property unpackSkipPixels. */ - public void setUnpackSkipPixels(int unpackSkipPixels) { + public void setUnpackSkipPixels(final int unpackSkipPixels) { this.unpackSkipPixels = unpackSkipPixels; } @@ -363,7 +363,7 @@ public class PixelStorageModes { * Setter for property unpackLsbFirst. * @param unpackLsbFirst New value of property unpackLsbFirst. */ - public void setUnpackLsbFirst(boolean unpackLsbFirst) { + public void setUnpackLsbFirst(final boolean unpackLsbFirst) { this.unpackLsbFirst = unpackLsbFirst; } @@ -381,7 +381,7 @@ public class PixelStorageModes { * Setter for property unpackSwapBytes. * @param unpackSwapBytes New value of property unpackSwapBytes. */ - public void setUnpackSwapBytes(boolean unpackSwapBytes) { + public void setUnpackSwapBytes(final boolean unpackSwapBytes) { this.unpackSwapBytes = unpackSwapBytes; } @@ -399,7 +399,7 @@ public class PixelStorageModes { * Setter for property unpackSkipImages. * @param unpackSkipImages New value of property unpackSkipImages. */ - public void setUnpackSkipImages(int unpackSkipImages) { + public void setUnpackSkipImages(final int unpackSkipImages) { this.unpackSkipImages = unpackSkipImages; } @@ -417,7 +417,7 @@ public class PixelStorageModes { * Setter for property unpackImageHeight. * @param unpackImageHeight New value of property unpackImageHeight. */ - public void setUnpackImageHeight(int unpackImageHeight) { + public void setUnpackImageHeight(final int unpackImageHeight) { this.unpackImageHeight = unpackImageHeight; } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 9aca1fb03..ccb75091c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -56,16 +56,16 @@ import com.jogamp.common.nio.Buffers; */ public class ScaleInternal { - public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); + public static final float UINT_MAX = (0x00000000FFFFFFFF); - public static void scale_internal( int components, int widthin, int heightin, - ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { + public static void scale_internal( final int components, final int widthin, final int heightin, + final ShortBuffer datain, final int widthout, final int heightout, final ShortBuffer dataout ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float xpercent, ypercent; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, yint, xint, xindex, yindex; int temp; @@ -147,14 +147,16 @@ public class ScaleInternal { } } - public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_ubyte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -356,7 +358,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -372,15 +374,17 @@ public class ScaleInternal { } } - public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, - int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_byte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, + final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -581,7 +585,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -597,15 +601,17 @@ public class ScaleInternal { } } - public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_ushort( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -673,7 +679,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; } @@ -684,7 +690,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; } @@ -869,7 +875,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -885,15 +891,17 @@ public class ScaleInternal { } } - public static void scale_internal_short( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_short( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1173,7 +1181,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1189,15 +1197,17 @@ public class ScaleInternal { } } - public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_uint( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1416,9 +1426,9 @@ public class ScaleInternal { percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); temp = xindex + (lowy_int * ysize); for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); + final long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); datain.position( temp_index ); - long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); + final long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); datain.position( temp_index ); if( myswap_bytes ) { totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; @@ -1468,7 +1478,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1484,15 +1494,17 @@ public class ScaleInternal { } } - public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_int( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1772,7 +1784,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1788,15 +1800,17 @@ public class ScaleInternal { } } - public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_float( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -2076,7 +2090,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -2092,25 +2106,27 @@ public class ScaleInternal { } } - public static void scaleInternalPackedPixel( int components, Extract extract, - int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, - int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, - int rowSizeInBytes, boolean isSwap ) { - float x, convx; - float y, convy; + public static void scaleInternalPackedPixel( final int components, final Extract extract, + final int widthIn, final int heightIn, final ByteBuffer dataIn, final int widthOut, + final int heightOut, final ByteBuffer dataOut, final int pixelSizeInBytes, + final int rowSizeInBytes, final boolean isSwap ) { + final float x; + float convx; + final float y; + float convy; float percent; // max components in a format is 4, so - float[] totals = new float[4]; - float[] extractTotals = new float[4]; - float[] extractMoreTotals = new float[4]; - float[] shoveTotals = new float[4]; + final float[] totals = new float[4]; + final float[] extractTotals = new float[4]; + final float[] extractMoreTotals = new float[4]; + final float[] shoveTotals = new float[4]; float area; int i, j, k, xindex; int temp, temp0; - int temp_index; + final int temp_index; int outIndex = 0; int lowx_int, highx_int, lowy_int, highy_int; @@ -2309,7 +2325,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthIn - 1) { - int delta = (highx_int - widthIn + 1); + final int delta = (highx_int - widthIn + 1); lowx_int -= delta; highx_int -= delta; } @@ -2326,16 +2342,16 @@ public class ScaleInternal { assert( outIndex == ( widthOut * heightOut - 1) ); } - public static void scaleInternal3D( int components, int widthIn, int heightIn, - int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, - int depthOut, ShortBuffer dataOut ) { + public static void scaleInternal3D( final int components, final int widthIn, final int heightIn, + final int depthIn, final ShortBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final ShortBuffer dataOut ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float z, lowz, highz, convz, halfconvz; float xpercent, ypercent, zpercent; float percent; // max compnents in a format is 4 - float[] totals = new float[4]; + final float[] totals = new float[4]; float volume; int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; int temp; @@ -2442,12 +2458,12 @@ public class ScaleInternal { } } - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, - int depthOut, int typeOut, ByteBuffer dataOut ) { + public static int gluScaleImage3D( final GL gl, final int format, final int widthIn, final int heightIn, + final int depthIn, final int typeIn, final ByteBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final int typeOut, final ByteBuffer dataOut ) { int components; ShortBuffer beforeImage, afterImage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0 ) { @@ -2475,10 +2491,10 @@ public class ScaleInternal { try { beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError err ) { + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } Mipmap.retrieveStoreModes3D( gl, psm ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java index dc401880d..8683f75ac 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java @@ -61,7 +61,7 @@ public class Type_Widget { buffer = ByteBuffer.allocate( 4 ); } - public void setUB0( byte b ) { + public void setUB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -71,7 +71,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB1( byte b ) { + public void setUB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -81,7 +81,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB2( byte b ) { + public void setUB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -91,7 +91,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB3( byte b ) { + public void setUB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -101,7 +101,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUS0( short s ) { + public void setUS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -111,7 +111,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUS1( short s ) { + public void setUS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -121,7 +121,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUI( int i ) { + public void setUI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -131,7 +131,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setB0( byte b ) { + public void setB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -141,7 +141,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB1( byte b ) { + public void setB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -151,7 +151,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB2( byte b ) { + public void setB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -161,7 +161,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB3( byte b ) { + public void setB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -171,7 +171,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setS0( short s ) { + public void setS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -181,7 +181,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setS1( short s ) { + public void setS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -191,7 +191,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setI( int i ) { + public void setI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -201,7 +201,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setF( float f ) { + public void setF( final float f ) { buffer.position( 0 ); buffer.putFloat( f ); } @@ -216,8 +216,8 @@ public class Type_Widget { return( buffer ); } - public static void main( String args[] ) { - Type_Widget t = new Type_Widget(); + public static void main( final String args[] ) { + final Type_Widget t = new Type_Widget(); t.setI( 1000000 ); System.out.println("int: " + Integer.toHexString( t.getI() ) ); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java index df2b9a147..2194eb672 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java @@ -68,7 +68,7 @@ public class Arc { /** * Corresponding berizer type arc */ - private BezierArc bezierArc; + private final BezierArc bezierArc; /** * Makes new arc at specified side @@ -76,7 +76,7 @@ public class Arc { * @param side * which side doeas this arc form */ - public Arc(int side) { + public Arc(final int side) { bezierArc = null; pwlArc = null; type = 0; @@ -90,7 +90,7 @@ public class Arc { * @param side * arc side */ - private void setside(int side) { + private void setside(final int side) { // DONE clearside(); type |= side << 8; @@ -152,7 +152,7 @@ public class Arc { * arc to be append * @return this */ - public Arc append(Arc jarc) { + public Arc append(final Arc jarc) { // DONE if (jarc != null) { next = jarc.next; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java index c299b10af..68263b90d 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java @@ -45,7 +45,7 @@ public class ArcSdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcSdirSorter(Subdivider subdivider) { + public ArcSdirSorter(final Subdivider subdivider) { //TODO // System.out.println("TODO arcsdirsorter.constructor"); } @@ -55,7 +55,7 @@ public class ArcSdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO // System.out.println("TODO arcsdirsorter.qsort"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java index 1a584c396..dcd7d9fdc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java @@ -44,7 +44,7 @@ public class ArcTdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcTdirSorter(Subdivider subdivider) { + public ArcTdirSorter(final Subdivider subdivider) { // TODO Auto-generated constructor stub // System.out.println("TODO arcTsorter.konstruktor"); } @@ -53,7 +53,7 @@ public class ArcTdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO Auto-generated method stub // System.out.println("TODO arcTsorter.qsort"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java index bd6311414..119ccbc81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java @@ -49,9 +49,9 @@ public class ArcTesselator { * @param t1 minimum t param * @param t2 maximum s param */ - public void bezier(Arc arc, float s1, float s2, float t1, float t2) { + public void bezier(final Arc arc, final float s1, final float s2, final float t1, final float t2) { // DONE - TrimVertex[] p = new TrimVertex[2]; + final TrimVertex[] p = new TrimVertex[2]; p[0] = new TrimVertex(); p[1] = new TrimVertex(); arc.pwlArc = new PwlArc(2, p); @@ -70,7 +70,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_right(Arc newright, float s, float t1, float t2, float f) { + public void pwl_right(final Arc newright, final float s, final float t1, final float t2, final float f) { // TODO Auto-generated method stub // System.out.println("TODO arctesselator.pwl_right"); } @@ -83,7 +83,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_left(Arc newright, float s, float t2, float t1, float f) { + public void pwl_left(final Arc newright, final float s, final float t2, final float t1, final float f) { // TODO Auto-generated method stub // System.out.println("TODO arctesselator.pwl_left"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java index 3e974247b..bde1e2cbb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java @@ -101,8 +101,8 @@ public abstract class Backend { * @param ulo smallest u * @param uhi highest u */ - public void curvpts(int type, CArrayOfFloats ps, int stride, int order, - float ulo, float uhi) { + public void curvpts(final int type, final CArrayOfFloats ps, final int stride, final int order, + final float ulo, final float uhi) { // DONE curveEvaluator.map1f(type, ulo, uhi, stride, order, ps); curveEvaluator.enable(type); @@ -114,7 +114,7 @@ public abstract class Backend { * @param u2 highest u * @param nu number of pieces */ - public void curvgrid(float u1, float u2, int nu) { + public void curvgrid(final float u1, final float u2, final int nu) { // DONE curveEvaluator.mapgrid1f(nu, u1, u2); @@ -125,7 +125,7 @@ public abstract class Backend { * @param from low param * @param n step */ - public void curvmesh(int from, int n) { + public void curvmesh(final int from, final int n) { // DONE curveEvaluator.mapmesh1f(N_MESHFILL, from, from + n); } @@ -135,7 +135,7 @@ public abstract class Backend { * @param wiretris use triangles * @param wirequads use quads */ - public void bgnsurf(int wiretris, int wirequads) { + public void bgnsurf(final int wiretris, final int wirequads) { // DONE surfaceEvaluator.bgnmap2f(); @@ -160,7 +160,7 @@ public abstract class Backend { * @param vlo low v param * @param vhi high v param */ - public void patch(float ulo, float uhi, float vlo, float vhi) { + public void patch(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.domain2f(ulo, uhi, vlo, vhi); } @@ -174,7 +174,7 @@ public abstract class Backend { * @param v1 highest v * @param nv number of pieces in v direction */ - public void surfgrid(float u0, float u1, int nu, float v0, float v1, int nv) { + public void surfgrid(final float u0, final float u1, final int nu, final float v0, final float v1, final int nv) { // DONE surfaceEvaluator.mapgrid2f(nu, u0, u1, nv, v0, v1); @@ -187,7 +187,7 @@ public abstract class Backend { * @param n step in u direction * @param m step in v direction */ - public void surfmesh(int u, int v, int n, int m) { + public void surfmesh(final int u, final int v, final int n, final int m) { // System.out.println("TODO backend.surfmesh wireframequads"); // TODO wireframequads surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m); @@ -206,8 +206,8 @@ public abstract class Backend { * @param vlo lowest v * @param vhi hightest v */ - public void surfpts(int type, CArrayOfFloats pts, int ustride, int vstride, - int uorder, int vorder, float ulo, float uhi, float vlo, float vhi) { + public void surfpts(final int type, final CArrayOfFloats pts, final int ustride, final int vstride, + final int uorder, final int vorder, final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.map2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride, vorder, pts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java index 17437ef01..638b018c9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java @@ -64,7 +64,7 @@ public class Bin { * Adds and arc to linked list * @param jarc added arc */ - public void addarc(Arc jarc) { + public void addarc(final Arc jarc) { // DONE // if (head == null) // head = jarc; @@ -93,7 +93,7 @@ public class Bin { */ public Arc removearc() { // DONE - Arc jarc = head; + final Arc jarc = head; if (jarc != null) head = jarc.link; return jarc; @@ -147,7 +147,7 @@ public class Bin { */ private Arc nextarc() { // DONE - Arc jarc = current; + final Arc jarc = current; if (jarc != null) current = jarc.link; return jarc; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java index b67764c30..6d2ab362b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java @@ -20,7 +20,7 @@ public class CArrayOfArcs { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -30,7 +30,7 @@ public class CArrayOfArcs { * @param pointer * pointer (index) to array */ - public CArrayOfArcs(Arc[] array, int pointer) { + public CArrayOfArcs(final Arc[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -42,7 +42,7 @@ public class CArrayOfArcs { * @param carray * reference array */ - public CArrayOfArcs(CArrayOfArcs carray) { + public CArrayOfArcs(final CArrayOfArcs carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -54,7 +54,7 @@ public class CArrayOfArcs { * @param ctlarray * underlaying array */ - public CArrayOfArcs(Arc[] ctlarray) { + public CArrayOfArcs(final Arc[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -82,7 +82,7 @@ public class CArrayOfArcs { * @param f * desired value */ - public void set(Arc f) { + public void set(final Arc f) { array[pointer] = f; } @@ -94,7 +94,7 @@ public class CArrayOfArcs { * array index * @return element at index */ - public Arc get(int i) { + public Arc get(final int i) { return array[i]; } @@ -105,7 +105,7 @@ public class CArrayOfArcs { * relative index * @return element at relative index */ - public Arc getRelative(int i) { + public Arc getRelative(final int i) { return array[pointer + i]; } @@ -117,7 +117,7 @@ public class CArrayOfArcs { * @param value * value to be set */ - public void setRelative(int i, Arc value) { + public void setRelative(final int i, final Arc value) { array[pointer + i] = value; } @@ -127,7 +127,7 @@ public class CArrayOfArcs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -147,7 +147,7 @@ public class CArrayOfArcs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -160,7 +160,7 @@ public class CArrayOfArcs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -188,7 +188,7 @@ public class CArrayOfArcs { * @param array * underlaying array */ - public void setArray(Arc[] array) { + public void setArray(final Arc[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java index b5f588960..1c80289a3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java @@ -10,7 +10,7 @@ public class CArrayOfBreakpts { /** * Underlaying array */ - private Breakpt[] pole; + private final Breakpt[] pole; /** * Pointer to array member @@ -25,7 +25,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer (index) to array */ - public CArrayOfBreakpts(Breakpt[] array, int pointer) { + public CArrayOfBreakpts(final Breakpt[] array, final int pointer) { this.pole = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfBreakpts { * @param carray * reference array */ - public CArrayOfBreakpts(CArrayOfBreakpts carray) { + public CArrayOfBreakpts(final CArrayOfBreakpts carray) { this.pole = carray.pole; this.pointer = carray.pointer; } @@ -63,7 +63,7 @@ public class CArrayOfBreakpts { * @param f * desired value */ - public void set(Breakpt f) { + public void set(final Breakpt f) { pole[pointer] = f; } @@ -75,7 +75,7 @@ public class CArrayOfBreakpts { * array index * @return element at index */ - public Breakpt get(int i) { + public Breakpt get(final int i) { return pole[i]; } @@ -85,7 +85,7 @@ public class CArrayOfBreakpts { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -105,7 +105,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -115,7 +115,7 @@ public class CArrayOfBreakpts { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java index d9e4d0ff1..c9d6a59ad 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java @@ -21,7 +21,7 @@ public class CArrayOfFloats { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -31,7 +31,7 @@ public class CArrayOfFloats { * @param pointer * pointer (index) to array */ - public CArrayOfFloats(float[] array, int pointer) { + public CArrayOfFloats(final float[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -43,7 +43,7 @@ public class CArrayOfFloats { * @param carray * reference array */ - public CArrayOfFloats(CArrayOfFloats carray) { + public CArrayOfFloats(final CArrayOfFloats carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -55,7 +55,7 @@ public class CArrayOfFloats { * @param ctlarray * underlaying array */ - public CArrayOfFloats(float[] ctlarray) { + public CArrayOfFloats(final float[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -83,7 +83,7 @@ public class CArrayOfFloats { * @param f * desired value */ - public void set(float f) { + public void set(final float f) { array[pointer] = f; } @@ -95,7 +95,7 @@ public class CArrayOfFloats { * array index * @return element at index */ - public float get(int i) { + public float get(final int i) { return array[i]; } @@ -106,7 +106,7 @@ public class CArrayOfFloats { * relative index * @return element at relative index */ - public float getRelative(int i) { + public float getRelative(final int i) { return array[pointer + i]; } @@ -118,7 +118,7 @@ public class CArrayOfFloats { * @param value * value to be set */ - public void setRelative(int i, float value) { + public void setRelative(final int i, final float value) { array[pointer + i] = value; } @@ -128,7 +128,7 @@ public class CArrayOfFloats { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -148,7 +148,7 @@ public class CArrayOfFloats { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -161,7 +161,7 @@ public class CArrayOfFloats { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -189,7 +189,7 @@ public class CArrayOfFloats { * @param array * underlaying array */ - public void setArray(float[] array) { + public void setArray(final float[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java index e7bbac16a..0d769004a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java @@ -25,7 +25,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer (index) to array */ - public CArrayOfQuiltspecs(Quiltspec[] array, int pointer) { + public CArrayOfQuiltspecs(final Quiltspec[] array, final int pointer) { this.array = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfQuiltspecs { * @param carray * reference array */ - public CArrayOfQuiltspecs(CArrayOfQuiltspecs carray) { + public CArrayOfQuiltspecs(final CArrayOfQuiltspecs carray) { this.array = carray.array; this.pointer = carray.pointer; } @@ -47,7 +47,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public CArrayOfQuiltspecs(Quiltspec[] array) { + public CArrayOfQuiltspecs(final Quiltspec[] array) { this.array = array; this.pointer = 0; } @@ -74,7 +74,7 @@ public class CArrayOfQuiltspecs { * @param f * desired value */ - public void set(Quiltspec f) { + public void set(final Quiltspec f) { array[pointer] = f; } @@ -86,7 +86,7 @@ public class CArrayOfQuiltspecs { * array index * @return element at index */ - public Quiltspec get(int i) { + public Quiltspec get(final int i) { return array[i]; } @@ -96,7 +96,7 @@ public class CArrayOfQuiltspecs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -116,7 +116,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -126,7 +126,7 @@ public class CArrayOfQuiltspecs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } @@ -154,7 +154,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public void setArray(Quiltspec[] array) { + public void setArray(final Quiltspec[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java index ea3a3d14e..5fccbc598 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java @@ -59,32 +59,32 @@ public class Curve { /** * OpenGL maps */ - private Mapdesc mapdesc; + private final Mapdesc mapdesc; /** * Does the curve need sampling */ - private boolean needsSampling; + private final boolean needsSampling; /** * Culling */ - private int cullval; + private final int cullval; /** * Number of coords */ - private int stride; + private final int stride; /** * Curve order */ - private int order; + private final int order; /** * Holds conversion range borders */ - private float[] range; + private final float[] range; /** * Subdivision stepsize @@ -110,7 +110,7 @@ public class Curve { * @param c * next curve in linked list */ - public Curve(Quilt geo, float[] pta, float[] ptb, Curve c) { + public Curve(final Quilt geo, final float[] pta, final float[] ptb, final Curve c) { spts = new float[MAXORDER * MAXCOORDS]; @@ -125,8 +125,8 @@ public class Curve { stride = MAXCOORDS; // CArrayOfFloats ps = geo.cpts; - CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); - CArrayOfQuiltspecs qs = geo.qspec; + final CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); + final CArrayOfQuiltspecs qs = geo.qspec; ps.raisePointerBy(qs.get().offset); ps.raisePointerBy(qs.get().index * qs.get().order * qs.get().stride); @@ -182,11 +182,11 @@ public class Curve { } else { assert (order <= MAXORDER); - float tmp[][] = new float[MAXORDER][MAXCOORDS]; + final float tmp[][] = new float[MAXORDER][MAXCOORDS]; - int tstride = (MAXORDER); + final int tstride = (MAXORDER); - int val = 0; + final int val = 0; // mapdesc.project(spts,stride,tmp,tstride,order); // System.out.println("TODO curve.getsptepsize mapdesc.project"); @@ -194,7 +194,7 @@ public class Curve { if (val == 0) { setstepsize(mapdesc.maxrate); } else { - float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); + final float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); if (mapdesc.isParametricDistanceSampling()) { // System.out.println("TODO curve.getstepsize - parametric"); } else if (mapdesc.isPathLengthSampling()) { @@ -212,7 +212,7 @@ public class Curve { * Sets maximum subdivision step size * @param max maximum subdivision step size */ - private void setstepsize(float max) { + private void setstepsize(final float max) { // DONE stepsize = (max >= 1) ? (range[2] / max) : range[2]; minstepsize = stepsize; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java index 80baf207b..96081a8ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java @@ -67,7 +67,7 @@ public class Curvelist { * @param pta range start * @param ptb range end */ - public Curvelist(Quilt qlist, float[] pta, float[] ptb) { + public Curvelist(final Quilt qlist, final float[] pta, final float[] ptb) { // DONE curve = null; range = new float[3]; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java index d9d012606..e1b4cb2bb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java @@ -49,7 +49,7 @@ public class DisplayList { * @param m invoked method * @param arg method argument */ - public void append(Object src, Method m, Object arg) { + public void append(final Object src, final Method m, final Object arg) { // TODO Auto-generated method stub // System.out.println("TODO displaylist append"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java index f9c4c2d6f..30f52d5cc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java @@ -68,7 +68,7 @@ public class Flist { * Grows list * @param maxpts maximum desired size */ - public void grow(int maxpts) { + public void grow(final int maxpts) { // DONE if (npts < maxpts) { // npts=2*maxpts; @@ -106,7 +106,7 @@ public class Flist { * @param from start from * @param to end at */ - public void taper(float from, float to) { + public void taper(final float from, final float to) { // DONE while (pts[start] != from) { @@ -123,7 +123,7 @@ public class Flist { * Adds breakpoint value * @param f value */ - public void add(float f) { + public void add(final float f) { //DONE pts[end++] = f; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java index 1dcf393a9..b7fa722ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java @@ -175,7 +175,7 @@ public class Knotspec { break; } - CArrayOfFloats k = new CArrayOfFloats(kfirst); + final CArrayOfFloats k = new CArrayOfFloats(kfirst); k.mm(); for (; k.getPointer() >= inkbegin.getPointer(); k.mm()) @@ -183,7 +183,7 @@ public class Knotspec { break; k.pp(); - Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst + final Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst .getPointer()) + 1]; for (int i = 0; i < bbeginArray.length; i++) bbeginArray[i] = new Breakpt(); @@ -218,7 +218,7 @@ public class Knotspec { */ private void factors() { // DONE - CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend + final CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend .getPointer() - 1) - order + bend.get().multi); @@ -226,18 +226,18 @@ public class Knotspec { if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - for (CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt + for (final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt .getPointer() >= bbegin.getPointer(); bpt.mm()) { mid.lessenPointerBy(bpt.get().multi); - int def = bpt.get().def - 1; + final int def = bpt.get().def - 1; if (def < 0) continue; - float kv = bpt.get().value; + final float kv = bpt.get().value; - CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid + final CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid .getPointer() - def) + (order - 1)); - for (CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf + for (final CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf .getPointer() + def); kl.getPointer() != kf.getPointer(); kl.mm()) { CArrayOfFloats kh, kt; @@ -257,10 +257,10 @@ public class Knotspec { */ private void knots() { // DONE - CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft + final CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft .getPointer() - order); - CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright + final CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright .getPointer() + bend.get().def); @@ -279,8 +279,8 @@ public class Knotspec { */ private void breakpoints() { // DONE - CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); - CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); + final CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); int nfactors = 0; ubpt.get().value = ubend.get().value; @@ -320,13 +320,13 @@ public class Knotspec { * @param _outpt * output control points */ - public void copy(CArrayOfFloats _inpt, CArrayOfFloats _outpt) { - CArrayOfFloats inpt = new CArrayOfFloats(_inpt); - CArrayOfFloats outpt = new CArrayOfFloats(_outpt); + public void copy(final CArrayOfFloats _inpt, final CArrayOfFloats _outpt) { + final CArrayOfFloats inpt = new CArrayOfFloats(_inpt); + final CArrayOfFloats outpt = new CArrayOfFloats(_outpt); inpt.raisePointerBy(preoffset); if (next != null) { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { next.copy(inpt, outpt); @@ -334,7 +334,7 @@ public class Knotspec { } } else { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { pt_io_copy(outpt, inpt); @@ -352,7 +352,7 @@ public class Knotspec { * @param frompt * destination control point */ - private void pt_io_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_io_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE switch (ncoords) { case 4: @@ -378,8 +378,8 @@ public class Knotspec { * @param _p * inserted knot */ - public void transform(CArrayOfFloats _p) { - CArrayOfFloats p = new CArrayOfFloats(_p); + public void transform(final CArrayOfFloats _p) { + final CArrayOfFloats p = new CArrayOfFloats(_p); // DONE if (next != null) {//surface code if (this.equals(kspectotrans)) { @@ -387,13 +387,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) next.transform(p); } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -408,13 +408,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) { kspectotrans.insert(p); } } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -432,27 +432,27 @@ public class Knotspec { * @param p * inserted knot */ - private void insert(CArrayOfFloats p) { + private void insert(final CArrayOfFloats p) { // DONE CArrayOfFloats fptr = null; if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + prewidth - poststride); // CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), prewidth - // poststride); - CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth + postoffset - poststride); // CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), postwidth + // postoffset - poststride); - CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride * bpt.get().def); srcpt.getPointer() != pend .getPointer(); pend.raisePointerBy(poststride)) { - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride); p2.getPointer() != pend.getPointer(); p1 .setPointer(p2.getPointer()), p2 @@ -469,15 +469,15 @@ public class Knotspec { dstpt.lessenPointerBy(poststride); srcpt.lessenPointerBy(poststride); } - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride * bpt.get().def); srcpt .getPointer() != pend.getPointer(); pend .raisePointerBy(poststride), dstpt .lessenPointerBy(poststride)) { pt_oo_copy(dstpt, srcpt); - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride); p2.getPointer() != pend .getPointer(); p1.setPointer(p2.getPointer()), p2 .lessenPointerBy(poststride)) { @@ -496,7 +496,7 @@ public class Knotspec { * @param frompt * distance ctrl point */ - private void pt_oo_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_oo_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE // this is a "trick" with case - "break" is omitted so it comes through all cases switch (ncoords) { @@ -531,8 +531,8 @@ public class Knotspec { * @param b * 1 - alpha */ - private void pt_oo_sum(CArrayOfFloats x, CArrayOfFloats y, - CArrayOfFloats z, float a, double b) { + private void pt_oo_sum(final CArrayOfFloats x, final CArrayOfFloats y, + final CArrayOfFloats z, final float a, final double b) { // DONE switch (ncoords) { case 4: diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java index 571f44f06..76b59231c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java @@ -85,7 +85,7 @@ public class Knotvector { * @param knot * knots */ - public Knotvector(int nknots, int stride, int order, float[] knot) { + public Knotvector(final int nknots, final int stride, final int order, final float[] knot) { // DONE init(nknots, stride, order, knot); } @@ -102,7 +102,7 @@ public class Knotvector { * @param knot * knots */ - public void init(int nknots, int stride, int order, float[] knot) { + public void init(final int nknots, final int stride, final int order, final float[] knot) { // DONE this.knotcount = nknots; this.stride = stride; @@ -158,7 +158,7 @@ public class Knotvector { * @param msg * message to be shown */ - public void show(String msg) { + public void show(final String msg) { // TODO Auto-generated method stub // System.out.println("TODO knotvector.show"); @@ -173,7 +173,7 @@ public class Knotvector { * second knot * @return knots are/are not equal */ - public static boolean identical(float a, float b) { + public static boolean identical(final float a, final float b) { return ((a - b) < TOLERANCE) ? true : false; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java index 86638a827..95ce60c25 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java @@ -64,22 +64,22 @@ public class Mapdesc { /** * Map type */ - private int type; + private final int type; /** * Number of homogenous coords */ - private int hcoords; + private final int hcoords; /** * Number of inhomogenous coords */ - private int inhcoords; + private final int inhcoords; /** * Not used */ - private int mask; + private final int mask; /** * Value of N_PIXEL_TOLERANCE property @@ -144,22 +144,22 @@ public class Mapdesc { /** * Not used */ - private float[][] bmat; + private final float[][] bmat; /** * Sampling matrix */ - private float[][] smat; + private final float[][] smat; /** * Not used */ - private float[][] cmat; + private final float[][] cmat; /** * Not used */ - private float[] bboxsize; + private final float[] bboxsize; /** * Makes new mapdesc @@ -168,7 +168,7 @@ public class Mapdesc { * @param ncoords number of control points coords * @param backend backend object */ - public Mapdesc(int type, int rational, int ncoords, Backend backend) { + public Mapdesc(final int type, final int rational, final int ncoords, final Backend backend) { // DONE this.type = type; this.isrational = rational; @@ -210,7 +210,7 @@ public class Mapdesc { * Make matrix identity matrix * @param arr matrix */ - private void identify(float[][] arr) { + private void identify(final float[][] arr) { // DONE for (int i = 0; i < MAXCOORDS; i++) for (int j = 0; j < MAXCOORDS; j++) @@ -225,7 +225,7 @@ public class Mapdesc { * @param tag property tag * @return is/is not property */ - public boolean isProperty(int tag) { + public boolean isProperty(final int tag) { boolean ret; switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -347,7 +347,7 @@ public class Mapdesc { * @param tag property tag * @return property value */ - public float getProperty(int tag) { + public float getProperty(final int tag) { // TODO Auto-generated method stub // System.out.println("TODO mapdesc.getproperty"); return 0; @@ -358,7 +358,7 @@ public class Mapdesc { * @param tag property tag * @param value desired value */ - public void setProperty(int tag, float value) { + public void setProperty(final int tag, float value) { // TODO Auto-generated method stub switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -412,8 +412,8 @@ public class Mapdesc { * @param sp breakpoints * @param outstride output number of control points' coordinates */ - public void xformSampling(CArrayOfFloats pts, int order, int stride, - float[] sp, int outstride) { + public void xformSampling(final CArrayOfFloats pts, final int order, final int stride, + final float[] sp, final int outstride) { // DONE xFormMat(smat, pts, order, stride, sp, outstride); } @@ -427,8 +427,8 @@ public class Mapdesc { * @param cp breakpoints * @param outstride output number of control points' coordinates */ - private void xFormMat(float[][] mat, CArrayOfFloats pts, int order, - int stride, float[] cp, int outstride) { + private void xFormMat(final float[][] mat, final CArrayOfFloats pts, final int order, + final int stride, final float[] cp, final int outstride) { // TODO Auto-generated method stub // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats"); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java index af8024109..7f9d7c5a0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java @@ -48,13 +48,13 @@ public class Maplist { /** * Backend class */ - private Backend backend; + private final Backend backend; /** * Makes new Maplist * @param backend Backend class */ - public Maplist(Backend backend) { + public Maplist(final Backend backend) { this.backend = backend; } @@ -72,9 +72,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - public void define(int type, int rational, int ncoords) { + public void define(final int type, final int rational, final int ncoords) { // DONE - Mapdesc m = locate(type); + final Mapdesc m = locate(type); assert (m == null || (m.isrational == rational && m.ncoords == ncoords)); add(type, rational, ncoords); @@ -86,9 +86,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - private void add(int type, int rational, int ncoords) { + private void add(final int type, final int rational, final int ncoords) { // DONE - Mapdesc map = new Mapdesc(type, rational, ncoords, backend); + final Mapdesc map = new Mapdesc(type, rational, ncoords, backend); if (maps == null) { maps = map; } else { @@ -102,7 +102,7 @@ public class Maplist { * @param type map type * @return Mapdesc of type or null if there is no such map */ - public Mapdesc locate(int type) { + public Mapdesc locate(final int type) { // DONE Mapdesc m = null; for (m = maps; m != null; m = m.next) @@ -116,7 +116,7 @@ public class Maplist { * @param type maptype * @return Mapdesc of type or null if there is no such map */ - public Mapdesc find(int type) { + public Mapdesc find(final int type) { return locate(type); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java index a686da696..a957c21a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java @@ -70,7 +70,7 @@ public class O_nurbscurve { * Makes new O_nurbscurve * @param realType type of curve */ - public O_nurbscurve(int realType) { + public O_nurbscurve(final int realType) { // DONE this.type = realType; this.owner = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java index 867f43657..4df3c14ca 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java @@ -64,13 +64,13 @@ public class O_nurbssurface { /** * Surface type */ - private int type; + private final int type; /** * Makes new O_nurbssurface of type * @param type surface type */ - public O_nurbssurface(int type) { + public O_nurbssurface(final int type) { this.type = type; this.owner = null; this.next = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java index a44f2451c..0fd4baa81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java @@ -48,7 +48,7 @@ public class Patch { * @param ptb * @param patch */ - public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) { + public Patch(final Quilt q, final float[] pta, final float[] ptb, final Patch patch) { // System.out.println("TODO patch.constructor"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java index 240c905a2..68b01d8d0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java @@ -57,7 +57,7 @@ public class Patchlist { * @param pta low border * @param ptb high border */ - public Patchlist(Quilt quilts, float[] pta, float[] ptb) { + public Patchlist(final Quilt quilts, final float[] pta, final float[] ptb) { // DONE patch = null; @@ -81,7 +81,7 @@ public class Patchlist { * @param param * @param mid */ - public Patchlist(Patchlist patchlist, int param, float mid) { + public Patchlist(final Patchlist patchlist, final int param, final float mid) { // TODO Auto-generated constructor stub // System.out.println("TODO patchlist.konstruktor 2"); } @@ -120,7 +120,7 @@ public class Patchlist { * @param i * @return false */ - public boolean needsSubdivision(int i) { + public boolean needsSubdivision(final int i) { // TODO Auto-generated method stub // System.out.println("TODO patchlist.needsSubdivision"); return false; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java index 79f36ce43..155549bce 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java @@ -67,7 +67,7 @@ public class Property { * @param value * property value */ - public Property(int type, int tag, float value) { + public Property(final int type, final int tag, final float value) { this.type = type; this.tag = tag; this.value = value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java index bcbd20a16..8e04baf88 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java @@ -44,7 +44,7 @@ public class PwlArc { /** * Number of points */ - private int npts; + private final int npts; /** * Vertexes @@ -54,14 +54,14 @@ public class PwlArc { /** * Arc type */ - private int type; + private final int type; /** * Makes new trimming arc * @param i num ber of vertexes * @param p trimming vertexes array */ - public PwlArc(int i, TrimVertex[] p) { + public PwlArc(final int i, final TrimVertex[] p) { // DONE this.npts = i; this.pts = p; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java index 6bea4928c..2e2532a35 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java @@ -74,10 +74,10 @@ public class Quilt { * Makes new quilt with mapdesc * @param mapdesc map description */ - public Quilt(Mapdesc mapdesc) { + public Quilt(final Mapdesc mapdesc) { // DONE this.mapdesc = mapdesc; - Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; + final Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; for (int i = 0; i < tmpquilts.length; i++) tmpquilts[i] = new Quiltspec(); this.qspec = new CArrayOfQuiltspecs(tmpquilts); @@ -91,9 +91,9 @@ public class Quilt { * @param ctrlarr control points * @param coords control points coords */ - public void toBezier(Knotvector sknotvector, Knotvector tknotvector, - CArrayOfFloats ctrlarr, int coords) { - Splinespec spline = new Splinespec(2); + public void toBezier(final Knotvector sknotvector, final Knotvector tknotvector, + final CArrayOfFloats ctrlarr, final int coords) { + final Splinespec spline = new Splinespec(2); spline.kspecinit(sknotvector, tknotvector); spline.select(); spline.layout(coords); @@ -108,9 +108,9 @@ public class Quilt { * @param ctlarray control points * @param ncoords number of coordinates */ - public void toBezier(Knotvector knots, CArrayOfFloats ctlarray, int ncoords) { + public void toBezier(final Knotvector knots, final CArrayOfFloats ctlarray, final int ncoords) { // DONE - Splinespec spline = new Splinespec(1); + final Splinespec spline = new Splinespec(1); spline.kspecinit(knots); spline.select(); spline.layout(ncoords); @@ -125,7 +125,7 @@ public class Quilt { * @param ptb high border * @param backend Backend */ - public void downloadAll(float[] pta, float[] ptb, Backend backend) { + public void downloadAll(final float[] pta, final float[] ptb, final Backend backend) { // DONE for (Quilt m = this; m != null; m = m.next) { m.select(pta, ptb); @@ -138,11 +138,11 @@ public class Quilt { * Renders arcs/patches * @param backend Backend for rendering */ - private void download(Backend backend) { + private void download(final Backend backend) { // DONE if (getDimension() == 2) { - CArrayOfFloats ps = new CArrayOfFloats(cpts); + final CArrayOfFloats ps = new CArrayOfFloats(cpts); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(1).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order @@ -159,7 +159,7 @@ public class Quilt { } else {// code for curves // CArrayOfFloats ps=new CArrayOfFloats(cpts); - CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); + final CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order * qspec.get(0).stride); @@ -185,9 +185,9 @@ public class Quilt { * @param pta range * @param ptb range */ - private void select(float[] pta, float[] ptb) { + private void select(final float[] pta, final float[] ptb) { // DONE - int dim = eqspec.getPointer() - qspec.getPointer(); + final int dim = eqspec.getPointer() - qspec.getPointer(); int i, j; for (i = 0; i < dim; i++) { for (j = qspec.get(i).width - 1; j >= 0; j--) @@ -205,7 +205,7 @@ public class Quilt { * @param to high param * @param bpts breakpoints */ - public void getRange(float[] from, float[] to, Flist bpts) { + public void getRange(final float[] from, final float[] to, final Flist bpts) { // DONE getRange(from, to, 0, bpts); @@ -218,9 +218,9 @@ public class Quilt { * @param i from/to array index * @param list breakpoints */ - private void getRange(float[] from, float[] to, int i, Flist list) { + private void getRange(final float[] from, final float[] to, final int i, final Flist list) { // DONE - Quilt maps = this; + final Quilt maps = this; from[i] = maps.qspec.get(i).breakpoints[0]; to[i] = maps.qspec.get(i).breakpoints[maps.qspec.get(i).width]; int maxpts = 0; @@ -262,7 +262,7 @@ public class Quilt { * @param slist u direction breakpoints * @param tlist v direction breakpoints */ - public void getRange(float[] from, float[] to, Flist slist, Flist tlist) { + public void getRange(final float[] from, final float[] to, final Flist slist, final Flist tlist) { // DONE getRange(from, to, 0, slist); getRange(from, to, 1, tlist); @@ -275,7 +275,7 @@ public class Quilt { * @param tbrkpts * @param rate */ - public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) { + public void findRates(final Flist sbrkpts, final Flist tbrkpts, final float[] rate) { // TODO Auto-generated method stub // System.out.println("TODO quilt.findrates"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java index 7c636122f..5c180f345 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java @@ -85,7 +85,7 @@ public class Renderhints { * Set property value * @param prop property */ - public void setProperty(Property prop) { + public void setProperty(final Property prop) { switch (prop.type) { case NurbsConsts.N_DISPLAY: display_method = (int) prop.value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java index f1c779c2f..5e44c3259 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java @@ -44,7 +44,7 @@ public class Splinespec { /** * Dimension */ - private int dim; + private final int dim; /** * Knot vector specs @@ -60,7 +60,7 @@ public class Splinespec { * Makes new Splinespec with given dimension * @param i dimension */ - public Splinespec(int i) { + public Splinespec(final int i) { // DONE this.dim = i; } @@ -69,7 +69,7 @@ public class Splinespec { * Initializes knotspec according to knotvector * @param knotvector basic knotvector */ - public void kspecinit(Knotvector knotvector) { + public void kspecinit(final Knotvector knotvector) { // DONE this.kspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(knotvector.knotlist, 0); @@ -85,10 +85,10 @@ public class Splinespec { * @param sknotvector knotvector in u dir * @param tknotvector knotvector in v dir */ - public void kspecinit(Knotvector sknotvector, Knotvector tknotvector) { + public void kspecinit(final Knotvector sknotvector, final Knotvector tknotvector) { // DONE this.kspec = new Knotspec(); - Knotspec tkspec = new Knotspec(); + final Knotspec tkspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(sknotvector.knotlist, 0); kspec.inkend = new CArrayOfFloats(sknotvector.knotlist, @@ -121,7 +121,7 @@ public class Splinespec { * Prepares for conversion * @param ncoords number of coords */ - public void layout(int ncoords) { + public void layout(final int ncoords) { // DONE int stride = ncoords; for (Knotspec knotspec = kspec; knotspec != null; knotspec = knotspec.next) { @@ -143,9 +143,9 @@ public class Splinespec { * Prepares quilt for conversion * @param quilt quilt to work with */ - public void setupquilt(Quilt quilt) { + public void setupquilt(final Quilt quilt) { // DONE - CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); + final CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); quilt.eqspec = new CArrayOfQuiltspecs(qspec.getArray(), dim); for (Knotspec knotspec = kspec; knotspec != null;) { qspec.get().stride = knotspec.poststride; @@ -159,8 +159,8 @@ public class Splinespec { qspec.get().bdry[1] = (knotspec.kright.getPointer() == knotspec.klast .getPointer()) ? 1 : 0; qspec.get().breakpoints = new float[qspec.get().width + 1]; - CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); - for (CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk + final CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); + for (final CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk .getPointer() <= knotspec.bend.getPointer(); bk.pp()) { k.set(bk.get().value); k.pp(); @@ -177,7 +177,7 @@ public class Splinespec { * Copies array of control points to output array * @param ctlarray control points array */ - public void copy(CArrayOfFloats ctlarray) { + public void copy(final CArrayOfFloats ctlarray) { // DONE kspec.copy(ctlarray, outcpts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java index 4d8296cca..d7c1dbf3c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java @@ -148,7 +148,7 @@ public class Subdivider { /** * Initializes quilt list */ - public void beginQuilts(Backend backend) { + public void beginQuilts(final Backend backend) { // DONE qlist = null; renderhints = new Renderhints(); @@ -162,7 +162,7 @@ public class Subdivider { * Adds quilt to linked list * @param quilt added quilt */ - public void addQuilt(Quilt quilt) { + public void addQuilt(final Quilt quilt) { // DONE if (qlist == null) qlist = quilt; @@ -198,8 +198,8 @@ public class Subdivider { } } - float[] from = new float[2]; - float[] to = new float[2]; + final float[] from = new float[2]; + final float[] to = new float[2]; spbrkpts = new Flist(); tpbrkpts = new Flist(); @@ -215,7 +215,7 @@ public class Subdivider { makeBorderTrim(from, to); } } else { - float[] rate = new float[2]; + final float[] rate = new float[2]; qlist.findRates(spbrkpts, tpbrkpts, rate); // System.out.println("subdivider.drawsurfaces decompose"); } @@ -231,8 +231,8 @@ public class Subdivider { int num_v_steps; for (i = spbrkpts.start; i < spbrkpts.end - 1; i++) { for (j = tpbrkpts.start; j < tpbrkpts.end - 1; j++) { - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[i]; ptb[0] = spbrkpts.pts[i + 1]; @@ -266,7 +266,7 @@ public class Subdivider { * Empty method * @param initialbin2 */ - private void freejarcs(Bin initialbin2) { + private void freejarcs(final Bin initialbin2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.freejarcs"); } @@ -275,7 +275,7 @@ public class Subdivider { * Subdivide in U direction * @param source Trimming arcs source */ - private void subdivideInS(Bin source) { + private void subdivideInS(final Bin source) { // DONE if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM) { outline(source); @@ -294,13 +294,13 @@ public class Subdivider { * @param start breakpoints start * @param end breakpoints end */ - private void splitInS(Bin source, int start, int end) { + private void splitInS(final Bin source, final int start, final int end) { // DONE if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 0, spbrkpts.pts[i]); splitInS(left, start, i); @@ -329,15 +329,15 @@ public class Subdivider { * @param start * @param end */ - private void splitInT(Bin source, int start, int end) { + private void splitInT(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.splitint"); if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 1, tpbrkpts.pts[i + 1]); splitInT(left, start, i); splitInT(right, i + 1, end); @@ -352,8 +352,8 @@ public class Subdivider { setArcTypeBezier(); setDegenerate(); - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[s_index - 1]; pta[1] = tpbrkpts.pts[t_index - 1]; @@ -362,7 +362,7 @@ public class Subdivider { ptb[1] = tpbrkpts.pts[t_index]; qlist.downloadAll(pta, ptb, backend); - Patchlist patchlist = new Patchlist(qlist, pta, ptb); + final Patchlist patchlist = new Patchlist(qlist, pta, ptb); samplingSplit(source, patchlist, renderhints.maxsubdivisions, 0); @@ -381,8 +381,8 @@ public class Subdivider { * @param subdivisions * @param param */ - private void samplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void samplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (!source.isnonempty()) return; @@ -408,13 +408,13 @@ public class Subdivider { else param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); samplingSplit(left, subpatchlist, subdivisions - 1, param); samplingSplit(right, subpatchlist, subdivisions - 1, param); } else { @@ -433,18 +433,18 @@ public class Subdivider { * @param subdivisions * @param param */ - private void nonSamplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void nonSamplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (patchlist.needsNonSamplingSubdivision() && subdivisions > 0) { param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); if (left.isnonempty()) { if (subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT) freejarcs(left); @@ -483,7 +483,7 @@ public class Subdivider { * @param start * @param end */ - private void monosplitInS(Bin source, int start, int end) { + private void monosplitInS(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.monosplitins"); } @@ -492,7 +492,7 @@ public class Subdivider { * Not used * @param source */ - private void findIrregularS(Bin source) { + private void findIrregularS(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.findIrregularS"); } @@ -510,7 +510,7 @@ public class Subdivider { * @param source * @param patchlist */ - private void tesselation(Bin source, Patchlist patchlist) { + private void tesselation(final Bin source, final Patchlist patchlist) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.tesselation"); } @@ -531,19 +531,19 @@ public class Subdivider { * @param param * @param value */ - private void split(Bin bin, Bin left, Bin right, int param, float value) { + private void split(final Bin bin, final Bin left, final Bin right, final int param, final float value) { // DONE - Bin intersections = new Bin(); - Bin unknown = new Bin(); + final Bin intersections = new Bin(); + final Bin unknown = new Bin(); partition(bin, left, intersections, right, unknown, param, value); - int count = intersections.numarcs(); + final int count = intersections.numarcs(); // TODO jumpbuffer ?? if (count % 2 == 0) { - Arc[] arclist = new Arc[MAXARCS]; + final Arc[] arclist = new Arc[MAXARCS]; CArrayOfArcs list; if (count >= MAXARCS) { list = new CArrayOfArcs(new Arc[count]); @@ -559,7 +559,7 @@ public class Subdivider { last.set(jarc); if (param == 0) {// sort into incrasing t order - ArcSdirSorter sorter = new ArcSdirSorter(this); + final ArcSdirSorter sorter = new ArcSdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -578,7 +578,7 @@ public class Subdivider { } } else {// sort into decreasing s order - ArcTdirSorter sorter = new ArcTdirSorter(this); + final ArcTdirSorter sorter = new ArcTdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -609,7 +609,7 @@ public class Subdivider { * @param arc * @param relative */ - private void join_t(Bin left, Bin right, Arc arc, Arc relative) { + private void join_t(final Bin left, final Bin right, final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.join_t"); } @@ -619,7 +619,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_t(Arc arc, Arc relative) { + private void check_t(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_t"); } @@ -631,22 +631,22 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void join_s(Bin left, Bin right, Arc jarc1, Arc jarc2) { + private void join_s(final Bin left, final Bin right, Arc jarc1, Arc jarc2) { // DONE if (!jarc1.getitail()) jarc1 = jarc1.next; if (!jarc2.getitail()) jarc2 = jarc2.next; - float s = jarc1.tail()[0]; - float t1 = jarc1.tail()[1]; - float t2 = jarc2.tail()[1]; + final float s = jarc1.tail()[0]; + final float t1 = jarc1.tail()[1]; + final float t2 = jarc2.tail()[1]; if (t1 == t2) { simplelink(jarc1, jarc2); } else { - Arc newright = new Arc(Arc.ARC_RIGHT); - Arc newleft = new Arc(Arc.ARC_LEFT); + final Arc newright = new Arc(Arc.ARC_RIGHT); + final Arc newleft = new Arc(Arc.ARC_LEFT); if (isBezierArcType()) { arctesselator.bezier(newright, s, s, t1, t2); arctesselator.bezier(newleft, s, s, t2, t1); @@ -668,7 +668,7 @@ public class Subdivider { * @param newright * @param newleft */ - private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) { + private void link(final Arc jarc1, final Arc jarc2, final Arc newright, final Arc newleft) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.link"); } @@ -688,7 +688,7 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void simplelink(Arc jarc1, Arc jarc2) { + private void simplelink(final Arc jarc1, final Arc jarc2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.simplelink"); } @@ -698,7 +698,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_s(Arc arc, Arc relative) { + private void check_s(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_s"); @@ -714,17 +714,17 @@ public class Subdivider { * @param param * @param value */ - private void partition(Bin bin, Bin left, Bin intersections, Bin right, - Bin unknown, int param, float value) { + private void partition(final Bin bin, final Bin left, final Bin intersections, final Bin right, + final Bin unknown, final int param, final float value) { - Bin headonleft = new Bin(); - Bin headonright = new Bin(); - Bin tailonleft = new Bin(); - Bin tailonright = new Bin(); + final Bin headonleft = new Bin(); + final Bin headonright = new Bin(); + final Bin tailonleft = new Bin(); + final Bin tailonright = new Bin(); for (Arc jarc = bin.removearc(); jarc != null; jarc = bin.removearc()) { - float tdiff = jarc.tail()[param] - value; - float hdiff = jarc.head()[param] - value; + final float tdiff = jarc.tail()[param] - value; + final float hdiff = jarc.head()[param] - value; if (tdiff > 0) { if (hdiff > 0) { @@ -732,7 +732,7 @@ public class Subdivider { } else if (hdiff == 0) { tailonright.addarc(jarc); } else { - Arc jtemp; + final Arc jtemp; switch (arc_split(jarc, param, value, 0)) { case 2: tailonright.addarc(jarc); @@ -785,8 +785,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_tailonright_t(Bin tailonright, Bin intersections, - Bin right, float value) { + private void classify_tailonright_t(final Bin tailonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonright_t"); @@ -799,14 +799,14 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { in.addarc(j); } else if (diff < 0) { @@ -831,13 +831,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { if (ccwTurn_sr(j.prev, j)) out.addarc(j); @@ -860,7 +860,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sr(Arc prev, Arc j) { + private boolean ccwTurn_sr(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO ccwTurn_sr"); return false; @@ -873,8 +873,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_headonright_t(Bin headonright, Bin intersections, - Bin right, float value) { + private void classify_headonright_t(final Bin headonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_headonright_t"); } @@ -886,8 +886,8 @@ public class Subdivider { * @param left * @param value */ - private void classify_tailonleft_t(Bin tailonleft, Bin intersections, - Bin left, float value) { + private void classify_tailonleft_t(final Bin tailonleft, final Bin intersections, + final Bin left, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonleft_t"); } @@ -899,13 +899,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_t(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_t(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[1] - val; + final float diff = j.prev.tail()[1] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -928,7 +928,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_tl(Arc prev, Arc j) { + private boolean ccwTurn_tl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_tl"); return false; @@ -941,13 +941,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { if (ccwTurn_sr(j, j.next)) out.addarc(j); @@ -972,13 +972,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -1002,7 +1002,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sl(Arc prev, Arc j) { + private boolean ccwTurn_sl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_sl"); return false; @@ -1016,7 +1016,7 @@ public class Subdivider { * @param i * @return 0 */ - private int arc_split(Arc jarc, int param, float value, int i) { + private int arc_split(final Arc jarc, final int param, final float value, final int i) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.arc_split"); return 0; @@ -1043,7 +1043,7 @@ public class Subdivider { * Not used * @param source */ - private void outline(Bin source) { + private void outline(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.outline"); } @@ -1053,13 +1053,13 @@ public class Subdivider { * @param from range beginnings * @param to range ends */ - private void makeBorderTrim(float[] from, float[] to) { + private void makeBorderTrim(final float[] from, final float[] to) { // DONE - float smin = from[0]; - float smax = to[0]; + final float smin = from[0]; + final float smax = to[0]; - float tmin = from[1]; - float tmax = to[1]; + final float tmin = from[1]; + final float tmax = to[1]; pjarc = null; Arc jarc = null; @@ -1092,10 +1092,10 @@ public class Subdivider { */ public void drawCurves() { // DONE - float[] from = new float[1]; - float[] to = new float[1]; + final float[] from = new float[1]; + final float[] to = new float[1]; - Flist bpts = new Flist(); + final Flist bpts = new Flist(); qlist.getRange(from, to, bpts); renderhints.init(); @@ -1103,13 +1103,13 @@ public class Subdivider { backend.bgncurv(); for (int i = bpts.start; i < bpts.end - 1; i++) { - float[] pta = new float[1]; - float[] ptb = new float[1]; + final float[] pta = new float[1]; + final float[] ptb = new float[1]; pta[0] = bpts.pts[i]; ptb[0] = bpts.pts[i + 1]; qlist.downloadAll(pta, ptb, backend); - Curvelist curvelist = new Curvelist(qlist, pta, ptb); + final Curvelist curvelist = new Curvelist(qlist, pta, ptb); samplingSplit(curvelist, renderhints.maxsubdivisions); } backend.endcurv(); @@ -1120,7 +1120,7 @@ public class Subdivider { * @param curvelist list of curves * @param maxsubdivisions maximum number of subdivisions */ - private void samplingSplit(Curvelist curvelist, int maxsubdivisions) { + private void samplingSplit(final Curvelist curvelist, final int maxsubdivisions) { if (curvelist.cullCheck() == CULL_TRIVIAL_REJECT) return; @@ -1130,7 +1130,7 @@ public class Subdivider { // TODO kód // System.out.println("TODO subdivider-needsSamplingSubdivision"); } else { - int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); + final int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); backend.curvgrid(curvelist.range[0], curvelist.range[1], nu); backend.curvmesh(0, nu); } @@ -1142,7 +1142,7 @@ public class Subdivider { * @param d new domain_distance_u_rate value */ - public void set_domain_distance_u_rate(double d) { + public void set_domain_distance_u_rate(final double d) { // DONE domain_distance_u_rate = (float) d; } @@ -1151,7 +1151,7 @@ public class Subdivider { * Sets new domain_distance_v_rate value * @param d new domain_distance_v_rate value */ - public void set_domain_distance_v_rate(double d) { + public void set_domain_distance_v_rate(final double d) { // DONE domain_distance_v_rate = (float) d; } @@ -1160,7 +1160,7 @@ public class Subdivider { * Sets new is_domain_distance_sampling value * @param i new is_domain_distance_sampling value */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE this.is_domain_distance_sampling = i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java index 9c8523e51..5cae679a2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java +++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java @@ -56,7 +56,7 @@ public class Registry { public Registry() { } - public static String gluGetString(int name) { + public static String gluGetString(final int name) { if( name == GLU.GLU_VERSION ) { return( "1.3" ); } else if( name == GLU.GLU_EXTENSIONS ) { @@ -65,7 +65,7 @@ public class Registry { return( null ); } - public static boolean gluCheckExtension( String extName, String extString ) { + public static boolean gluCheckExtension( final String extName, final String extString ) { if( extName == null || extString == null ) { return( false ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java index 3ac9df67a..3bb759359 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java @@ -60,8 +60,8 @@ class Dict { private Dict() { } - static Dict dictNewDict(Object frame, DictLeq leq) { - Dict dict = new Dict(); + static Dict dictNewDict(final Object frame, final DictLeq leq) { + final Dict dict = new Dict(); dict.head = new DictNode(); dict.head.key = null; @@ -74,22 +74,22 @@ class Dict { return dict; } - static void dictDeleteDict(Dict dict) { + static void dictDeleteDict(final Dict dict) { dict.head = null; dict.frame = null; dict.leq = null; } - static DictNode dictInsert(Dict dict, Object key) { + static DictNode dictInsert(final Dict dict, final Object key) { return dictInsertBefore(dict, dict.head, key); } - static DictNode dictInsertBefore(Dict dict, DictNode node, Object key) { + static DictNode dictInsertBefore(final Dict dict, DictNode node, final Object key) { do { node = node.prev; } while (node.key != null && !dict.leq.leq(dict.frame, node.key, key)); - DictNode newNode = new DictNode(); + final DictNode newNode = new DictNode(); newNode.key = key; newNode.next = node.next; node.next.prev = newNode; @@ -99,32 +99,32 @@ class Dict { return newNode; } - static Object dictKey(DictNode aNode) { + static Object dictKey(final DictNode aNode) { return aNode.key; } - static DictNode dictSucc(DictNode aNode) { + static DictNode dictSucc(final DictNode aNode) { return aNode.next; } - static DictNode dictPred(DictNode aNode) { + static DictNode dictPred(final DictNode aNode) { return aNode.prev; } - static DictNode dictMin(Dict aDict) { + static DictNode dictMin(final Dict aDict) { return aDict.head.next; } - static DictNode dictMax(Dict aDict) { + static DictNode dictMax(final Dict aDict) { return aDict.head.prev; } - static void dictDelete(Dict dict, DictNode node) { + static void dictDelete(final Dict dict, final DictNode node) { node.next.prev = node.prev; node.prev.next = node.next; } - static DictNode dictSearch(Dict dict, Object key) { + static DictNode dictSearch(final Dict dict, final Object key) { DictNode node = dict.head; do { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java index 29944f9b2..a849058c8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java @@ -65,7 +65,7 @@ class GLUhalfEdge { public int winding; /* change in winding number when crossing */ public boolean first; - public GLUhalfEdge(boolean first) { + public GLUhalfEdge(final boolean first) { this.first = first; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index d594cb3eb..6f89a95f2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -177,11 +177,11 @@ public class GLUtessellatorImpl implements GLUtessellator { mesh = null; } - private void requireState(int newState) { + private void requireState(final int newState) { if (state != newState) gotoState(newState); } - private void gotoState(int newState) { + private void gotoState(final int newState) { while (state != newState) { /* We change the current state one level at a time, to get to * the desired state. @@ -211,7 +211,7 @@ public class GLUtessellatorImpl implements GLUtessellator { requireState(TessState.T_DORMANT); } - public void gluTessProperty(int which, double value) { + public void gluTessProperty(final int which, final double value) { switch (which) { case GLU.GLU_TESS_TOLERANCE: if (value < 0.0 || value > 1.0) break; @@ -219,7 +219,7 @@ public class GLUtessellatorImpl implements GLUtessellator { return; case GLU.GLU_TESS_WINDING_RULE: - int windingRule = (int) value; + final int windingRule = (int) value; if (windingRule != value) break; /* not an integer */ switch (windingRule) { @@ -250,7 +250,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } /* Returns tessellator property */ - public void gluGetTessProperty(int which, double[] value, int value_offset) { + public void gluGetTessProperty(final int which, final double[] value, final int value_offset) { switch (which) { case GLU.GLU_TESS_TOLERANCE: /* tolerance should be in range [0..1] */ @@ -279,13 +279,13 @@ public class GLUtessellatorImpl implements GLUtessellator { } } /* gluGetTessProperty() */ - public void gluTessNormal(double x, double y, double z) { + public void gluTessNormal(final double x, final double y, final double z) { normal[0] = x; normal[1] = y; normal[2] = z; } - public void gluTessCallback(int which, GLUtessellatorCallback aCallback) { + public void gluTessCallback(final int which, final GLUtessellatorCallback aCallback) { switch (which) { case GLU.GLU_TESS_BEGIN: callBegin = aCallback == null ? NULL_CB : aCallback; @@ -340,7 +340,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } } - private boolean addVertex(double[] coords, Object vertexData) { + private boolean addVertex(final double[] coords, final Object vertexData) { GLUhalfEdge e; e = lastEdge; @@ -377,12 +377,12 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - private void cacheVertex(double[] coords, Object vertexData) { + private void cacheVertex(final double[] coords, final Object vertexData) { if (cache[cacheCount] == null) { cache[cacheCount] = new CachedVertex(); } - CachedVertex v = cache[cacheCount]; + final CachedVertex v = cache[cacheCount]; v.data = vertexData; v.coords[0] = coords[0]; @@ -393,13 +393,13 @@ public class GLUtessellatorImpl implements GLUtessellator { private boolean flushCache() { - CachedVertex[] v = cache; + final CachedVertex[] v = cache; mesh = Mesh.__gl_meshNewMesh(); if (mesh == null) return false; for (int i = 0; i < cacheCount; i++) { - CachedVertex vertex = v[i]; + final CachedVertex vertex = v[i]; if (!addVertex(vertex.coords, vertex.data)) return false; } cacheCount = 0; @@ -408,11 +408,11 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) { + public void gluTessVertex(final double[] coords, final int coords_offset, final Object vertexData) { int i; boolean tooLarge = false; double x; - double[] clamped = new double[3]; + final double[] clamped = new double[3]; requireState(TessState.T_IN_CONTOUR); @@ -456,7 +456,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } - public void gluTessBeginPolygon(Object data) { + public void gluTessBeginPolygon(final Object data) { requireState(TessState.T_DORMANT); state = TessState.T_IN_POLYGON; @@ -573,7 +573,7 @@ public class GLUtessellatorImpl implements GLUtessellator { Mesh.__gl_meshDeleteMesh(mesh); polygonData = null; mesh = null; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); } @@ -590,7 +590,7 @@ public class GLUtessellatorImpl implements GLUtessellator { /*ARGSUSED*/ - public void gluNextContour(int type) { + public void gluNextContour(final int type) { gluTessEndContour(); gluTessBeginContour(); } @@ -601,21 +601,21 @@ public class GLUtessellatorImpl implements GLUtessellator { gluTessEndPolygon(); } - void callBeginOrBeginData(int a) { + void callBeginOrBeginData(final int a) { if (callBeginData != NULL_CB) callBeginData.beginData(a, polygonData); else callBegin.begin(a); } - void callVertexOrVertexData(Object a) { + void callVertexOrVertexData(final Object a) { if (callVertexData != NULL_CB) callVertexData.vertexData(a, polygonData); else callVertex.vertex(a); } - void callEdgeFlagOrEdgeFlagData(boolean a) { + void callEdgeFlagOrEdgeFlagData(final boolean a) { if (callEdgeFlagData != NULL_CB) callEdgeFlagData.edgeFlagData(a, polygonData); else @@ -629,14 +629,14 @@ public class GLUtessellatorImpl implements GLUtessellator { callEnd.end(); } - void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { + void callCombineOrCombineData(final double[] coords, final Object[] vertexData, final float[] weights, final Object[] outData) { if (callCombineData != NULL_CB) callCombineData.combineData(coords, vertexData, weights, outData, polygonData); else callCombine.combine(coords, vertexData, weights, outData); } - void callErrorOrErrorData(int a) { + void callErrorOrErrorData(final int a) { if (callErrorData != NULL_CB) callErrorData.errorData(a, polygonData); else diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java index 3da2d267e..493052f79 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java @@ -66,7 +66,7 @@ class Geom { * let r be the negated result (this evaluates (uw)(v->s)), then * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). */ - static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -85,7 +85,7 @@ class Geom { return 0; } - static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -105,7 +105,7 @@ class Geom { * Define versions of EdgeSign, EdgeEval with s and t transposed. */ - static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), * evaluates the t-coord of the edge uw at the s-coord of the vertex v. * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. @@ -134,7 +134,7 @@ class Geom { return 0; } - static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Returns a number whose sign matches TransEval(u,v,w) but which * is cheaper to evaluate. Returns > 0, == 0 , or < 0 * as v is above, on, or below the edge uw. @@ -154,7 +154,7 @@ class Geom { } - static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { + static boolean VertCCW(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* For almost-degenerate situations, the results are not reliable. * Unless the floating-point arithmetic can be performed without * rounding errors, *any* implementation will give incorrect results @@ -172,7 +172,7 @@ class Geom { * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate * even when a and b differ greatly in magnitude. */ - static double Interpolate(double a, double x, double b, double y) { + static double Interpolate(double a, final double x, double b, final double y) { a = (a < 0) ? 0 : a; b = (b < 0) ? 0 : b; if (a <= b) { @@ -188,7 +188,7 @@ class Geom { static void EdgeIntersect(GLUvertex o1, GLUvertex d1, GLUvertex o2, GLUvertex d2, - GLUvertex v) + final GLUvertex v) /* Given edges (o1,d1) and (o2,d2), compute their point of intersection. * The computed point is guaranteed to lie in the intersection of the * bounding rectangles defined by each edge. @@ -204,12 +204,12 @@ class Geom { */ if (!VertLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!VertLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -248,12 +248,12 @@ class Geom { /* Now repeat the process for t */ if (!TransLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!TransLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -290,29 +290,29 @@ class Geom { } } - static boolean VertEq(GLUvertex u, GLUvertex v) { + static boolean VertEq(final GLUvertex u, final GLUvertex v) { return u.s == v.s && u.t == v.t; } - static boolean VertLeq(GLUvertex u, GLUvertex v) { + static boolean VertLeq(final GLUvertex u, final GLUvertex v) { return u.s < v.s || (u.s == v.s && u.t <= v.t); } /* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ - static boolean TransLeq(GLUvertex u, GLUvertex v) { + static boolean TransLeq(final GLUvertex u, final GLUvertex v) { return u.t < v.t || (u.t == v.t && u.s <= v.s); } - static boolean EdgeGoesLeft(GLUhalfEdge e) { + static boolean EdgeGoesLeft(final GLUhalfEdge e) { return VertLeq(e.Sym.Org, e.Org); } - static boolean EdgeGoesRight(GLUhalfEdge e) { + static boolean EdgeGoesRight(final GLUhalfEdge e) { return VertLeq(e.Org, e.Sym.Org); } - static double VertL1dist(GLUvertex u, GLUvertex v) { + static double VertL1dist(final GLUvertex u, final GLUvertex v) { return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); } @@ -320,13 +320,13 @@ class Geom { // Compute the cosine of the angle between the edges between o and // v1 and between o and v2 - static double EdgeCos(GLUvertex o, GLUvertex v1, GLUvertex v2) { - double ov1s = v1.s - o.s; - double ov1t = v1.t - o.t; - double ov2s = v2.s - o.s; - double ov2t = v2.t - o.t; + static double EdgeCos(final GLUvertex o, final GLUvertex v1, final GLUvertex v2) { + final double ov1s = v1.s - o.s; + final double ov1t = v1.t - o.t; + final double ov2s = v2.s - o.s; + final double ov2t = v2.t - o.t; double dotp = ov1s * ov2s + ov1t * ov2t; - double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); + final double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); if (len > 0.0) { dotp /= len; } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java index eb48aa5a4..e855a5531 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java @@ -115,9 +115,9 @@ class Mesh { * depending on whether a and b belong to different face or vertex rings. * For more explanation see __gl_meshSplice() below. */ - static void Splice(jogamp.opengl.glu.tessellator.GLUhalfEdge a, jogamp.opengl.glu.tessellator.GLUhalfEdge b) { - jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; - jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; + static void Splice(final jogamp.opengl.glu.tessellator.GLUhalfEdge a, final jogamp.opengl.glu.tessellator.GLUhalfEdge b) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; + final jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; aOnext.Sym.Lnext = b; bOnext.Sym.Lnext = a; @@ -131,11 +131,11 @@ class Mesh { * the new vertex *before* vNext so that algorithms which walk the vertex * list will not see the newly created vertices. */ - static void MakeVertex(jogamp.opengl.glu.tessellator.GLUvertex newVertex, - jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUvertex vNext) { + static void MakeVertex(final jogamp.opengl.glu.tessellator.GLUvertex newVertex, + final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUvertex vNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUvertex vPrev; - jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; + final jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; assert (vNew != null); @@ -164,10 +164,10 @@ class Mesh { * the new face *before* fNext so that algorithms which walk the face * list will not see the newly created faces. */ - static void MakeFace(jogamp.opengl.glu.tessellator.GLUface newFace, jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUface fNext) { + static void MakeFace(final jogamp.opengl.glu.tessellator.GLUface newFace, final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUface fNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUface fPrev; - jogamp.opengl.glu.tessellator.GLUface fNew = newFace; + final jogamp.opengl.glu.tessellator.GLUface fNew = newFace; assert (fNew != null); @@ -218,8 +218,9 @@ class Mesh { /* KillVertex( vDel ) destroys a vertex and removes it from the global * vertex list. It updates the vertex loop to point to a given new vertex. */ - static void KillVertex(jogamp.opengl.glu.tessellator.GLUvertex vDel, jogamp.opengl.glu.tessellator.GLUvertex newOrg) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = vDel.anEdge; + static void KillVertex(final jogamp.opengl.glu.tessellator.GLUvertex vDel, final jogamp.opengl.glu.tessellator.GLUvertex newOrg) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = vDel.anEdge; jogamp.opengl.glu.tessellator.GLUvertex vPrev, vNext; /* change the origin of all affected edges */ @@ -239,8 +240,9 @@ class Mesh { /* KillFace( fDel ) destroys a face and removes it from the global face * list. It updates the face loop to point to a given new face. */ - static void KillFace(jogamp.opengl.glu.tessellator.GLUface fDel, jogamp.opengl.glu.tessellator.GLUface newLface) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = fDel.anEdge; + static void KillFace(final jogamp.opengl.glu.tessellator.GLUface fDel, final jogamp.opengl.glu.tessellator.GLUface newLface) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fDel.anEdge; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; /* change the left face of all affected edges */ @@ -263,10 +265,10 @@ class Mesh { /* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). * The loop consists of the two new half-edges. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); jogamp.opengl.glu.tessellator.GLUhalfEdge e; e = MakeEdge(mesh.eHead); @@ -302,7 +304,7 @@ class Mesh { * If eDst == eOrg->Onext, the new vertex will have a single edge. * If eDst == eOrg->Oprev, the old vertex will have a single edge. */ - public static boolean __gl_meshSplice(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + public static boolean __gl_meshSplice(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { boolean joiningLoops = false; boolean joiningVertices = false; @@ -323,7 +325,7 @@ class Mesh { Splice(eDst, eOrg); if (!joiningVertices) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); /* We split one vertex into two -- the new vertex is eDst.Org. * Make sure the old vertex points to a valid half-edge. @@ -332,7 +334,7 @@ class Mesh { eOrg.Org.anEdge = eOrg; } if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eDst.Lface. * Make sure the old face points to a valid half-edge. @@ -355,8 +357,8 @@ class Mesh { * plus a few calls to memFree, but this would allocate and delete * unnecessary vertices and faces. */ - static boolean __gl_meshDelete(jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; + static boolean __gl_meshDelete(final jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; boolean joiningLoops = false; /* First step: disconnect the origin vertex eDel.Org. We make all @@ -377,7 +379,7 @@ class Mesh { Splice(eDel, eDel.Sym.Lnext); if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We are splitting one loop into two -- create a new loop for eDel. */ MakeFace(newFace, eDel, eDel.Lface); @@ -415,9 +417,9 @@ class Mesh { * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. * eOrg and eNew will have the same left face. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -427,7 +429,7 @@ class Mesh { /* Set the vertex and face information */ eNew.Org = eOrg.Sym.Org; { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); MakeVertex(newVertex, eNewSym, eNew.Org); } @@ -441,9 +443,9 @@ class Mesh { * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. * eOrg and eNew will have the same left face. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNew; - jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); eNew = tempHalfEdge.Sym; @@ -472,10 +474,10 @@ class Mesh { * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; boolean joiningLoops = false; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -498,7 +500,7 @@ class Mesh { eOrg.Lface.anEdge = eNewSym; if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eNew.Lface */ MakeFace(newFace, eNew, eOrg.Lface); @@ -516,8 +518,8 @@ class Mesh { * An entire mesh can be deleted by zapping its faces, one at a time, * in any order. Zapped faces cannot be used in further mesh operations! */ - static void __gl_meshZapFace(jogamp.opengl.glu.tessellator.GLUface fZap) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; + static void __gl_meshZapFace(final jogamp.opengl.glu.tessellator.GLUface fZap) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext, eSym; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; @@ -566,7 +568,7 @@ class Mesh { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUhalfEdge eSym; - jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); + final jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); v = mesh.vHead; f = mesh.fHead; @@ -609,13 +611,13 @@ class Mesh { /* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in * both meshes, and returns the new mesh (the old meshes are destroyed). */ - static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(jogamp.opengl.glu.tessellator.GLUmesh mesh1, jogamp.opengl.glu.tessellator.GLUmesh mesh2) { - jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; - jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; + static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(final jogamp.opengl.glu.tessellator.GLUmesh mesh1, final jogamp.opengl.glu.tessellator.GLUmesh mesh2) { + final jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; + final jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ if (f2.next != f2) { @@ -645,8 +647,8 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - static void __gl_meshDeleteMeshZap(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + static void __gl_meshDeleteMeshZap(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; while (fHead.next != fHead) { __gl_meshZapFace(fHead.next); @@ -656,7 +658,7 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - public static void __gl_meshDeleteMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_meshDeleteMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f, fNext; jogamp.opengl.glu.tessellator.GLUvertex v, vNext; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext; @@ -677,10 +679,10 @@ class Mesh { /* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. */ - public static void __gl_meshCheckMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; + public static void __gl_meshCheckMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; jogamp.opengl.glu.tessellator.GLUface f, fPrev; jogamp.opengl.glu.tessellator.GLUvertex v, vPrev; jogamp.opengl.glu.tessellator.GLUhalfEdge e, ePrev; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java index 196e6cf27..44668a943 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java @@ -83,11 +83,11 @@ class Normal { } } - private static double Dot(double[] u, double[] v) { + private static double Dot(final double[] u, final double[] v) { return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); } - static void Normalize(double[] v) { + static void Normalize(final double[] v) { double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; assert (len > 0); @@ -97,7 +97,7 @@ class Normal { v[2] /= len; } - static int LongAxis(double[] v) { + static int LongAxis(final double[] v) { int i = 0; if (Math.abs(v[1]) > Math.abs(v[0])) { @@ -109,12 +109,12 @@ class Normal { return i; } - static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) { + static void ComputeNormal(final GLUtessellatorImpl tess, final double[] norm) { jogamp.opengl.glu.tessellator.GLUvertex v, v1, v2; double c, tLen2, maxLen2; double[] maxVal, minVal, d1, d2, tNorm; jogamp.opengl.glu.tessellator.GLUvertex[] maxVert, minVert; - jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; int i; maxVal = new double[3]; @@ -192,10 +192,12 @@ class Normal { } } - static void CheckOrientation(GLUtessellatorImpl tess) { + static void CheckOrientation(final GLUtessellatorImpl tess) { double area; - jogamp.opengl.glu.tessellator.GLUface f, fHead = tess.mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + jogamp.opengl.glu.tessellator.GLUface f; + final jogamp.opengl.glu.tessellator.GLUface fHead = tess.mesh.fHead; + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; jogamp.opengl.glu.tessellator.GLUhalfEdge e; /* When we compute the normal automatically, we choose the orientation @@ -224,10 +226,11 @@ class Normal { /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ - public static void __gl_projectPolygon(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + public static void __gl_projectPolygon(final GLUtessellatorImpl tess) { + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; double w; - double[] norm = new double[3]; + final double[] norm = new double[3]; double[] sUnit, tUnit; int i; boolean computedNormal = false; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java index 25405ad64..1f9b9e5ed 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java @@ -75,11 +75,11 @@ abstract class PriorityQ { // #else /* Violates modularity, but a little faster */ // #include "geom.h" - public static boolean LEQ(Leq leq, Object x, Object y) { + public static boolean LEQ(final Leq leq, final Object x, final Object y) { return jogamp.opengl.glu.tessellator.Geom.VertLeq((jogamp.opengl.glu.tessellator.GLUvertex) x, (jogamp.opengl.glu.tessellator.GLUvertex) y); } - static PriorityQ pqNewPriorityQ(Leq leq) { + static PriorityQ pqNewPriorityQ(final Leq leq) { return new PriorityQSort(leq); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java index 1ac0fd438..74d981907 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java @@ -61,7 +61,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; /* really __gl_pqHeapNewPriorityQ */ - public PriorityQHeap(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQHeap(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { size = 0; max = jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE; nodes = new jogamp.opengl.glu.tessellator.PriorityQ.PQnode[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE + 1]; @@ -88,8 +88,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } void FloatDown(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hChild; int child; @@ -117,8 +117,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { void FloatUp(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hParent; int parent; @@ -155,19 +155,19 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; int free; curr = ++size; if ((curr * 2) > max) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; /* If the heap overflows, double its size. */ max <<= 1; // pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); - PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; + final PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); for (int i = nodes.length; i < pqNodes.length; i++) { pqNodes[i] = new PQnode(); @@ -179,7 +179,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } // pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); - PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; + final PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; System.arraycopy( handles, 0, pqHandles, 0, handles.length ); for (int i = handles.length; i < pqHandles.length; i++) { pqHandles[i] = new PQhandleElem(); @@ -212,10 +212,10 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapExtractMin */ @Override Object pqExtractMin() { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; - int hMin = n[1].handle; - Object min = h[hMin].key; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final int hMin = n[1].handle; + final Object min = h[hMin].key; if (size > 0) { n[1].handle = n[size].handle; @@ -234,9 +234,9 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapDelete */ @Override - void pqDelete(int hCurr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + void pqDelete(final int hCurr) { + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int curr; assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java index cf54b15c3..45e994b67 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java @@ -59,7 +59,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean initialized; jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; - public PriorityQSort(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQSort(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { heap = new jogamp.opengl.glu.tessellator.PriorityQHeap(leq); keys = new Object[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE]; @@ -78,17 +78,17 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { keys = null; } - private static boolean LT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, y, x)); + private static boolean LT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, y, x)); } - private static boolean GT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, x, y)); + private static boolean GT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, x, y)); } - private static void Swap(int[] array, int a, int b) { + private static void Swap(final int[] array, final int a, final int b) { if (true) { - int tmp = array[a]; + final int tmp = array[a]; array[a] = array[b]; array[b] = tmp; } else { @@ -105,7 +105,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean pqInit() { int p, r, i, j; int piv; - Stack[] stack = new Stack[50]; + final Stack[] stack = new Stack[50]; for (int k = 0; k < stack.length; k++) { stack[k] = new Stack(); } @@ -194,7 +194,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqSortInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; if (initialized) { @@ -202,12 +202,12 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } curr = size; if (++size >= max) { - Object[] saveKey = keys; + final Object[] saveKey = keys; /* If the heap overflows, double its size. */ max <<= 1; // pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); - Object[] pqKeys = new Object[max]; + final Object[] pqKeys = new Object[max]; System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; if (keys == null) { @@ -254,7 +254,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { sortMin = keys[order[size - 1]]; if (!heap.pqIsEmpty()) { heapMin = heap.pqMinimum(); - if (jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) { + if (PriorityQ.LEQ(leq, heapMin, sortMin)) { return heapMin; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java index a2e973508..6325de8d2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java @@ -73,7 +73,7 @@ class Render { public FaceCount() { } - public FaceCount(long size, jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, renderCallBack render) { + public FaceCount(final long size, final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, final renderCallBack render) { this.size = size; this.eStart = eStart; this.render = render; @@ -97,7 +97,7 @@ class Render { * * The rendering output is provided as callbacks (see the api). */ - public static void __gl_renderMesh(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderMesh(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; /* Make a list of separate triangles so we can render them all at once */ @@ -124,7 +124,7 @@ class Render { } - static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface fOrig) { + static void RenderMaximumFaceGroup(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUface fOrig) { /* We want to find the largest triangle fan or strip of unmarked faces * which includes the given face fOrig. There are 3 possible fans * passing through fOrig (one centered at each vertex), and 3 possible @@ -132,7 +132,7 @@ class Render { * is to try all of these, and take the primitive which uses the most * triangles (a greedy approach). */ - jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; FaceCount max = new FaceCount(); FaceCount newFace = new FaceCount(); @@ -178,11 +178,11 @@ class Render { * more complicated, and we need a general tracking method like the * one here. */ - private static boolean Marked(jogamp.opengl.glu.tessellator.GLUface f) { + private static boolean Marked(final jogamp.opengl.glu.tessellator.GLUface f) { return !f.inside || f.marked; } - private static GLUface AddToTrail(jogamp.opengl.glu.tessellator.GLUface f, jogamp.opengl.glu.tessellator.GLUface t) { + private static GLUface AddToTrail(final jogamp.opengl.glu.tessellator.GLUface f, final jogamp.opengl.glu.tessellator.GLUface t) { f.trail = t; f.marked = true; return f; @@ -199,12 +199,12 @@ class Render { } } - static FaceCount MaximumFan(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumFan(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* eOrig.Lface is the face we want to render. We want to find the size * of a maximal fan around eOrig.Org. To do this we just walk around * the origin vertex as far as possible in both directions. */ - FaceCount newFace = new FaceCount(0, null, renderFan); + final FaceCount newFace = new FaceCount(0, null, renderFan); jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -223,11 +223,11 @@ class Render { } - private static boolean IsEven(long n) { + private static boolean IsEven(final long n) { return (n & 0x1L) == 0; } - static FaceCount MaximumStrip(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumStrip(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* Here we are looking for a maximal strip that contains the vertices * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the * reverse, such that all triangles are oriented CCW). @@ -238,7 +238,7 @@ class Render { * We walk the strip starting on a side with an even number of triangles; * if both side have an odd number, we are forced to shorten one side. */ - FaceCount newFace = new FaceCount(0, null, renderStrip); + final FaceCount newFace = new FaceCount(0, null, renderStrip); long headSize = 0, tailSize = 0; jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eTail, eHead; @@ -280,7 +280,7 @@ class Render { private static class RenderTriangle implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUhalfEdge e, final long size) { /* Just add the triangle to a triangle list, so we can render all * the separate triangles at once. */ @@ -290,7 +290,7 @@ class Render { } - static void RenderLonelyTriangles(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { + static void RenderLonelyTriangles(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { /* Now we render all the separate triangles which could not be * grouped into a triangle fan or strip. */ @@ -325,7 +325,7 @@ class Render { private static class RenderFan implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a fan starting from * edge "e". The fan *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -348,7 +348,7 @@ class Render { private static class RenderStrip implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a strip starting from * edge "e". The strip *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -381,7 +381,7 @@ class Render { * contour for each face marked "inside". The rendering output is * provided as callbacks (see the api). */ - public static void __gl_renderBoundary(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderBoundary(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -403,7 +403,7 @@ class Render { private static final int SIGN_INCONSISTENT = 2; - static int ComputeNormal(GLUtessellatorImpl tess, double[] norm, boolean check) + static int ComputeNormal(final GLUtessellatorImpl tess, final double[] norm, final boolean check) /* * If check==false, we compute the polygon normal and place it in norm[]. * If check==true, we check that each triangle in the fan from v0 has a @@ -412,13 +412,13 @@ class Render { * are degenerate return 0; otherwise (no consistent orientation) return * SIGN_INCONSISTENT. */ { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; double dot, xc, yc, zc, xp, yp, zp; - double[] n = new double[3]; + final double[] n = new double[3]; int sign = 0; /* Find the polygon normal. It is important to get a reasonable @@ -490,13 +490,13 @@ class Render { * Returns true if the polygon was successfully rendered. The rendering * output is provided as callbacks (see the api). */ - public static boolean __gl_renderCache(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + public static boolean __gl_renderCache(final GLUtessellatorImpl tess) { + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; - double[] norm = new double[3]; + final double[] norm = new double[3]; int sign; if (tess.cacheCount < 3) { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index d2c0db61e..9cf05378c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -62,7 +62,7 @@ class Sweep { // #ifdef FOR_TRITE_TEST_PROGRAM // extern void DebugEvent( GLUtessellator *tess ); // #else - private static void DebugEvent(GLUtessellatorImpl tess) { + private static void DebugEvent(final GLUtessellatorImpl tess) { } // #endif @@ -100,21 +100,21 @@ class Sweep { /* When we merge two edges into one, we need to compute the combined * winding of the new edge. */ - private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { + private static void AddWinding(final GLUhalfEdge eDst, final GLUhalfEdge eSrc) { eDst.winding += eSrc.winding; eDst.Sym.winding += eSrc.Sym.winding; } - private static ActiveRegion RegionBelow(ActiveRegion r) { + private static ActiveRegion RegionBelow(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); } - private static ActiveRegion RegionAbove(ActiveRegion r) { + private static ActiveRegion RegionAbove(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); } - static boolean EdgeLeq(GLUtessellatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) + static boolean EdgeLeq(final GLUtessellatorImpl tess, final ActiveRegion reg1, final ActiveRegion reg2) /* * Both edges must be directed from right to left (this is the canonical * direction for the upper edge of each region). @@ -126,7 +126,7 @@ class Sweep { * Special case: if both edge destinations are at the sweep event, * we sort the edges by slope (they would otherwise compare equally). */ { - GLUvertex event = tess.event; + final GLUvertex event = tess.event; GLUhalfEdge e1, e2; double t1, t2; @@ -156,7 +156,7 @@ class Sweep { } - static void DeleteRegion(GLUtessellatorImpl tess, ActiveRegion reg) { + static void DeleteRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) { if (reg.fixUpperEdge) { /* It was created with zero winding number, so it better be * deleted with zero winding number (ie. it better not get merged @@ -169,7 +169,7 @@ class Sweep { } - static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) + static boolean FixUpperEdge(final ActiveRegion reg, final GLUhalfEdge newEdge) /* * Replace an upper edge which needs fixing (see ConnectRightVertex). */ { @@ -183,7 +183,7 @@ class Sweep { } static ActiveRegion TopLeftRegion(ActiveRegion reg) { - GLUvertex org = reg.eUp.Org; + final GLUvertex org = reg.eUp.Org; GLUhalfEdge e; /* Find the region above the uppermost edge with the same origin */ @@ -204,7 +204,7 @@ class Sweep { } static ActiveRegion TopRightRegion(ActiveRegion reg) { - GLUvertex dst = reg.eUp.Sym.Org; + final GLUvertex dst = reg.eUp.Sym.Org; /* Find the region above the uppermost edge with the same destination */ do { @@ -213,16 +213,16 @@ class Sweep { return reg; } - static ActiveRegion AddRegionBelow(GLUtessellatorImpl tess, - ActiveRegion regAbove, - GLUhalfEdge eNewUp) + static ActiveRegion AddRegionBelow(final GLUtessellatorImpl tess, + final ActiveRegion regAbove, + final GLUhalfEdge eNewUp) /* * Add a new active region to the sweep line, *somewhere* below "regAbove" * (according to where the new edge belongs in the sweep-line dictionary). * The upper edge of the new region will be "eNewUp". * Winding number and "inside" flag are not updated. */ { - ActiveRegion regNew = new ActiveRegion(); + final ActiveRegion regNew = new ActiveRegion(); if (regNew == null) throw new RuntimeException(); regNew.eUp = eNewUp; @@ -237,7 +237,7 @@ class Sweep { return regNew; } - static boolean IsWindingInside(GLUtessellatorImpl tess, int n) { + static boolean IsWindingInside(final GLUtessellatorImpl tess, final int n) { switch (tess.windingRule) { case GLU.GLU_TESS_WINDING_ODD: return (n & 1) != 0; @@ -257,13 +257,13 @@ class Sweep { } - static void ComputeWinding(GLUtessellatorImpl tess, ActiveRegion reg) { + static void ComputeWinding(final GLUtessellatorImpl tess, final ActiveRegion reg) { reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; reg.inside = IsWindingInside(tess, reg.windingNumber); } - static void FinishRegion(GLUtessellatorImpl tess, ActiveRegion reg) + static void FinishRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) /* * Delete a region from the sweep line. This happens when the upper * and lower chains of a region meet (at a vertex on the sweep line). @@ -271,8 +271,8 @@ class Sweep { * not do this before -- since the structure of the mesh is always * changing, this face may not have even existed until now). */ { - GLUhalfEdge e = reg.eUp; - GLUface f = e.Lface; + final GLUhalfEdge e = reg.eUp; + final GLUface f = e.Lface; f.inside = reg.inside; f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ @@ -280,8 +280,8 @@ class Sweep { } - static GLUhalfEdge FinishLeftRegions(GLUtessellatorImpl tess, - ActiveRegion regFirst, ActiveRegion regLast) + static GLUhalfEdge FinishLeftRegions(final GLUtessellatorImpl tess, + final ActiveRegion regFirst, final ActiveRegion regLast) /* * We are given a vertex with one or more left-going edges. All affected * edges should be in the edge dictionary. Starting at regFirst.eUp, @@ -335,9 +335,9 @@ class Sweep { } - static void AddRightEdges(GLUtessellatorImpl tess, ActiveRegion regUp, - GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, - boolean cleanUp) + static void AddRightEdges(final GLUtessellatorImpl tess, final ActiveRegion regUp, + final GLUhalfEdge eFirst, final GLUhalfEdge eLast, GLUhalfEdge eTopLeft, + final boolean cleanUp) /* * Purpose: insert right-going edges into the edge dictionary, and update * winding numbers and mesh connectivity appropriately. All right-going @@ -406,16 +406,16 @@ class Sweep { } - static void CallCombine(GLUtessellatorImpl tess, GLUvertex isect, - Object[] data, float[] weights, boolean needed) { - double[] coords = new double[3]; + static void CallCombine(final GLUtessellatorImpl tess, final GLUvertex isect, + final Object[] data, final float[] weights, final boolean needed) { + final double[] coords = new double[3]; /* Copy coord data in case the callback changes it. */ coords[0] = isect.coords[0]; coords[1] = isect.coords[1]; coords[2] = isect.coords[2]; - Object[] outData = new Object[1]; + final Object[] outData = new Object[1]; tess.callCombineOrCombineData(coords, data, weights, outData); isect.data = outData[0]; if (isect.data == null) { @@ -432,14 +432,14 @@ class Sweep { } } - static void SpliceMergeVertices(GLUtessellatorImpl tess, GLUhalfEdge e1, - GLUhalfEdge e2) + static void SpliceMergeVertices(final GLUtessellatorImpl tess, final GLUhalfEdge e1, + final GLUhalfEdge e2) /* * Two vertices with idential coordinates are combined into one. * e1.Org is kept, while e2.Org is discarded. */ { - Object[] data = new Object[4]; - float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; + final Object[] data = new Object[4]; + final float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; data[0] = e1.Org.data; data[1] = e2.Org.data; @@ -447,8 +447,8 @@ class Sweep { if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); } - static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, - float[] weights) + static void VertexWeights(final GLUvertex isect, final GLUvertex org, final GLUvertex dst, + final float[] weights) /* * Find some weights which describe how the intersection vertex is * a linear combination of "org" and "dest". Each of the two edges @@ -456,8 +456,8 @@ class Sweep { * splits the weight between its org and dst according to the * relative distance to "isect". */ { - double t1 = Geom.VertL1dist(org, isect); - double t2 = Geom.VertL1dist(dst, isect); + final double t1 = Geom.VertL1dist(org, isect); + final double t2 = Geom.VertL1dist(dst, isect); weights[0] = (float) (0.5 * t2 / (t1 + t2)); weights[1] = (float) (0.5 * t1 / (t1 + t2)); @@ -467,18 +467,18 @@ class Sweep { } - static void GetIntersectData(GLUtessellatorImpl tess, GLUvertex isect, - GLUvertex orgUp, GLUvertex dstUp, - GLUvertex orgLo, GLUvertex dstLo) + static void GetIntersectData(final GLUtessellatorImpl tess, final GLUvertex isect, + final GLUvertex orgUp, final GLUvertex dstUp, + final GLUvertex orgLo, final GLUvertex dstLo) /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the * rendering callbacks. */ { - Object[] data = new Object[4]; - float[] weights = new float[4]; - float[] weights1 = new float[2]; - float[] weights2 = new float[2]; + final Object[] data = new Object[4]; + final float[] weights = new float[4]; + final float[] weights1 = new float[2]; + final float[] weights2 = new float[2]; data[0] = orgUp.data; data[1] = dstUp.data; @@ -494,7 +494,7 @@ class Sweep { CallCombine(tess, isect, data, weights, true); } - static boolean CheckForRightSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForRightSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which @@ -520,9 +520,9 @@ class Sweep { * This is a guaranteed solution, no matter how degenerate things get. * Basically this is a combinatorial solution to a numerical problem. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; if (Geom.VertLeq(eUp.Org, eLo.Org)) { if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; @@ -550,7 +550,7 @@ class Sweep { return true; } - static boolean CheckForLeftSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForLeftSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which @@ -569,9 +569,9 @@ class Sweep { * We fix the problem by just splicing the offending vertex into the * other edge. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; GLUhalfEdge e; assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); @@ -599,7 +599,7 @@ class Sweep { } - static boolean CheckForIntersect(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForIntersect(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edges of the given region to see if * they intersect. If so, create the intersection and add it @@ -612,12 +612,12 @@ class Sweep { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; - GLUvertex orgUp = eUp.Org; - GLUvertex orgLo = eLo.Org; - GLUvertex dstUp = eUp.Sym.Org; - GLUvertex dstLo = eLo.Sym.Org; + final GLUvertex orgUp = eUp.Org; + final GLUvertex orgLo = eLo.Org; + final GLUvertex dstUp = eUp.Sym.Org; + final GLUvertex dstLo = eLo.Sym.Org; double tMinUp, tMaxLo; - GLUvertex isect = new GLUvertex(); + final GLUvertex isect = new GLUvertex(); GLUvertex orgMin; GLUhalfEdge e; @@ -752,7 +752,7 @@ class Sweep { return false; } - static void WalkDirtyRegions(GLUtessellatorImpl tess, ActiveRegion regUp) + static void WalkDirtyRegions(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * When the upper or lower edge of any region changes, the region is * marked "dirty". This routine walks through all the dirty regions @@ -837,7 +837,7 @@ class Sweep { } - static void ConnectRightVertex(GLUtessellatorImpl tess, ActiveRegion regUp, + static void ConnectRightVertex(final GLUtessellatorImpl tess, ActiveRegion regUp, GLUhalfEdge eBottomLeft) /* * Purpose: connect a "right" vertex vEvent (one where all edges go left) @@ -872,9 +872,9 @@ class Sweep { */ { GLUhalfEdge eNew; GLUhalfEdge eTopLeft = eBottomLeft.Onext; - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; boolean degenerate = false; if (eUp.Sym.Org != eLo.Sym.Org) { @@ -930,8 +930,8 @@ class Sweep { */ private static final boolean TOLERANCE_NONZERO = false; - static void ConnectLeftDegenerate(GLUtessellatorImpl tess, - ActiveRegion regUp, GLUvertex vEvent) + static void ConnectLeftDegenerate(final GLUtessellatorImpl tess, + ActiveRegion regUp, final GLUvertex vEvent) /* * The event vertex lies exacty on an already-processed edge or vertex. * Adding the new vertex involves splicing it into the already-processed @@ -989,7 +989,7 @@ class Sweep { } - static void ConnectLeftVertex(GLUtessellatorImpl tess, GLUvertex vEvent) + static void ConnectLeftVertex(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Purpose: connect a "left" vertex (one where both edges go right) * to the processed portion of the mesh. Let R be the active region @@ -1007,7 +1007,7 @@ class Sweep { */ { ActiveRegion regUp, regLo, reg; GLUhalfEdge eUp, eLo, eNew; - ActiveRegion tmp = new ActiveRegion(); + final ActiveRegion tmp = new ActiveRegion(); /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ @@ -1035,7 +1035,7 @@ class Sweep { eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); if (eNew == null) throw new RuntimeException(); } else { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); if (tempHalfEdge == null) throw new RuntimeException(); eNew = tempHalfEdge.Sym; @@ -1055,7 +1055,7 @@ class Sweep { } - static void SweepEvent(GLUtessellatorImpl tess, GLUvertex vEvent) + static void SweepEvent(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Does everything necessary when the sweep line crosses a vertex. * Updates the mesh and the edge dictionary. @@ -1114,13 +1114,13 @@ class Sweep { */ private static final double SENTINEL_COORD = (4.0 * GLU.GLU_TESS_MAX_COORD); - static void AddSentinel(GLUtessellatorImpl tess, double t) + static void AddSentinel(final GLUtessellatorImpl tess, final double t) /* * We add two sentinel edges above and below all other edges, * to avoid special cases at the top and bottom. */ { GLUhalfEdge e; - ActiveRegion reg = new ActiveRegion(); + final ActiveRegion reg = new ActiveRegion(); if (reg == null) throw new RuntimeException(); e = Mesh.__gl_meshMakeEdge(tess.mesh); @@ -1151,7 +1151,7 @@ class Sweep { /* __gl_dictListNewDict */ tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { @Override - public boolean leq(Object frame, Object key1, Object key2) { + public boolean leq(final Object frame, final Object key1, final Object key2) { return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); } }); @@ -1162,7 +1162,7 @@ class Sweep { } - static void DoneEdgeDict(GLUtessellatorImpl tess) { + static void DoneEdgeDict(final GLUtessellatorImpl tess) { ActiveRegion reg; int fixedEdges = 0; @@ -1185,12 +1185,12 @@ class Sweep { } - static void RemoveDegenerateEdges(GLUtessellatorImpl tess) + static void RemoveDegenerateEdges(final GLUtessellatorImpl tess) /* * Remove zero-length edges, and contours with fewer than 3 vertices. */ { GLUhalfEdge e, eNext, eLnext; - GLUhalfEdge eHead = tess.mesh.eHead; + final GLUhalfEdge eHead = tess.mesh.eHead; /*LINTED*/ for (e = eHead.next; e != eHead; e = eNext) { @@ -1222,7 +1222,7 @@ class Sweep { } } - static boolean InitPriorityQ(GLUtessellatorImpl tess) + static boolean InitPriorityQ(final GLUtessellatorImpl tess) /* * Insert all vertices into the priority queue which determines the * order in which vertices cross the sweep line. @@ -1233,7 +1233,7 @@ class Sweep { /* __gl_pqSortNewPriorityQ */ pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { @Override - public boolean leq(Object key1, Object key2) { + public boolean leq(final Object key1, final Object key2) { return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); } }); @@ -1254,12 +1254,12 @@ class Sweep { } - static void DonePriorityQ(GLUtessellatorImpl tess) { + static void DonePriorityQ(final GLUtessellatorImpl tess) { tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ } - static boolean RemoveDegenerateFaces(GLUmesh mesh) + static boolean RemoveDegenerateFaces(final GLUmesh mesh) /* * Delete any degenerate faces with only two edges. WalkDirtyRegions() * will catch almost all of these, but it won't catch degenerate faces @@ -1292,7 +1292,7 @@ class Sweep { return true; } - public static boolean __gl_computeInterior(GLUtessellatorImpl tess) + public static boolean __gl_computeInterior(final GLUtessellatorImpl tess) /* * __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java index 5db543c80..63994ba82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java @@ -80,7 +80,7 @@ class TessMono { * to the fan is a simple orientation test. By making the fan as large * as possible, we restore the invariant (check it yourself). */ - static boolean __gl_meshTessellateMonoRegion(GLUface face, boolean avoidDegenerateTris) { + static boolean __gl_meshTessellateMonoRegion(final GLUface face, final boolean avoidDegenerateTris) { GLUhalfEdge up, lo; /* All edges are oriented CCW around the boundary of the region. @@ -135,7 +135,7 @@ class TessMono { */ while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); mustConnect = false; if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; @@ -145,7 +145,7 @@ class TessMono { /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); mustConnect = false; if (tempHalfEdge == null) return false; up = tempHalfEdge.Sym; @@ -159,7 +159,7 @@ class TessMono { */ assert (lo.Lnext != up); while (lo.Lnext.Lnext != up) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; } @@ -172,7 +172,7 @@ class TessMono { * the mesh which is marked "inside" the polygon. Each such region * must be monotone. */ - public static boolean __gl_meshTessellateInterior(GLUmesh mesh, boolean avoidDegenerateTris) { + public static boolean __gl_meshTessellateInterior(final GLUmesh mesh, final boolean avoidDegenerateTris) { GLUface f, next; /*LINTED*/ @@ -193,7 +193,7 @@ class TessMono { * on NULL faces are not allowed, the main purpose is to clean up the * mesh so that exterior loops are not represented in the data structure. */ - public static void __gl_meshDiscardExterior(GLUmesh mesh) { + public static void __gl_meshDiscardExterior(final GLUmesh mesh) { GLUface f, next; /*LINTED*/ @@ -216,7 +216,7 @@ class TessMono { * If keepOnlyBoundary is TRUE, it also deletes all edges which do not * separate an interior region from an exterior one. */ - public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { + public static boolean __gl_meshSetWindingNumber(final GLUmesh mesh, final int value, final boolean keepOnlyBoundary) { GLUhalfEdge e, eNext; for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index dadad1e15..a6ab635e4 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -59,6 +59,7 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.opengl.GLContextImpl; @@ -107,9 +108,9 @@ public class MacOSXCGLContext extends GLContextImpl isMavericksOrLater = osvn.compareTo(Platform.OSXVersion.Mavericks) >= 0; } - static boolean isGLProfileSupported(int ctp, int major, int minor) { - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; + static boolean isGLProfileSupported(final int ctp, final int major, final int minor) { + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; // We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2 if( 3 < major || 3 == major && 1 <= minor ) { @@ -135,7 +136,7 @@ public class MacOSXCGLContext extends GLContextImpl } return false; // 3.0 && > 3.2 } - static int GLProfile2CGLOGLProfileValue(AbstractGraphicsDevice device, int ctp, int major, int minor) { + static int GLProfile2CGLOGLProfileValue(final AbstractGraphicsDevice device, final int ctp, final int major, final int minor) { if(!MacOSXCGLContext.isGLProfileSupported(ctp, major, minor)) { throw new GLException("OpenGL profile not supported: "+getGLVersion(major, minor, ctp, "@GLProfile2CGLOGLProfileVersion")); } @@ -158,7 +159,7 @@ public class MacOSXCGLContext extends GLContextImpl private static final String shaderBasename = "texture01_xxx"; - private static ShaderProgram createCALayerShader(GL3ES3 gl) { + private static ShaderProgram createCALayerShader(final GL3ES3 gl) { // Create & Link the shader program final ShaderProgram sp = new ShaderProgram(); final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, @@ -176,9 +177,9 @@ public class MacOSXCGLContext extends GLContextImpl // setup mgl_PMVMatrix final 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(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv pmvMatrixUniform.setLocation(gl, sp.program()); @@ -203,14 +204,14 @@ public class MacOSXCGLContext extends GLContextImpl private long updateHandle = 0; private int lastWidth, lastHeight; - protected MacOSXCGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + protected MacOSXCGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); initOpenGLImpl(getOpenGLMode()); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _cglExt = null; cglExtProcAddressTable = null; super.resetStates(isInit); @@ -248,7 +249,7 @@ public class MacOSXCGLContext extends GLContextImpl protected Map<String, String> getExtensionNameMap() { return null; } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { if(!isGLProfileSupported(ctp, major, minor)) { if(DEBUG) { System.err.println(getThreadName() + ": createContextARBImpl: Not supported "+getGLVersion(major, minor, ctp, "@creation on OSX "+Platform.getOSVersionNumber())); @@ -276,7 +277,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { impl.release(_context); impl.destroy(_context); } @@ -380,7 +381,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void associateDrawable(boolean bound) { + protected void associateDrawable(final boolean bound) { // context stuff depends on drawable stuff if(bound) { super.associateDrawable(true); // 1) init drawable stuff @@ -399,7 +400,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) { throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this); } @@ -416,18 +417,18 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { return impl.setSwapInterval(interval); } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @@ -467,7 +468,7 @@ public class MacOSXCGLContext extends GLContextImpl } // Support for "mode switching" as described in MacOSXCGLDrawable - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { return; } @@ -485,7 +486,7 @@ public class MacOSXCGLContext extends GLContextImpl } public final GLBackendType getOpenGLMode() { return openGLMode; } - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -500,7 +501,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); @@ -528,7 +529,7 @@ public class MacOSXCGLContext extends GLContextImpl /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */ - private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) { + private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO) { final long nsViewHandle; if(drawable instanceof GLFBODrawableImpl) { nsViewHandle = 0; @@ -562,7 +563,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final NativeSurface surface = drawable.getNativeSurface(); final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration(); @@ -571,8 +572,8 @@ public class MacOSXCGLContext extends GLContextImpl final boolean isPBuffer; final boolean isFBO; { - boolean[] _isPBuffer = { false }; - boolean[] _isFBO = { false }; + final boolean[] _isPBuffer = { false }; + final boolean[] _isFBO = { false }; nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO); isPBuffer = _isPBuffer[0]; isFBO = _isFBO[0]; @@ -654,7 +655,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { if(0!=pixelFormat) { CGL.deletePixelFormat(pixelFormat); pixelFormat = 0; @@ -690,8 +691,8 @@ public class MacOSXCGLContext extends GLContextImpl /** Synchronized by instance's monitor */ boolean valid; - AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, - boolean isOpaque, int texWidth, int texHeight, int winWidth, int winHeight) { + AttachGLLayerCmd(final OffscreenLayerSurface ols, final long ctx, final int shaderProgram, final long pfmt, final long pbuffer, final int texID, + final boolean isOpaque, final int texWidth, final int texHeight, final int winWidth, final int winHeight) { this.ols = ols; this.ctx = ctx; this.shaderProgram = shaderProgram; @@ -745,7 +746,7 @@ public class MacOSXCGLContext extends GLContextImpl surfaceLock.unlock(); } } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } if( !valid ) { @@ -764,7 +765,7 @@ public class MacOSXCGLContext extends GLContextImpl class DetachGLLayerCmd implements Runnable { final AttachGLLayerCmd cmd; - DetachGLLayerCmd(AttachGLLayerCmd cmd) { + DetachGLLayerCmd(final AttachGLLayerCmd cmd) { this.cmd = cmd; } @@ -784,7 +785,7 @@ public class MacOSXCGLContext extends GLContextImpl if( 0 != l ) { ols.detachSurfaceLayer(); } - } catch(Throwable t) { + } catch(final Throwable t) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); } @@ -802,7 +803,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true); if(DEBUG) { @@ -831,7 +832,7 @@ public class MacOSXCGLContext extends GLContextImpl pbufferHandle = 0; fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() { @Override - public void swapBuffers(boolean doubleBuffered) { + public void swapBuffers(final boolean doubleBuffered) { MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers(); } } ) ; } else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { @@ -870,8 +871,8 @@ public class MacOSXCGLContext extends GLContextImpl } else { // -> null == backingLayerHost lastWidth = drawable.getSurfaceWidth(); lastHeight = drawable.getSurfaceHeight(); - boolean[] isPBuffer = { false }; - boolean[] isFBO = { false }; + final boolean[] isPBuffer = { false }; + final boolean[] isFBO = { false }; CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); } } else { // -> !bound @@ -906,7 +907,7 @@ public class MacOSXCGLContext extends GLContextImpl } } - private final void validatePBufferConfig(long ctx) { + private final void validatePBufferConfig(final long ctx) { final long drawableHandle = drawable.getHandle(); if( needsSetContextPBuffer && 0 != drawableHandle && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { // Must associate the pbuffer with our newly-created context @@ -919,7 +920,7 @@ public class MacOSXCGLContext extends GLContextImpl } /** Returns true if size has been updated, otherwise false (same size). */ - private final boolean validateDrawableSizeConfig(long ctx) { + private final boolean validateDrawableSizeConfig(final long ctx) { final int width = drawable.getSurfaceWidth(); final int height = drawable.getSurfaceHeight(); if( lastWidth != width || lastHeight != height ) { @@ -934,13 +935,13 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.copyContext(contextHandle, src, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { final long cglCtx = CGL.getCGLContext(ctx); if(0 == cglCtx) { throw new InternalError("Null CGLContext for: "+this); @@ -956,12 +957,12 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); @@ -987,7 +988,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final AttachGLLayerCmd cmd = attachGLLayerCmd; if(null != cmd) { synchronized(cmd) { @@ -1001,7 +1002,7 @@ public class MacOSXCGLContext extends GLContextImpl return true; } - private void setSwapIntervalImpl(final long l, int interval) { + private void setSwapIntervalImpl(final long l, final int interval) { if( 0 != l ) { CGL.setNSOpenGLLayerSwapInterval(l, interval); if( 0 < interval ) { @@ -1124,7 +1125,7 @@ public class MacOSXCGLContext extends GLContextImpl public boolean isNSContext() { return false; } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -1135,7 +1136,7 @@ public class MacOSXCGLContext extends GLContextImpl } try { // Create new context - PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); + final PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); if (DEBUG) { System.err.println("Share context for CGL-based pbuffer context is " + toHexString(share)); } @@ -1173,22 +1174,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { return CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError; } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.CGLCopyContext(src, contextHandle, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { int err = CGL.CGLLockContext(ctx); if(CGL.kCGLNoError == err) { err = CGL.CGLSetCurrentContext(ctx); @@ -1204,22 +1205,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); } } - int err = CGL.CGLSetCurrentContext(0); + final int err = CGL.CGLSetCurrentContext(0); if(DEBUG && CGL.kCGLNoError != err) { System.err.println("CGL: Could not release current context: err 0x"+Integer.toHexString(err)+": "+this); } - int err2 = CGL.CGLUnlockContext(ctx); + final int err2 = CGL.CGLUnlockContext(ctx); if(DEBUG && CGL.kCGLNoError != err2) { System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err2)+": "+this); } @@ -1237,7 +1238,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final IntBuffer lval = Buffers.newDirectIntBuffer(1); lval.put(0, interval); CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 448e3e221..8ea84a32d 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -91,7 +91,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { public final int id; - GLBackendType(int id){ + GLBackendType(final int id){ this.id = id; } } @@ -100,7 +100,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { private boolean haveSetOpenGLMode = false; private GLBackendType openGLMode = GLBackendType.NSOPENGL; - public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + public MacOSXCGLDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); initOpenGLImpl(getOpenGLMode()); } @@ -110,7 +110,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected void associateContext(GLContext ctx, boolean bound) { + protected void associateContext(final GLContext ctx, final boolean bound) { // NOTE: we need to keep track of the created contexts in order to // implement swapBuffers() because of how Mac OS X implements its // OpenGL window interface @@ -132,7 +132,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { synchronized (createdContexts) { for(int i=0; i<createdContexts.size(); ) { @@ -154,7 +154,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } // Support for "mode switching" as described in MacOSXCGLDrawable - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { return; } @@ -171,6 +171,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } public final GLBackendType getOpenGLMode() { return openGLMode; } - protected void initOpenGLImpl(GLBackendType backend) { /* nop */ } + protected void initOpenGLImpl(final GLBackendType backend) { /* nop */ } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 8931045d1..7c05b8eab 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -89,7 +89,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { DesktopGLDynamicLookupHelper tmp = null; try { tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -113,7 +113,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { try { ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory", "registerFactory", null, null, getClass().getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } sharedMap = new HashMap<String, SharedResource>(); @@ -144,7 +144,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return macOSXCGLDynamicLookupHelper; } @@ -161,9 +161,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures; boolean hasAppleFloatPixels; - SharedResource(MacOSXGraphicsDevice device, boolean valid, - boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels - /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, GLRendererQuirks glRendererQuirks) { + SharedResource(final MacOSXGraphicsDevice device, final boolean valid, + final boolean hasNPOTTextures, final boolean hasRECTTextures, final boolean hasAppletFloatPixels + /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, final GLRendererQuirks glRendererQuirks) { // drawable = draw; // this.context = ctx; this.glRendererQuirks = glRendererQuirks; @@ -207,7 +207,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null!=macOSXCGLDynamicLookupHelper && device instanceof MacOSXGraphicsDevice) { return true; } @@ -216,24 +216,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { private final HashSet<String> devicesTried = new HashSet<String>(); - private boolean getDeviceTried(String connection) { + private boolean getDeviceTried(final String connection) { synchronized (devicesTried) { return devicesTried.contains(connection); } } - private void addDeviceTried(String connection) { + private void addDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.add(connection); } } - private void removeDeviceTried(String connection) { + private void removeDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.remove(connection); } } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { final String connection = adevice.getConnection(); SharedResource sr; synchronized(sharedMap) { @@ -248,7 +248,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures = false; boolean hasAppleFloatPixels = false; { - GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); } @@ -265,13 +265,13 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { sharedContext.makeCurrent(); // could cause exception isValid = sharedContext.isCurrent(); if(isValid) { - GL gl = sharedContext.getGL(); + final GL gl = sharedContext.getGL(); hasNPOTTextures = gl.isNPOTTextureAvailable(); hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle); hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels); glRendererQuirks = sharedContext.getRendererQuirks(); } - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:"); gle.printStackTrace(); @@ -279,7 +279,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } finally { try { sharedContext.destroy(); - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:"); gle.printStackTrace(); @@ -308,12 +308,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device); } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -321,7 +321,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { final MutableGraphicsConfiguration config = (MutableGraphicsConfiguration) target.getGraphicsConfiguration(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { @@ -336,7 +336,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { if( glp.isGL2() ) { // OSX only supports pbuffer w/ compatible, non-core, context. return true; @@ -346,9 +346,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final MacOSXGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) { device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); @@ -364,15 +364,15 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new OSXDummyUpstreamSurfaceHook(width, height)); } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true); @@ -385,7 +385,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } @@ -409,7 +409,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected boolean setGammaRamp(float[] ramp) { + protected boolean setGammaRamp(final float[] ramp) { final FloatBuffer rampNIO = Buffers.newDirectFloatBuffer(ramp); return CGL.setGammaRamp(ramp.length, rampNIO, rampNIO, rampNIO); @@ -421,7 +421,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected void resetGammaRamp(Buffer originalGammaRamp) { + protected void resetGammaRamp(final Buffer originalGammaRamp) { CGL.resetGammaRamp(); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java index cda8307c7..3ec40ffce 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java @@ -56,7 +56,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return 0; /** OSX manual says: NSImage use is discouraged return CGL.getProcAddress(glFuncName); // manual implementation diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index 481c0b94b..cd89ad526 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -53,8 +53,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) { + MacOSXCGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); } @@ -63,8 +63,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return super.clone(); } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(MacOSXCGLDrawableFactory factory, AbstractGraphicsDevice device) { - MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final MacOSXCGLDrawableFactory factory, final AbstractGraphicsDevice device) { + final MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -88,7 +88,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration CGL.NSOpenGLPFASampleBuffers, CGL.NSOpenGLPFASamples }); - static IntBuffer GLCapabilities2NSAttribList(AbstractGraphicsDevice device, IntBuffer attrToken, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static IntBuffer GLCapabilities2NSAttribList(final AbstractGraphicsDevice device, final IntBuffer attrToken, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final int len = attrToken.remaining(); final int off = attrToken.position(); final IntBuffer ivalues = Buffers.newDirectIntBuffer(len); @@ -155,7 +155,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return ivalues; } - static long GLCapabilities2NSPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2NSPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); if ( !MacOSXCGLContext.isLionOrLater ) { // no OpenGLProfile @@ -165,11 +165,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues); } - static GLCapabilities NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) { + static GLCapabilities NSPixelFormat2GLCapabilities(final GLProfile glp, final long pixelFormat) { return PixelFormat2GLCapabilities(glp, pixelFormat, true); } - static long GLCapabilities2CGLPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2CGLPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { // Set up pixel format attributes final IntBuffer attrs = Buffers.newDirectIntBuffer(256); int i = 0; @@ -214,20 +214,20 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } // Use attribute array to select pixel format - PointerBuffer fmt = PointerBuffer.allocateDirect(1); - IntBuffer numScreens = Buffers.newDirectIntBuffer(1); - int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); + final PointerBuffer fmt = PointerBuffer.allocateDirect(1); + final IntBuffer numScreens = Buffers.newDirectIntBuffer(1); + final int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); if (res != CGL.kCGLNoError) { throw new GLException("Error code " + res + " while choosing pixel format"); } return fmt.get(0); } - static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { + static GLCapabilities CGLPixelFormat2GLCapabilities(final long pixelFormat) { return PixelFormat2GLCapabilities(null, pixelFormat, false); } - private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) { + private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, final long pixelFormat, final boolean nsUsage) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); final int off; if ( !MacOSXCGLContext.isLionOrLater ) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index db2a1df68..50de70227 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -61,8 +61,8 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); @@ -84,15 +84,15 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati } static MacOSXCGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, boolean usePBuffer) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final boolean usePBuffer) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } final AbstractGraphicsDevice device = absScreen.getDevice(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device); - return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested); + return new MacOSXCGLGraphicsConfiguration(absScreen, capsChosen, capsRequested); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index 150feac55..c17ed7d59 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -56,7 +56,7 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType; public class MacOSXExternalCGLContext extends MacOSXCGLContext { - private MacOSXExternalCGLContext(Drawable drawable, boolean isNSContext, long handle) { + private MacOSXExternalCGLContext(final Drawable drawable, final boolean isNSContext, final long handle) { super(drawable, null); setOpenGLMode(isNSContext ? GLBackendType.NSOPENGL : GLBackendType.CGL ); this.contextHandle = handle; @@ -67,13 +67,13 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static MacOSXExternalCGLContext create(GLDrawableFactory factory) { + protected static MacOSXExternalCGLContext create(final GLDrawableFactory factory) { long pixelFormat = 0; long currentDrawable = 0; long contextHandle = CGL.getCurrentContext(); // Check: MacOSX 10.3 .. - boolean isNSContext = 0 != contextHandle; + final boolean isNSContext = 0 != contextHandle; if( isNSContext ) { - long ctx = CGL.getCGLContext(contextHandle); + final long ctx = CGL.getCGLContext(contextHandle); if (ctx == 0) { throw new GLException("Error: NULL Context (CGL) of Context (NS) 0x" +Long.toHexString(contextHandle)); } @@ -100,19 +100,19 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { if (0 == pixelFormat) { throw new GLException("Error: current pixelformat of current Context 0x"+Long.toHexString(contextHandle)+" is null"); } - GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); + final GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); if(DEBUG) { System.err.println("MacOSXExternalCGLContext Create "+caps); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); - MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); + final AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); + final MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); if(0 == currentDrawable) { // set a fake marker stating a valid drawable currentDrawable = 1; } - WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); + final WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); } @@ -135,12 +135,12 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { // Need to provide the display connection to extension querying APIs static class Drawable extends MacOSXCGLDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -154,7 +154,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index 446a834b9..c613efa63 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -46,13 +46,13 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { - public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, - NativeSurface target) { + public MacOSXOffscreenCGLDrawable(final GLDrawableFactory factory, + final NativeSurface target) { super(factory, target); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index c6f0c1383..e9ea2ff61 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -46,12 +46,12 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { - protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) { + protected MacOSXOnscreenCGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index eba97a9ca..b1d560f4a 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -73,7 +73,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { protected int pBufferTexTarget, pBufferTexWidth, pBufferTexHeight; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) { + public MacOSXPbufferCGLDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -87,7 +87,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } @@ -121,7 +121,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { final DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ms.getGraphicsConfiguration(); final GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities(); final GLProfile glProfile = capabilities.getGLProfile(); - MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); + final MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); if (DEBUG) { System.out.println(getThreadName()+": Pbuffer config: " + config); @@ -160,13 +160,13 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { super.setOpenGLMode(mode); createPbuffer(); // recreate } @Override - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -182,12 +182,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // NSOpenGLPixelBuffer implementation class NSOpenGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { return CGL.createPBuffer(renderTarget, internalFormat, width, height); } @Override - public void destroy(long pbuffer) { + public void destroy(final long pbuffer) { CGL.destroyPBuffer(pbuffer); } } @@ -195,9 +195,9 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // CGL implementation class CGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { - PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); - int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { + final PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); + final int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error creating CGL-based pbuffer: error code " + res); } @@ -205,8 +205,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void destroy(long pbuffer) { - int res = CGL.CGLDestroyPBuffer(pbuffer); + public void destroy(final long pbuffer) { + final int res = CGL.CGLDestroyPBuffer(pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error destroying CGL-based pbuffer: error code " + res); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 21923531f..01300b005 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -65,8 +65,8 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -76,7 +76,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur if(null==absScreen) { absScreen = AWTGraphicsScreen.createDefault(); } - AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; + final AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) { @@ -96,14 +96,14 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: got "+absScreen); } - MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); - DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); + final MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + final DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); if(DEBUG) { System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: made "+macScreen); } - GraphicsConfiguration gc = device.getDefaultConfiguration(); - MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) + final GraphicsConfiguration gc = device.getDefaultConfiguration(); + final MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(macDevice, capsChosen).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, macScreen, nativeVisualID); diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java index 6817ece8f..b6ffced9f 100644 --- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java @@ -34,13 +34,16 @@ import java.util.Arrays; import jogamp.opengl.Debug; import com.jogamp.common.util.LFRingbuffer; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.Ringbuffer; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.openal.AL; import com.jogamp.openal.ALC; +import com.jogamp.openal.ALCConstants; import com.jogamp.openal.ALCcontext; import com.jogamp.openal.ALCdevice; +import com.jogamp.openal.ALConstants; import com.jogamp.openal.ALExt; import com.jogamp.openal.ALFactory; import com.jogamp.openal.util.ALHelpers; @@ -74,10 +77,10 @@ public class ALAudioSink implements AudioSink { static class ALAudioFrame extends AudioFrame { private final int alBuffer; - ALAudioFrame(int alBuffer) { + ALAudioFrame(final int alBuffer) { this.alBuffer = alBuffer; } - public ALAudioFrame(int alBuffer, int pts, int duration, int dataSize) { + public ALAudioFrame(final int alBuffer, final int pts, final int duration, final int dataSize) { super(pts, duration, dataSize); this.alBuffer = alBuffer; } @@ -112,7 +115,7 @@ public class ALAudioSink implements AudioSink { static { Debug.initSingleton(); - DEBUG_TRACE = Debug.isPropertyDefined("jogl.debug.AudioSink.trace", true); + DEBUG_TRACE = PropertyAccess.isPropertyDefined("jogl.debug.AudioSink.trace", true); ALC _alc = null; AL _al = null; @@ -121,7 +124,7 @@ public class ALAudioSink implements AudioSink { _alc = ALFactory.getALC(); _al = ALFactory.getAL(); _alExt = ALFactory.getALExt(); - } catch(Throwable t) { + } catch(final Throwable t) { if( DEBUG ) { System.err.println("ALAudioSink: Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -139,7 +142,7 @@ public class ALAudioSink implements AudioSink { private boolean checkALError(final String prefix) { final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); - final boolean ok = ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr; + final boolean ok = ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr; if( DEBUG ) { System.err.println("ALAudioSink."+prefix+": ok "+ok+", err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"]"); } @@ -165,7 +168,7 @@ public class ALAudioSink implements AudioSink { clearPreALError("init."+checkErrIter++); // Get the device specifier. - deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER); + deviceSpecifier = alc.alcGetString(device, ALCConstants.ALC_DEVICE_SPECIFIER); if (deviceSpecifier == null) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error getting specifier for default OpenAL device"); } @@ -181,7 +184,7 @@ public class ALAudioSink implements AudioSink { lockContext(); try { // Check for an error. - if ( alc.alcGetError(device) != ALC.ALC_NO_ERROR ) { + if ( alc.alcGetError(device) != ALCConstants.ALC_NO_ERROR ) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error making OpenAL context current"); } @@ -191,11 +194,11 @@ public class ALAudioSink implements AudioSink { clearPreALError("init."+checkErrIter++); preferredAudioFormat = new AudioFormat(querySampleRate(), DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); if( DEBUG ) { - System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(AL.AL_EXTENSIONS)); + System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(ALConstants.AL_EXTENSIONS)); clearPreALError("init."+checkErrIter++); - System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALC.ALC_EXTENSIONS)); + System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALCConstants.ALC_EXTENSIONS)); clearPreALError("init."+checkErrIter++); - System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALC.ALC_EXTENSIONS)); + System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALCConstants.ALC_EXTENSIONS)); System.out.println("ALAudioSink: hasSOFTBufferSamples "+hasSOFTBufferSamples); System.out.println("ALAudioSink: hasALC_thread_local_context "+hasALC_thread_local_context); System.out.println("ALAudioSink: preferredAudioFormat "+preferredAudioFormat); @@ -207,7 +210,7 @@ public class ALAudioSink implements AudioSink { alSource = new int[1]; al.alGenSources(1, alSource, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { alSource = null; throw new RuntimeException(getThreadName()+": ALAudioSink: Error generating Source: 0x"+Integer.toHexString(err)); } @@ -221,7 +224,7 @@ public class ALAudioSink implements AudioSink { unlockContext(); } return; - } catch ( Exception e ) { + } catch ( final Exception e ) { if( DEBUG ) { System.err.println(e.getMessage()); e.printStackTrace(); @@ -234,10 +237,10 @@ public class ALAudioSink implements AudioSink { private final int querySampleRate() { final int sampleRate; final int[] value = new int[1]; - alc.alcGetIntegerv(device, ALC.ALC_FREQUENCY, 1, value, 0); + alc.alcGetIntegerv(device, ALCConstants.ALC_FREQUENCY, 1, value, 0); final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); - if ( ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr && 0 != value[0] ) { + if ( ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr && 0 != value[0] ) { sampleRate = value[0]; } else { sampleRate = DefaultFormat.sampleRate; @@ -256,7 +259,7 @@ public class ALAudioSink implements AudioSink { alc.alcMakeContextCurrent(context); } final int alcErr = alc.alcGetError(null); - if( ALC.ALC_NO_ERROR != alcErr ) { + if( ALCConstants.ALC_NO_ERROR != alcErr ) { final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this; System.err.println(err); Thread.dumpStack(); @@ -264,7 +267,7 @@ public class ALAudioSink implements AudioSink { throw new RuntimeException(err); } final int alErr = al.alGetError(); - if( ALC.ALC_NO_ERROR != alErr ) { + if( ALCConstants.ALC_NO_ERROR != alErr ) { if( DEBUG ) { System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this); Thread.dumpStack(); @@ -285,7 +288,7 @@ public class ALAudioSink implements AudioSink { if( null != context ) { try { alc.alcDestroyContext(context); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -346,7 +349,7 @@ public class ALAudioSink implements AudioSink { } @Override - public final boolean isSupported(AudioFormat format) { + public final boolean isSupported(final AudioFormat format) { if( !staticAvailable ) { return false; } @@ -355,13 +358,13 @@ public class ALAudioSink implements AudioSink { return false; } final int alChannelLayout = ALHelpers.getDefaultALChannelLayout(format.channelCount); - if( AL.AL_NONE != alChannelLayout ) { + if( ALConstants.AL_NONE != alChannelLayout ) { final int alSampleType = ALHelpers.getALSampleType(format.sampleSize, format.signed, format.fixedP); - if( AL.AL_NONE != alSampleType ) { + if( ALConstants.AL_NONE != alSampleType ) { lockContext(); try { final int alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt); - return AL.AL_NONE != alFormat; + return ALConstants.AL_NONE != alFormat; } finally { unlockContext(); } @@ -371,7 +374,7 @@ public class ALAudioSink implements AudioSink { } @Override - public final boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { + public final boolean init(final AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { if( !staticAvailable ) { return false; } @@ -379,12 +382,12 @@ public class ALAudioSink implements AudioSink { alSampleType = ALHelpers.getALSampleType(requestedFormat.sampleSize, requestedFormat.signed, requestedFormat.fixedP); lockContext(); try { - if( AL.AL_NONE != alChannelLayout && AL.AL_NONE != alSampleType ) { + if( ALConstants.AL_NONE != alChannelLayout && ALConstants.AL_NONE != alSampleType ) { alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt); } else { - alFormat = AL.AL_NONE; + alFormat = ALConstants.AL_NONE; } - if( AL.AL_NONE == alFormat ) { + if( ALConstants.AL_NONE == alFormat ) { // not supported return false; } @@ -398,7 +401,7 @@ public class ALAudioSink implements AudioSink { alBufferNames = new int[initialFrameCount]; al.alGenBuffers(initialFrameCount, alBufferNames, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { alBufferNames = null; throw new RuntimeException(getThreadName()+": ALAudioSink: Error generating Buffers: 0x"+Integer.toHexString(err)); } @@ -431,7 +434,7 @@ public class ALAudioSink implements AudioSink { return chosenFormat; } - private static int[] concat(int[] first, int[] second) { + private static int[] concat(final int[] first, final int[] second) { final int[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; @@ -457,7 +460,7 @@ public class ALAudioSink implements AudioSink { final int[] newALBufferNames = new int[frameGrowAmount]; al.alGenBuffers(frameGrowAmount, newALBufferNames, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { if( DEBUG ) { System.err.println(getThreadName()+": ALAudioSink.growBuffers: Error generating "+frameGrowAmount+" new Buffers: 0x"+Integer.toHexString(err)); } @@ -493,7 +496,7 @@ public class ALAudioSink implements AudioSink { if( null != alBufferNames ) { try { al.alDeleteBuffers(alBufferNames.length, alBufferNames, 0); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -523,7 +526,7 @@ public class ALAudioSink implements AudioSink { if( null != alSource ) { try { al.alDeleteSources(1, alSource, 0); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -539,7 +542,7 @@ public class ALAudioSink implements AudioSink { if( null != device ) { try { alc.alcCloseDevice(device); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -556,16 +559,16 @@ public class ALAudioSink implements AudioSink { } private final int dequeueBuffer(final boolean wait, final boolean ignoreBufferInconsistency) { - int alErr = AL.AL_NO_ERROR; + int alErr = ALConstants.AL_NO_ERROR; final int releaseBufferCount; if( alBufferBytesQueued > 0 ) { final int releaseBufferLimes = Math.max(1, alFramesPlaying.size() / 4 ); final int[] val=new int[1]; int i=0; do { - al.alGetSourcei(alSource[0], AL.AL_BUFFERS_PROCESSED, val, 0); + al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while quering processed buffers at source. "+this); } if( wait && val[0] < releaseBufferLimes ) { @@ -574,12 +577,12 @@ public class ALAudioSink implements AudioSink { final int avgBufferDura = chosenFormat.getBytesDuration( alBufferBytesQueued / alFramesPlaying.size() ); final int sleep = Math.max(2, Math.min(100, releaseBufferLimes * avgBufferDura)); if( DEBUG ) { - System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+(AL.AL_PLAYING == getSourceState(false))+", processed "+val[0]+", "+this); + System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+(ALConstants.AL_PLAYING == getSourceState(false))+", processed "+val[0]+", "+this); } unlockContext(); try { Thread.sleep( sleep - 1 ); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } finally { lockContext(); } @@ -594,7 +597,7 @@ public class ALAudioSink implements AudioSink { final int[] buffers = new int[releaseBufferCount]; al.alSourceUnqueueBuffers(alSource[0], releaseBufferCount, buffers, 0); alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this); } for ( int i=0; i<releaseBufferCount; i++ ) { @@ -631,9 +634,9 @@ public class ALAudioSink implements AudioSink { System.err.println("< _FLUSH_ <- "+shortString()+" @ "+getThreadName()); } final int[] val=new int[1]; - al.alSourcei(alSource[0], AL.AL_BUFFER, 0); // explicit force zero buffer! + al.alSourcei(alSource[0], ALConstants.AL_BUFFER, 0); // explicit force zero buffer! if(DEBUG_TRACE) { - al.alGetSourcei(alSource[0], AL.AL_BUFFERS_PROCESSED, val, 0); + al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); } final int alErr = al.alGetError(); while ( !alFramesPlaying.isEmpty() ) { @@ -653,7 +656,7 @@ public class ALAudioSink implements AudioSink { } } - private final int dequeueBuffer(boolean wait, int inPTS, int inDuration) { + private final int dequeueBuffer(final boolean wait, final int inPTS, final int inDuration) { final int dequeuedBufferCount = dequeueBuffer( wait, false /* ignoreBufferInconsistency */ ); final ALAudioFrame currentBuffer = alFramesPlaying.peek(); if( null != currentBuffer ) { @@ -670,12 +673,12 @@ public class ALAudioSink implements AudioSink { } @Override - public final AudioFrame enqueueData(AudioDataFrame audioDataFrame) { + public final AudioFrame enqueueData(final AudioDataFrame audioDataFrame) { return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize()); } @Override - public final AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) { + public final AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { if( !initialized || null == chosenFormat ) { return null; } @@ -730,7 +733,7 @@ public class ALAudioSink implements AudioSink { al.alSourceQueueBuffers(alSource[0], 1, alBufferNames, 0); final int alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while queueing buffer "+toHexString(alBufferNames[0])+". "+this); } alBufferBytesQueued += byteCount; @@ -765,16 +768,16 @@ public class ALAudioSink implements AudioSink { } private final boolean isPlayingImpl0() { if( playRequested ) { - return AL.AL_PLAYING == getSourceState(false); + return ALConstants.AL_PLAYING == getSourceState(false); } else { return false; } } - private final int getSourceState(boolean ignoreError) { + private final int getSourceState(final boolean ignoreError) { final int[] val = new int[1]; - al.alGetSourcei(alSource[0], AL.AL_SOURCE_STATE, val, 0); + al.alGetSourcei(alSource[0], ALConstants.AL_SOURCE_STATE, val, 0); final int alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = getThreadName()+": ALError "+toHexString(alErr)+" while querying SOURCE_STATE. "+this; if( ignoreError ) { if( DEBUG ) { @@ -797,17 +800,17 @@ public class ALAudioSink implements AudioSink { try { playImpl(); if( DEBUG ) { - System.err.println(getThreadName()+": ALAudioSink: PLAY playImpl "+(AL.AL_PLAYING == getSourceState(false))+", "+this); + System.err.println(getThreadName()+": ALAudioSink: PLAY playImpl "+(ALConstants.AL_PLAYING == getSourceState(false))+", "+this); } } finally { unlockContext(); } } private final void playImpl() { - if( playRequested && AL.AL_PLAYING != getSourceState(false) ) { + if( playRequested && ALConstants.AL_PLAYING != getSourceState(false) ) { al.alSourcePlay(alSource[0]); final int alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while start playing. "+this); } } @@ -823,7 +826,7 @@ public class ALAudioSink implements AudioSink { try { pauseImpl(); if( DEBUG ) { - System.err.println(getThreadName()+": ALAudioSink: PAUSE playImpl "+(AL.AL_PLAYING == getSourceState(false))+", "+this); + System.err.println(getThreadName()+": ALAudioSink: PAUSE playImpl "+(ALConstants.AL_PLAYING == getSourceState(false))+", "+this); } } finally { unlockContext(); @@ -835,17 +838,17 @@ public class ALAudioSink implements AudioSink { playRequested = false; al.alSourcePause(alSource[0]); final int alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while pausing. "+this); } } } - private final void stopImpl(boolean ignoreError) { - if( AL.AL_STOPPED != getSourceState(ignoreError) ) { + private final void stopImpl(final boolean ignoreError) { + if( ALConstants.AL_STOPPED != getSourceState(ignoreError) ) { playRequested = false; al.alSourceStop(alSource[0]); final int alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = "ALError "+toHexString(alErr)+" while stopping. "+this; if( ignoreError ) { if( DEBUG ) { @@ -873,7 +876,7 @@ public class ALAudioSink implements AudioSink { } if( 0.5f <= rate && rate <= 2.0f ) { // OpenAL limits playSpeed = rate; - al.alSourcef(alSource[0], AL.AL_PITCH, playSpeed); + al.alSourcef(alSource[0], ALConstants.AL_PITCH, playSpeed); return true; } } finally { @@ -901,7 +904,7 @@ public class ALAudioSink implements AudioSink { } if( 0.0f <= v && v <= 1.0f ) { // OpenAL limits volume = v; - al.alSourcef(alSource[0], AL.AL_GAIN, v); + al.alSourcef(alSource[0], ALConstants.AL_GAIN, v); return true; } } finally { @@ -925,7 +928,7 @@ public class ALAudioSink implements AudioSink { throw new InternalError("XXX: "+this); } if( DEBUG ) { - System.err.println(getThreadName()+": ALAudioSink: FLUSH playImpl "+(AL.AL_PLAYING == getSourceState(false))+", "+this); + System.err.println(getThreadName()+": ALAudioSink: FLUSH playImpl "+(ALConstants.AL_PLAYING == getSourceState(false))+", "+this); } } finally { unlockContext(); @@ -977,6 +980,6 @@ public class ALAudioSink implements AudioSink { @Override public final int getPTS() { return playingPTS; } - private static final String toHexString(int v) { return "0x"+Integer.toHexString(v); } + private static final String toHexString(final int v) { return "0x"+Integer.toHexString(v); } private static final String getThreadName() { return Thread.currentThread().getName(); } } diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java b/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java index 2c1dfa237..4f585937d 100644 --- a/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java +++ b/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java @@ -3,13 +3,13 @@ package jogamp.opengl.openal.av; import com.jogamp.openal.AL; import com.jogamp.openal.JoalVersion; -/** +/** * Demo JOAL usage w/ av dependency, i.e. FFMPEGMediaPlayer .. */ public class ALDummyUsage { static AL al; - - public static void main(String args[]) { + + public static void main(final String args[]) { System.err.println("JOGL> Hello JOAL"); System.err.println("JOAL: "+JoalVersion.getInstance().toString()); } 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; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index feacdb951..25b73a2a6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -44,7 +44,7 @@ public class WGLGLCapabilities extends GLCapabilities { final private int pfdID; private int arb_pixelformat; // -1 PFD, 0 NOP, 1 ARB - public WGLGLCapabilities(PIXELFORMATDESCRIPTOR pfd, int pfdID, GLProfile glp) { + public WGLGLCapabilities(final PIXELFORMATDESCRIPTOR pfd, final int pfdID, final GLProfile glp) { super(glp); this.pfd = pfd; this.pfdID = pfdID; @@ -78,9 +78,9 @@ public class WGLGLCapabilities extends GLCapabilities { return true; } - public static final String PFD2String(PIXELFORMATDESCRIPTOR pfd, int pfdID) { + public static final String PFD2String(final PIXELFORMATDESCRIPTOR pfd, final int pfdID) { final int dwFlags = pfd.getDwFlags(); - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); boolean sep = false; if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) { @@ -224,7 +224,7 @@ public class WGLGLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -237,7 +237,7 @@ public class WGLGLCapabilities extends GLCapabilities { final public boolean isSet() { return 0 != arb_pixelformat; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java index 6454a34b5..08ff0e05b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java @@ -27,6 +27,8 @@ */ package jogamp.opengl.windows.wgl; +import com.jogamp.common.util.PropertyAccess; + import jogamp.nativewindow.windows.GDI; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; import jogamp.opengl.Debug; @@ -52,41 +54,41 @@ public class WGLUtil { static { Debug.initSingleton(); - USE_WGLVersion_Of_5WGLGDIFuncSet = Debug.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true); + USE_WGLVersion_Of_5WGLGDIFuncSet = PropertyAccess.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true); if(USE_WGLVersion_Of_5WGLGDIFuncSet) { System.err.println("Use WGL version of 5 WGL/GDI functions."); } } - public static int ChoosePixelFormat(long hdc, PIXELFORMATDESCRIPTOR pfd) { + public static int ChoosePixelFormat(final long hdc, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglChoosePixelFormat(hdc, pfd); } else { return GDI.ChoosePixelFormat(hdc, pfd); } } - public static int DescribePixelFormat(long hdc, int pfdid, int pfdSize, PIXELFORMATDESCRIPTOR pfd) { + public static int DescribePixelFormat(final long hdc, final int pfdid, final int pfdSize, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglDescribePixelFormat(hdc, pfdid, pfdSize, pfd); } else { return GDI.DescribePixelFormat(hdc, pfdid, pfdSize, pfd); } } - public static int GetPixelFormat(long hdc) { + public static int GetPixelFormat(final long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglGetPixelFormat(hdc); } else { return GDI.GetPixelFormat(hdc); } } - public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) { + public static boolean SetPixelFormat(final long hdc, final int pfdid, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSetPixelFormat(hdc, pfdid, pfd); } else { return GDI.SetPixelFormat(hdc, pfdid, pfd); } } - public static boolean SwapBuffers(long hdc) { + public static boolean SwapBuffers(final long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSwapBuffers(hdc); } else { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index 1ad3fed8d..0878f186c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -60,11 +60,11 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { private long origbitmap; private long hbitmap; - private WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface comp) { + private WindowsBitmapWGLDrawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, false); } - protected static WindowsBitmapWGLDrawable create(GLDrawableFactory factory, NativeSurface comp) { + protected static WindowsBitmapWGLDrawable create(final GLDrawableFactory factory, final NativeSurface comp) { final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)comp.getGraphicsConfiguration(); final AbstractGraphicsDevice aDevice = config.getScreen().getDevice(); if( !GLProfile.isAvailable(aDevice, GLProfile.GL2) ) { @@ -94,7 +94,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } @@ -146,7 +146,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { hbitmap = GDI.CreateDIBSection(0, info, GDI.DIB_RGB_COLORS, pb, 0, 0); werr = GDI.GetLastError(); if(DEBUG) { - long p = ( pb.capacity() > 0 ) ? pb.get(0) : 0; + final long p = ( pb.capacity() > 0 ) ? pb.get(0) : 0; System.err.println("WindowsBitmapWGLDrawable: pb sz/ptr "+pb.capacity() + ", "+toHexString(p)); System.err.println("WindowsBitmapWGLDrawable: " + width+"x"+height + ", bpp " + bitsPerPixelIn + " -> " + bitsPerPixel + @@ -187,7 +187,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } protected void destroyBitmap() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { // Must destroy bitmap and device context GDI.SelectObject(ns.getSurfaceHandle(), origbitmap); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index 2047a91b5..4cebc6357 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -56,7 +56,7 @@ import jogamp.opengl.GLContextShareSet; public class WindowsExternalWGLContext extends WindowsWGLContext { - private WindowsExternalWGLContext(Drawable drawable, long ctx, WindowsWGLGraphicsConfiguration cfg) { + private WindowsExternalWGLContext(final Drawable drawable, final long ctx, final WindowsWGLGraphicsConfiguration cfg) { super(drawable, null); this.contextHandle = ctx; if (DEBUG) { @@ -69,7 +69,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static WindowsExternalWGLContext create(GLDrawableFactory factory, GLProfile glp) { + protected static WindowsExternalWGLContext create(final GLDrawableFactory factory, final GLProfile glp) { if(DEBUG) { System.err.println("WindowsExternalWGLContext 0: werr: " + GDI.GetLastError()); } @@ -83,7 +83,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { if (0 == hdc) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError()); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); + final AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WindowsWGLGraphicsConfiguration cfg; final int pfdID = WGLUtil.GetPixelFormat(hdc); if (0 == pfdID) { @@ -119,12 +119,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { // Need to provide the display connection to extension querying APIs static class Drawable extends WindowsWGLDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -138,7 +138,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java index 11e0202fd..1378bcf3e 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java @@ -55,16 +55,16 @@ import jogamp.nativewindow.windows.GDI; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { - private WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeSurface component) { + private WindowsExternalWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, true); } - protected static WindowsExternalWGLDrawable create(GLDrawableFactory factory, GLProfile glp) { - long hdc = WGL.wglGetCurrentDC(); + protected static WindowsExternalWGLDrawable create(final GLDrawableFactory factory, final GLProfile glp) { + final long hdc = WGL.wglGetCurrentDC(); if (0==hdc) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError()); } - int pfdID = WGLUtil.GetPixelFormat(hdc); + final int pfdID = WGLUtil.GetPixelFormat(hdc); if (pfdID == 0) { throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat, werr " + GDI.GetLastError()); } @@ -76,11 +76,11 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } - public void setSize(int newWidth, int newHeight) { + public void setSize(final int newWidth, final int newHeight) { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java index 61fb787c6..0d0681df9 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -45,12 +45,12 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { - protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeSurface component) { + protected WindowsOnscreenWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index e0bf1f50b..597f51178 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -65,7 +65,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // needed to destroy pbuffer private long buffer; // pbuffer handle - protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) { + protected WindowsPbufferWGLDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -79,14 +79,14 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } protected void destroyPbuffer() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if(0!=buffer) { - WGLExt wglExt = cachedWGLExt; + final WGLExt wglExt = cachedWGLExt; if (ns.getSurfaceHandle() != 0) { // Must release DC and pbuffer // NOTE that since the context is not current, glGetError() can @@ -112,15 +112,15 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } private void createPbuffer() { - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration(); - SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); - NativeSurface sharedSurface = sharedResource.getDrawable().getNativeSurface(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration(); + final SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); + final NativeSurface sharedSurface = sharedResource.getDrawable().getNativeSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= sharedSurface.lockSurface()) { throw new NativeWindowException("Could not lock (sharedSurface): "+this); } try { - long sharedHdc = sharedSurface.getSurfaceHandle(); - WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); + final long sharedHdc = sharedSurface.getSurfaceHandle(); + final WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); if (DEBUG) { System.out.println(getThreadName()+": Pbuffer config: " + config); @@ -130,7 +130,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { final IntBuffer iattributes = Buffers.newDirectIntBuffer(2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS); final FloatBuffer fattributes = Buffers.newDirectFloatBuffer(1); - int[] floatModeTmp = new int[1]; + final int[] floatModeTmp = new int[1]; int niattribs = 0; final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -162,7 +162,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); for (int i = 0; i < nformats; i++) { - WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + final WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pformats.get(i), winattrPbuffer); System.err.println("pixel format " + pformats.get(i) + " (index " + i + "): " + dbgCaps); } @@ -174,7 +174,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int whichFormat; // Loop is a workaround for bugs in NVidia's recent drivers for (whichFormat = 0; whichFormat < nformats; whichFormat++) { - int format = pformats.get(whichFormat); + final int format = pformats.get(whichFormat); // Create the p-buffer. niattribs = 0; @@ -196,12 +196,12 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } // Get the device context. - long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer); + final long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer); if (tmpHdc == 0) { throw new GLException("pbuffer creation error: wglGetPbufferDC() failed"); } - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); // Set up instance variables buffer = tmpBuffer; ((MutableSurface)ns).setSurfaceHandle(tmpHdc); @@ -209,7 +209,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // Re-query chosen pixel format { - WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + final WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pfdid, winattrPbuffer); if(null == newCaps) { throw new GLException("pbuffer creation error: unable to re-query chosen PFD ID: " + pfdid + ", hdc " + GLDrawableImpl.toHexString(tmpHdc)); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 0df986f77..9c5a5b272 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -87,13 +87,13 @@ public class WindowsWGLContext extends GLContextImpl { } // FIXME: figure out how to hook back in the Java 2D / JOGL bridge - WindowsWGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + WindowsWGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { wglGetExtensionsStringEXTInitialized=false; wglGetExtensionsStringEXTAvailable=false; wglGLReadDrawableAvailableSet=false; @@ -123,9 +123,9 @@ public class WindowsWGLContext extends GLContextImpl { @Override public final boolean isGLReadDrawableAvailable() { if(!wglGLReadDrawableAvailableSet && null != getWGLExtProcAddressTable()) { - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); - AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); + final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); switch( factory.isReadDrawableAvailable(device) ) { case 1: wglGLReadDrawableAvailable = true; @@ -140,7 +140,7 @@ public class WindowsWGLContext extends GLContextImpl { return wglGLReadDrawableAvailable; } - private final boolean wglMakeContextCurrent(long hDrawDC, long hReadDC, long ctx) { + private final boolean wglMakeContextCurrent(final long hDrawDC, final long hReadDC, final long ctx) { boolean ok = false; if(wglGLReadDrawableAvailable) { // needs initilized WGL ProcAddress table @@ -151,9 +151,9 @@ public class WindowsWGLContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; + final int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; if(DEBUG && !ok) { - Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ + final Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ GLContext.toHexString(hDrawDC) + ", read " + GLContext.toHexString(hReadDC) + ", ctx " + GLContext.toHexString(ctx) + ", werr " + werr); t.printStackTrace(); @@ -182,26 +182,26 @@ public class WindowsWGLContext extends GLContextImpl { protected Map<String, String> getExtensionNameMap() { return extensionNameMap; } @Override - protected void destroyContextARBImpl(long context) { + protected void destroyContextARBImpl(final long context) { WGL.wglMakeCurrent(0, 0); WGL.wglDeleteContext(context); } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { if( null == getWGLExtProcAddressTable()) { updateGLXProcAddressTable(); } - WGLExt _wglExt = getWGLExt(); + final WGLExt _wglExt = getWGLExt(); if(DEBUG) { System.err.println(getThreadName()+" - WindowWGLContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct+ ", wglCreateContextAttribsARB: "+toHexString(wglExtProcAddressTable._addressof_wglCreateContextAttribsARB)); } - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; long ctx=0; @@ -210,7 +210,7 @@ public class WindowsWGLContext extends GLContextImpl { /* WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, */ - int attribs[] = { + final int attribs[] = { /* 0 */ WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, major, /* 2 */ WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, minor, /* 4 */ WGLExt.WGL_CONTEXT_FLAGS_ARB, 0, @@ -239,9 +239,9 @@ public class WindowsWGLContext extends GLContextImpl { try { final IntBuffer attribsNIO = Buffers.newDirectIntBuffer(attribs); ctx = _wglExt.wglCreateContextAttribsARB(drawable.getHandle(), share, attribsNIO); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if(DEBUG) { - Throwable t = new Throwable("Info: WindowWGLContext.createContextARBImpl wglCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); + final Throwable t = new Throwable("Info: WindowWGLContext.createContextARBImpl wglCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); t.printStackTrace(); } } @@ -422,7 +422,7 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { if (!WGL.wglCopyContext(source.getHandle(), getHandle(), mask)) { throw new GLException("wglCopyContext failed"); } @@ -464,7 +464,7 @@ public class WindowsWGLContext extends GLContextImpl { @Override protected final StringBuilder getPlatformExtensionsStringImpl() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); if (!wglGetExtensionsStringEXTInitialized) { wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0); @@ -477,26 +477,26 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { - WGLExt wglExt = getWGLExt(); + protected boolean setSwapIntervalImpl(final int interval) { + final WGLExt wglExt = getWGLExt(); if(0==hasSwapIntervalSGI) { try { hasSwapIntervalSGI = wglExt.isExtensionAvailable("WGL_EXT_swap_control")?1:-1; - } catch (Throwable t) { hasSwapIntervalSGI=1; } + } catch (final Throwable t) { hasSwapIntervalSGI=1; } } if (hasSwapIntervalSGI>0) { try { return wglExt.wglSwapIntervalEXT(interval); - } catch (Throwable t) { hasSwapIntervalSGI=-1; } + } catch (final Throwable t) { hasSwapIntervalSGI=-1; } } return false; } - private final int initSwapGroupImpl(WGLExt wglExt) { + private final int initSwapGroupImpl(final WGLExt wglExt) { if(0==hasSwapGroupNV) { try { hasSwapGroupNV = wglExt.isExtensionAvailable("WGL_NV_swap_group")?1:-1; - } catch (Throwable t) { hasSwapGroupNV=1; } + } catch (final Throwable t) { hasSwapGroupNV=1; } if(DEBUG) { System.err.println("initSwapGroupImpl: hasSwapGroupNV: "+hasSwapGroupNV); } @@ -505,10 +505,10 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + protected final boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { final NativeSurface ns = drawable.getNativeSurface(); try { @@ -520,47 +520,47 @@ public class WindowsWGLContext extends GLContextImpl { maxBarriersNIO.get(maxGroups, maxGroups_offset, maxBarriersNIO.remaining()); res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean joinSwapGroupImpl(int group) { + protected final boolean joinSwapGroupImpl(final int group) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { try { if( wglExt.wglJoinSwapGroupNV(drawable.getHandle(), group) ) { currentSwapGroup = group; res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean bindSwapBarrierImpl(int group, int barrier) { + protected final boolean bindSwapBarrierImpl(final int group, final int barrier) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { try { if( wglExt.wglBindSwapBarrierNV(group, barrier) ) { res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { return getWGLExt().wglAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { getWGLExt().wglFreeMemoryNV(pointer); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index 66071cbe1..00b048e38 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -44,6 +44,8 @@ import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; +import com.jogamp.common.util.PropertyAccess; + import jogamp.nativewindow.windows.GDI; import jogamp.opengl.Debug; import jogamp.opengl.GLDrawableImpl; @@ -55,22 +57,22 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { static { Debug.initSingleton(); - PROFILING = Debug.isPropertyDefined("jogl.debug.GLDrawable.profiling", true); + PROFILING = PropertyAccess.isPropertyDefined("jogl.debug.GLDrawable.profiling", true); } private static final int PROFILING_TICKS = 200; private int profilingSwapBuffersTicks; private long profilingSwapBuffersTime; - public WindowsWGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + public WindowsWGLDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); } @Override protected void setRealizedImpl() { if(realized) { - NativeSurface ns = getNativeSurface(); - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); + final NativeSurface ns = getNativeSurface(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); config.updateGraphicsConfiguration(getFactory(), ns, null); if (DEBUG) { System.err.println(getThreadName()+": WindowsWGLDrawable.setRealized(true): "+config); @@ -79,7 +81,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { final long t0; if (PROFILING) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 7fa8775cf..4d8c85137 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -99,7 +99,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if(null!=tmp && tmp.isLibComplete()) { WGL.getWGLProcAddressTable().reset(tmp); } - } catch (Exception ex) { + } catch (final Exception ex) { tmp = null; if(DEBUG) { ex.printStackTrace(); @@ -121,7 +121,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { try { ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory", "registerFactory", null, null, getClass().getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } sharedMap = new HashMap<String, SharedResourceRunner.Resource>(); @@ -164,7 +164,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return windowsWGLDynamicLookupHelper; } @@ -180,7 +180,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { protected void enterThreadCriticalZone() { synchronized (sysMask) { if( 0 == processAffinityChanges) { - long pid = GDI.GetCurrentProcess(); + final long pid = GDI.GetCurrentProcess(); if ( GDI.GetProcessAffinityMask(pid, procMask, sysMask) ) { if(DEBUG) { System.err.println("WindowsWGLDrawableFactory.enterThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + getThreadName()); @@ -197,7 +197,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { protected void leaveThreadCriticalZone() { synchronized (sysMask) { if( 0 != processAffinityChanges) { - long pid = GDI.GetCurrentProcess(); + final long pid = GDI.GetCurrentProcess(); if( pid != processAffinityChanges) { throw new GLException("PID doesn't match: set PID 0x" + Long.toHexString(processAffinityChanges) + " this PID 0x" + Long.toHexString(pid) ); @@ -220,8 +220,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { private GLDrawableImpl drawable; private GLContextImpl context; - SharedResource(WindowsGraphicsDevice dev, AbstractGraphicsScreen scrn, GLDrawableImpl draw, GLContextImpl ctx, - boolean arbPixelFormat, boolean arbMultisample, boolean arbPBuffer, boolean arbReadDrawable) { + SharedResource(final WindowsGraphicsDevice dev, final AbstractGraphicsScreen scrn, final GLDrawableImpl draw, final GLContextImpl ctx, + final boolean arbPixelFormat, final boolean arbMultisample, final boolean arbPBuffer, final boolean arbReadDrawable) { device = dev; screen = scrn; drawable = draw; @@ -261,11 +261,11 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { + public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { return sharedMap.put(connection, resource); } @Override - public SharedResourceRunner.Resource mapGet(String connection) { + public SharedResourceRunner.Resource mapGet(final String connection) { return sharedMap.get(connection); } @Override @@ -276,12 +276,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(String connection) { + public boolean isDeviceSupported(final String connection) { return true; } @Override - public SharedResourceRunner.Resource createSharedResource(String connection) { + public SharedResourceRunner.Resource createSharedResource(final String connection) { final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT); sharedDevice.lock(); try { @@ -324,7 +324,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext, hasARBPixelFormat, hasARBMultisample, hasARBPBuffer, hasARBReadDrawableAvailable); - } catch (Throwable t) { + } catch (final Throwable t) { throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+connection, t); } finally { sharedDevice.unlock(); @@ -332,8 +332,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public void releaseSharedResource(SharedResourceRunner.Resource shared) { - SharedResource sr = (SharedResource) shared; + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; if (DEBUG) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); @@ -369,7 +369,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null!=windowsWGLDynamicLookupHelper && device instanceof WindowsGraphicsDevice) { return true; } @@ -389,12 +389,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice device) { return (SharedResource) sharedResourceRunner.getOrCreateShared(device); } - protected final WindowsWGLDrawable getOrCreateSharedDrawable(AbstractGraphicsDevice device) { - SharedResourceRunner.Resource sr = getOrCreateSharedResourceImpl(device); + protected final WindowsWGLDrawable getOrCreateSharedDrawable(final AbstractGraphicsDevice device) { + final SharedResourceRunner.Resource sr = getOrCreateSharedResourceImpl(device); if(null!=sr) { return (WindowsWGLDrawable) sr.getDrawable(); } @@ -402,12 +402,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return WindowsWGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } @Override - protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -419,8 +419,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!chosenCaps.isPBuffer()) { return WindowsBitmapWGLDrawable.create(this, target); } @@ -435,7 +435,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { */ final SharedResource sr = getOrCreateSharedResourceImpl(device); if(null!=sr) { - GLContext lastContext = GLContext.getCurrent(); + final GLContext lastContext = GLContext.getCurrent(); if (lastContext != null) { lastContext.release(); } @@ -458,8 +458,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { * @return 1 if read drawable extension is available, 0 if not * and -1 if undefined yet, ie no shared device exist at this point. */ - public final int isReadDrawableAvailable(AbstractGraphicsDevice device) { - SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); + public final int isReadDrawableAvailable(final AbstractGraphicsDevice device) { + final SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); if(null!=sr) { return sr.hasReadDrawable() ? 1 : 0 ; } @@ -467,8 +467,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { - SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); + public final boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { + final SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); if(null!=sr) { return sr.hasARBPBuffer(); } @@ -476,9 +476,9 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final WindowsGraphicsDevice device; if(createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice)) { device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); @@ -494,8 +494,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { final WindowsGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice) ) { device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); @@ -512,7 +512,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen); @@ -525,7 +525,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public final boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return true; } @@ -535,7 +535,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } static String wglGetLastError() { - long err = GDI.GetLastError(); + final long err = GDI.GetLastError(); String detail = null; switch ((int) err) { case GDI.ERROR_SUCCESS: detail = "ERROR_SUCCESS"; break; @@ -561,26 +561,26 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final boolean setGammaRamp(float[] ramp) { - short[] rampData = new short[3 * GAMMA_RAMP_LENGTH]; + protected final boolean setGammaRamp(final float[] ramp) { + final short[] rampData = new short[3 * GAMMA_RAMP_LENGTH]; for (int i = 0; i < GAMMA_RAMP_LENGTH; i++) { - short scaledValue = (short) (ramp[i] * 65535); + final short scaledValue = (short) (ramp[i] * 65535); rampData[i] = scaledValue; rampData[i + GAMMA_RAMP_LENGTH] = scaledValue; rampData[i + 2 * GAMMA_RAMP_LENGTH] = scaledValue; } - long screenDC = GDI.GetDC(0); - boolean res = GDI.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData)); + final long screenDC = GDI.GetDC(0); + final boolean res = GDI.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData)); GDI.ReleaseDC(0, screenDC); return res; } @Override protected final Buffer getGammaRamp() { - ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]); - long screenDC = GDI.GetDC(0); - boolean res = GDI.GetDeviceGammaRamp(screenDC, rampData); + final ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]); + final long screenDC = GDI.GetDC(0); + final boolean res = GDI.GetDeviceGammaRamp(screenDC, rampData); GDI.ReleaseDC(0, screenDC); if (!res) { return null; @@ -589,12 +589,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final void resetGammaRamp(Buffer originalGammaRamp) { + protected final void resetGammaRamp(final Buffer originalGammaRamp) { if (originalGammaRamp == null) { // getGammaRamp failed earlier return; } - long screenDC = GDI.GetDC(0); + final long screenDC = GDI.GetDC(0); GDI.SetDeviceGammaRamp(screenDC, originalGammaRamp); GDI.ReleaseDC(0, screenDC); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java index 6098cde7f..2285ae996 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java @@ -47,13 +47,13 @@ public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLi @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("wglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return WGL.wglGetProcAddress(toolGetProcAddressHandle, funcName); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 5dd9f88b2..465b5f560 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -66,24 +66,24 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio private boolean isDetermined = false; private boolean isExternal = false; - WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser) { + WindowsWGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested); this.chooser=chooser; this.isDetermined = false; } - WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, - WGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested) { + WindowsWGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final WGLGLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); setCapsPFD(capsChosen); this.chooser=null; } - static WindowsWGLGraphicsConfiguration createFromExternal(GLDrawableFactory _factory, long hdc, int pfdID, - GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen) + static WindowsWGLGraphicsConfiguration createFromExternal(final GLDrawableFactory _factory, final long hdc, final int pfdID, + GLProfile glp, final AbstractGraphicsScreen screen, final boolean onscreen) { if(_factory==null) { throw new GLException("Null factory"); @@ -97,10 +97,10 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio if(null==glp) { glp = GLProfile.getDefault(screen.getDevice()); } - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; - AbstractGraphicsDevice device = screen.getDevice(); - WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); - boolean hasARB = null != sharedResource && sharedResource.hasARBPixelFormat(); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; + final AbstractGraphicsDevice device = screen.getDevice(); + final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + final boolean hasARB = null != sharedResource && sharedResource.hasARBPixelFormat(); WGLGLCapabilities caps = null; @@ -114,7 +114,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio ", pfdID "+pfdID+", onscreen "+onscreen+", hasARB "+hasARB); } - WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps); + final WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps); cfg.markExternal(); return cfg; } @@ -136,7 +136,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * @see #isDetermined() * @see #isExternal() */ - public final void updateGraphicsConfiguration(GLDrawableFactory factory, NativeSurface ns, int[] pfIDs) { + public final void updateGraphicsConfiguration(final GLDrawableFactory factory, final NativeSurface ns, final int[] pfIDs) { WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, ns, pfIDs); } @@ -150,15 +150,15 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * * @see #isDetermined() */ - public final void preselectGraphicsConfiguration(GLDrawableFactory factory, int[] pfdIDs) { - AbstractGraphicsDevice device = getScreen().getDevice(); + public final void preselectGraphicsConfiguration(final GLDrawableFactory factory, final int[] pfdIDs) { + final AbstractGraphicsDevice device = getScreen().getDevice(); WindowsWGLGraphicsConfigurationFactory.preselectGraphicsConfiguration(chooser, factory, device, this, pfdIDs); } /** * Sets the hdc's PixelFormat, this configuration's capabilities and marks it as determined. */ - final void setPixelFormat(long hdc, WGLGLCapabilities caps) { + final void setPixelFormat(final long hdc, final WGLGLCapabilities caps) { if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -170,12 +170,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } if( !caps.isBackgroundOpaque() ) { final long hwnd = GDI.WindowFromDC(hdc); - DWM_BLURBEHIND bb = DWM_BLURBEHIND.create(); + final DWM_BLURBEHIND bb = DWM_BLURBEHIND.create(); bb.setDwFlags(GDI.DWM_BB_ENABLE| GDI.DWM_BB_TRANSITIONONMAXIMIZED); bb.setFEnable( 1 ); boolean ok = GDI.DwmEnableBlurBehindWindow(hwnd, bb); if( ok ) { - MARGINS m = MARGINS.create(); + final MARGINS m = MARGINS.create(); m.setCxLeftWidth(-1); m.setCxRightWidth(-1); m.setCyBottomHeight(-1); @@ -198,7 +198,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * Only sets this configuration's capabilities and marks it as determined, * the actual pixelformat is not set. */ - final void setCapsPFD(WGLGLCapabilities caps) { + final void setCapsPFD(final WGLGLCapabilities caps) { setChosenCapabilities(caps); this.isDetermined = true; if (DEBUG) { @@ -228,7 +228,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; } public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; } - static int fillAttribsForGeneralWGLARBQuery(WindowsWGLDrawableFactory.SharedResource sharedResource, IntBuffer iattributes) { + static int fillAttribsForGeneralWGLARBQuery(final WindowsWGLDrawableFactory.SharedResource sharedResource, final IntBuffer iattributes) { int niattribs = 0; iattributes.put(niattribs++, WGLExt.WGL_DRAW_TO_WINDOW_ARB); if(sharedResource.hasARBPBuffer()) { @@ -257,7 +257,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return niattribs; } - static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) { + static boolean wglARBPFIDValid(final WindowsWGLContext sharedCtx, final long hdc, final int pfdID) { final IntBuffer out = Buffers.newDirectIntBuffer(1); final IntBuffer in = Buffers.newDirectIntBuffer(1); in.put(0, WGLExt.WGL_COLOR_BITS_ARB); @@ -268,12 +268,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return true; } - static int wglARBPFDIDCount(WindowsWGLContext sharedCtx, long hdc) { + static int wglARBPFDIDCount(final WindowsWGLContext sharedCtx, final long hdc) { final IntBuffer iresults = Buffers.newDirectIntBuffer(1); final IntBuffer iattributes = Buffers.newDirectIntBuffer(1); iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB); - WGLExt wglExt = sharedCtx.getWGLExt(); + final WGLExt wglExt = sharedCtx.getWGLExt(); // pfdID shall be ignored here (spec), however, pass a valid pdf index '1' below (possible driver bug) if (!wglExt.wglGetPixelFormatAttribivARB(hdc, 1 /* pfdID */, 0, 1, iattributes, iresults)) { if(DEBUG) { @@ -295,17 +295,17 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pfdIDCount; } - static int[] wglAllARBPFDIDs(int pfdIDCount) { - int[] pfdIDs = new int[pfdIDCount]; + static int[] wglAllARBPFDIDs(final int pfdIDCount) { + final int[] pfdIDs = new int[pfdIDCount]; for (int i = 0; i < pfdIDCount; i++) { pfdIDs[i] = 1 + i; } return pfdIDs; } - static WGLGLCapabilities wglARBPFID2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource, - AbstractGraphicsDevice device, GLProfile glp, - long hdc, int pfdID, int winattrbits) { + static WGLGLCapabilities wglARBPFID2GLCapabilities(final WindowsWGLDrawableFactory.SharedResource sharedResource, + final AbstractGraphicsDevice device, final GLProfile glp, + final long hdc, final int pfdID, final int winattrbits) { if (!sharedResource.hasARBPixelFormat()) { return null; } @@ -321,9 +321,9 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return AttribList2GLCapabilities(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits); } - static int[] wglChoosePixelFormatARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, - GLCapabilitiesImmutable capabilities, - long hdc, IntBuffer iattributes, int accelerationMode, FloatBuffer fattributes) + static int[] wglChoosePixelFormatARB(final WindowsWGLDrawableFactory.SharedResource sharedResource, final AbstractGraphicsDevice device, + final GLCapabilitiesImmutable capabilities, + final long hdc, final IntBuffer iattributes, final int accelerationMode, final FloatBuffer fattributes) { if ( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, @@ -361,7 +361,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio System.err.println("wglChoosePixelFormatARB: NumFormats (wglChoosePixelFormatARB) accelMode 0x" + Integer.toHexString(accelerationMode) + ": " + numFormats); for (int i = 0; i < numFormats; i++) { - WGLGLCapabilities dbgCaps0 = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities( + final WGLGLCapabilities dbgCaps0 = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities( sharedResource, device, capabilities.getGLProfile(), hdc, pformats[i], GLGraphicsConfigurationUtil.ALL_BITS); System.err.println("pixel format " + pformats[i] + " (index " + i + "): " + dbgCaps0); } @@ -369,8 +369,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pformats; } - static List <GLCapabilitiesImmutable> wglARBPFIDs2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource, - AbstractGraphicsDevice device, GLProfile glp, long hdc, int[] pfdIDs, int winattrbits, boolean onlyFirstValid) { + static List <GLCapabilitiesImmutable> wglARBPFIDs2GLCapabilities(final WindowsWGLDrawableFactory.SharedResource sharedResource, + final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int[] pfdIDs, final int winattrbits, final boolean onlyFirstValid) { if (!sharedResource.hasARBPixelFormat()) { return null; } @@ -380,7 +380,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final IntBuffer iresults = Buffers.newDirectIntBuffer(2*MAX_ATTRIBS); final int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes); - ArrayList<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(); + final ArrayList<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(); for(int i = 0; i<numFormats; i++) { if ( pfdIDs[i] >= 1 && @@ -396,7 +396,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio break; } } else if(DEBUG) { - GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS); + final GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS); System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> skip]: pfdID "+pfdIDs[i]+", "+skipped+", winattr "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString()); } } else if (DEBUG) { @@ -411,11 +411,11 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return bucket; } - static boolean GLCapabilities2AttribList(GLCapabilitiesImmutable caps, - IntBuffer iattributes, - WindowsWGLDrawableFactory.SharedResource sharedResource, - int accelerationValue, - int[] floatMode) throws GLException { + static boolean GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + final IntBuffer iattributes, + final WindowsWGLDrawableFactory.SharedResource sharedResource, + final int accelerationValue, + final int[] floatMode) throws GLException { if (!sharedResource.hasARBPixelFormat()) { return false; } @@ -539,14 +539,14 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, - final IntBuffer iattribs, final int niattribs, IntBuffer iresults, final int winattrmask) { + final IntBuffer iattribs, final int niattribs, final IntBuffer iresults, final int winattrmask) { final int allDrawableTypeBits = AttribList2DrawableTypeBits(iattribs, niattribs, iresults); int drawableTypeBits = winattrmask & allDrawableTypeBits; if( 0 == drawableTypeBits ) { return null; } - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); if (WGLUtil.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) { // remove displayable bits, since pfdID is non displayable @@ -565,23 +565,23 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio // GDI PIXELFORMAT // - static int[] wglAllGDIPFIDs(long hdc) { - int numFormats = WGLUtil.DescribePixelFormat(hdc, 1, 0, null); + static int[] wglAllGDIPFIDs(final long hdc) { + final int numFormats = WGLUtil.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { throw new GLException("DescribePixelFormat: No formats - HDC 0x" + Long.toHexString(hdc) + ", LastError: " + GDI.GetLastError()); } - int[] pfdIDs = new int[numFormats]; + final int[] pfdIDs = new int[numFormats]; for (int i = 0; i < numFormats; i++) { pfdIDs[i] = 1 + i; } return pfdIDs; } - static int PFD2DrawableTypeBits(PIXELFORMATDESCRIPTOR pfd) { + static int PFD2DrawableTypeBits(final PIXELFORMATDESCRIPTOR pfd) { int val = 0; - int dwFlags = pfd.getDwFlags(); + final int dwFlags = pfd.getDwFlags(); if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) { val |= GLGraphicsConfigurationUtil.WINDOW_BIT | @@ -593,8 +593,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return val; } - static WGLGLCapabilities PFD2GLCapabilities(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); + static WGLGLCapabilities PFD2GLCapabilities(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); if(null == pfd) { return null; } @@ -626,12 +626,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } - static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); + static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) { + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); return PFD2GLCapabilitiesNoCheck(device, glp, pfd, pfdID); } - static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, GLProfile glp, PIXELFORMATDESCRIPTOR pfd, int pfdID) { + static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(final AbstractGraphicsDevice device, final GLProfile glp, final PIXELFORMATDESCRIPTOR pfd, final int pfdID) { if(null == pfd) { return null; } @@ -641,8 +641,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res); } - static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilitiesImmutable caps, PIXELFORMATDESCRIPTOR pfd) { - int colorDepth = (caps.getRedBits() + + static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(final GLCapabilitiesImmutable caps, final PIXELFORMATDESCRIPTOR pfd) { + final int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); if (colorDepth < 15) { @@ -680,7 +680,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio pfd.setCGreenBits((byte) caps.getGreenBits()); pfd.setCBlueBits ((byte) caps.getBlueBits()); pfd.setCAlphaBits((byte) caps.getAlphaBits()); - int accumDepth = (caps.getAccumRedBits() + + final int accumDepth = (caps.getAccumRedBits() + caps.getAccumGreenBits() + caps.getAccumBlueBits()); pfd.setCAccumBits ((byte) accumDepth); @@ -699,8 +699,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pfd; } - static PIXELFORMATDESCRIPTOR createPixelFormatDescriptor(long hdc, int pfdID) { - PIXELFORMATDESCRIPTOR pfd = PIXELFORMATDESCRIPTOR.create(); + static PIXELFORMATDESCRIPTOR createPixelFormatDescriptor(final long hdc, final int pfdID) { + final PIXELFORMATDESCRIPTOR pfd = PIXELFORMATDESCRIPTOR.create(); pfd.setNSize((short) PIXELFORMATDESCRIPTOR.size()); pfd.setNVersion((short) 1); if(0 != hdc && 1 <= pfdID) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index 969e45ed8..ea92b38fd 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -81,7 +81,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (! (capsChosen instanceof GLCapabilitiesImmutable) ) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen"); @@ -98,14 +98,14 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen); } - static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLCapabilitiesImmutable caps, - AbstractGraphicsScreen absScreen) { + static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(final GLCapabilitiesImmutable caps, + final AbstractGraphicsScreen absScreen) { return chooseGraphicsConfigurationStatic(caps, caps, null, absScreen); } static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { if(null==absScreen) { absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); @@ -115,7 +115,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return new WindowsWGLGraphicsConfiguration( absScreen, capsChosen, capsReq, chooser ); } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final WindowsWGLDrawableFactory factory, final AbstractGraphicsDevice device) { final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -136,7 +136,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat sharedDrawable.lockSurface(); } try { - long hdc = sharedDrawable.getHandle(); + final long hdc = sharedDrawable.getHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -164,17 +164,17 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return availableCaps; } - private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, GLProfile glProfile, long hdc) { + private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesARB(final WindowsWGLDrawableFactory.SharedResource sharedResource, final AbstractGraphicsDevice device, final GLProfile glProfile, final long hdc) { final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc); final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFDIDs(pfdIDCount); return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT, false); // w/o BITMAP } - private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesGDI(AbstractGraphicsDevice device, GLProfile glProfile, long hdc, boolean bitmapOnly) { - int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); - int numFormats = pformats.length; - List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(numFormats); + private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesGDI(final AbstractGraphicsDevice device, final GLProfile glProfile, final long hdc, final boolean bitmapOnly) { + final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); + final int numFormats = pformats.length; + final List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(numFormats); for (int i = 0; i < numFormats; i++) { final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i], bitmapOnly ? GLGraphicsConfigurationUtil.BITMAP_BIT : GLGraphicsConfigurationUtil.ALL_BITS ); @@ -192,8 +192,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat * @param ns * @param pfIDs optional pool of preselected PixelFormat IDs, maybe null for unrestricted selection */ - static void updateGraphicsConfiguration(CapabilitiesChooser chooser, - GLDrawableFactory factory, NativeSurface ns, int[] pfdIDs) { + static void updateGraphicsConfiguration(final CapabilitiesChooser chooser, + final GLDrawableFactory factory, final NativeSurface ns, final int[] pfdIDs) { if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } @@ -208,11 +208,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat throw new GLException("Surface not ready (lockSurface)"); } try { - long hdc = ns.getSurfaceHandle(); + final long hdc = ns.getSurfaceHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration(); if( !config.isExternal() ) { if( !config.isDetermined() ) { @@ -239,9 +239,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - static void preselectGraphicsConfiguration(CapabilitiesChooser chooser, - GLDrawableFactory _factory, AbstractGraphicsDevice device, - WindowsWGLGraphicsConfiguration config, int[] pfdIDs) { + static void preselectGraphicsConfiguration(final CapabilitiesChooser chooser, + final GLDrawableFactory _factory, final AbstractGraphicsDevice device, + final WindowsWGLGraphicsConfiguration config, final int[] pfdIDs) { if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } @@ -254,8 +254,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if ( !(_factory instanceof WindowsWGLDrawableFactory) ) { throw new GLException("GLDrawableFactory is not a WindowsWGLDrawableFactory, but: "+_factory.getClass().getSimpleName()); } - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; - WindowsWGLDrawable sharedDrawable = factory.getOrCreateSharedDrawable(device); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; + final WindowsWGLDrawable sharedDrawable = factory.getOrCreateSharedDrawable(device); if(null == sharedDrawable) { throw new IllegalArgumentException("Shared Drawable is null"); } @@ -264,7 +264,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat throw new GLException("Shared Surface not ready (lockSurface): "+device+" -> "+sharedDrawable); } try { - long hdc = sharedDrawable.getHandle(); + final long hdc = sharedDrawable.getHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -274,8 +274,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - private static void updateGraphicsConfiguration(WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, - GLDrawableFactory factory, long hdc, boolean extHDC, int[] pfdIDs) { + private static void updateGraphicsConfiguration(final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, + final GLDrawableFactory factory, final long hdc, final boolean extHDC, final int[] pfdIDs) { if (DEBUG) { if(extHDC) { System.err.println("updateGraphicsConfiguration(using shared): hdc "+toHexString(hdc)); @@ -284,8 +284,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } System.err.println("user chosen caps " + config.getChosenCapabilities()); } - AbstractGraphicsDevice device = config.getScreen().getDevice(); - WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); + final WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device); final GLContext sharedContext; if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); @@ -311,8 +311,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - private static boolean updateGraphicsConfigurationARB(WindowsWGLDrawableFactory factory, WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, - long hdc, boolean extHDC, int[] pformats) { + private static boolean updateGraphicsConfigurationARB(final WindowsWGLDrawableFactory factory, final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, + final long hdc, final boolean extHDC, int[] pformats) { final AbstractGraphicsDevice device = config.getScreen().getDevice(); final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); @@ -462,8 +462,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return true; } - private static boolean updateGraphicsConfigurationGDI(WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, long hdc, - boolean extHDC, int[] pformats) { + private static boolean updateGraphicsConfigurationGDI(final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, final long hdc, + final boolean extHDC, int[] pformats) { final GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if( !capsChosen.isOnscreen() && capsChosen.isPBuffer() ) { if (DEBUG) { @@ -557,7 +557,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps); } } else if(DEBUG) { - GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]); + final GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]); System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> skip]: pfdID "+pformats[i]+", "+skipped); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 96bd0bdd0..66d3018fc 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -70,8 +70,8 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -84,7 +84,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: creating default device: "+absScreen); } } - AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; + final AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) { @@ -104,10 +104,10 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: got "+absScreen); } - WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); - DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); - GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice, capsChosen); - WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration) + final WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + final DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); + final GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice, capsChosen); + final WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration) configFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, winScreen, nativeVisualID); @@ -115,7 +115,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen); } - GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); + final GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); GraphicsConfiguration chosenGC = null; if ( drawableFactory instanceof WindowsWGLDrawableFactory ) { @@ -133,7 +133,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: Found new AWT PFD ID "+winConfig.getPixelFormatID()+" -> "+winConfig); } } - } catch (GLException gle0) { + } catch (final GLException gle0) { if(DEBUG) { gle0.printStackTrace(); } @@ -150,11 +150,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu // // collect all available PFD IDs - GraphicsConfiguration[] configs = device.getConfigurations(); - int[] pfdIDs = new int[configs.length]; - ArrayHashSet<Integer> pfdIDOSet = new ArrayHashSet<Integer>(); + final GraphicsConfiguration[] configs = device.getConfigurations(); + final int[] pfdIDs = new int[configs.length]; + final ArrayHashSet<Integer> pfdIDOSet = new ArrayHashSet<Integer>(); for (int i = 0; i < configs.length; i++) { - GraphicsConfiguration gc = configs[i]; + final GraphicsConfiguration gc = configs[i]; pfdIDs[i] = Win32SunJDKReflection.graphicsConfigurationGetPixelFormatID(gc); pfdIDOSet.add(new Integer(pfdIDs[i])); if(DEBUG) { @@ -165,7 +165,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: PFD IDs: "+pfdIDs.length+", unique: "+pfdIDOSet.size()); } winConfig.preselectGraphicsConfiguration(drawableFactory, pfdIDs); - int gcIdx = pfdIDOSet.indexOf(new Integer(winConfig.getPixelFormatID())); + final int gcIdx = pfdIDOSet.indexOf(new Integer(winConfig.getPixelFormatID())); if( 0 > gcIdx ) { chosenGC = configs[gcIdx]; if(DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 12e3db3bd..e32177b3d 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -46,7 +46,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; public class GLXUtil { public static final boolean DEBUG = Debug.debug("GLXUtil"); - public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) { + public static synchronized boolean isGLXAvailableOnServer(final X11GraphicsDevice x11Device) { if(null == x11Device) { throw new IllegalArgumentException("null X11GraphicsDevice"); } @@ -57,14 +57,14 @@ public class GLXUtil { x11Device.lock(); try { glXAvailable = GLX.glXQueryExtension(x11Device.getHandle(), null, null); - } catch (Throwable t) { /* n/a */ + } catch (final Throwable t) { /* n/a */ } finally { x11Device.unlock(); } return glXAvailable; } - public static String getGLXClientString(X11GraphicsDevice x11Device, int name) { + public static String getGLXClientString(final X11GraphicsDevice x11Device, final int name) { x11Device.lock(); try { return GLX.glXGetClientString(x11Device.getHandle(), name); @@ -72,7 +72,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) { + public static String queryGLXServerString(final X11GraphicsDevice x11Device, final int screen_idx, final int name) { x11Device.lock(); try { return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name); @@ -80,7 +80,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) { + public static String queryGLXExtensionsString(final X11GraphicsDevice x11Device, final int screen_idx) { x11Device.lock(); try { return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx); @@ -89,7 +89,7 @@ public class GLXUtil { } } - public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) { + public static VersionNumber getGLXServerVersionNumber(final X11GraphicsDevice x11Device) { final IntBuffer major = Buffers.newDirectIntBuffer(1); final IntBuffer minor = Buffers.newDirectIntBuffer(1); @@ -102,12 +102,12 @@ public class GLXUtil { // Work around bugs in ATI's Linux drivers where they report they // only implement GLX version 1.2 on the server side if (major.get(0) == 1 && minor.get(0) == 2) { - String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); + final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major.put(0, Integer.valueOf(str.substring(0, 1)).intValue()); minor.put(0, Integer.valueOf(str.substring(2, 3)).intValue()); - } catch (Exception e) { + } catch (final Exception e) { major.put(0, 1); minor.put(0, 2); } @@ -118,18 +118,18 @@ public class GLXUtil { return new VersionNumber(major.get(0), minor.get(0), 0); } - public static boolean isMultisampleAvailable(String extensions) { + public static boolean isMultisampleAvailable(final String extensions) { if (extensions != null) { return (extensions.indexOf("GLX_ARB_multisample") >= 0); } return false; } - public static boolean isVendorNVIDIA(String vendor) { + public static boolean isVendorNVIDIA(final String vendor) { return vendor != null && vendor.startsWith("NVIDIA") ; } - public static boolean isVendorATI(String vendor) { + public static boolean isVendorATI(final String vendor) { return vendor != null && vendor.startsWith("ATI") ; } @@ -143,7 +143,7 @@ public class GLXUtil { return clientVersionNumber; } - public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) { + public static synchronized void initGLXClientDataSingleton(final X11GraphicsDevice x11Device) { if(null != clientVendorName) { return; // already initialized } @@ -156,14 +156,14 @@ public class GLXUtil { clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS)); clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR); - int[] major = new int[1]; - int[] minor = new int[1]; + final int[] major = new int[1]; + final int[] minor = new int[1]; final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major[0] = Integer.valueOf(str.substring(0, 1)).intValue(); minor[0] = Integer.valueOf(str.substring(2, 3)).intValue(); - } catch (Exception e) { + } catch (final Exception e) { major[0] = 1; minor[0] = 2; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 45c666230..7040621be 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -58,7 +58,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXContext extends X11GLXContext { - private X11ExternalGLXContext(Drawable drawable, long ctx) { + private X11ExternalGLXContext(final Drawable drawable, final long ctx) { super(drawable, null); this.contextHandle = ctx; GLContextShareSet.contextCreated(this); @@ -68,20 +68,20 @@ public class X11ExternalGLXContext extends X11GLXContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static X11ExternalGLXContext create(GLDrawableFactory factory, GLProfile glp) { - long ctx = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXContext create(final GLDrawableFactory factory, final GLProfile glp) { + final long ctx = GLX.glXGetCurrentContext(); if (ctx == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable/context current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -90,7 +90,7 @@ public class X11ExternalGLXContext extends X11GLXContext { h=val.get(0); GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val); X11GLXGraphicsConfiguration cfg = null; @@ -99,7 +99,7 @@ public class X11ExternalGLXContext extends X11GLXContext { // create and use a default config (this has been observed when running on CentOS 5.5 inside // of VMWare Server 2.0 with the Mesa 6.5.1 drivers) if( VisualIDHolder.VID_UNDEFINED == val.get(0) || !X11GLXGraphicsConfiguration.GLXFBConfigIDValid(display, x11Screen.getIndex(), val.get(0)) ) { - GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen, VisualIDHolder.VID_UNDEFINED); if(DEBUG) { System.err.println("X11ExternalGLXContext invalid FBCONFIG_ID "+val.get(0)+", using default cfg: " + cfg); @@ -131,12 +131,12 @@ public class X11ExternalGLXContext extends X11GLXContext { // Need to provide the display connection to extension querying APIs static class Drawable extends X11GLXDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -150,7 +150,7 @@ public class X11ExternalGLXContext extends X11GLXContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index 650fd31d3..2076ce454 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -55,30 +55,30 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXDrawable extends X11GLXDrawable { - private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeSurface surface) { + private X11ExternalGLXDrawable(final GLDrawableFactory factory, final NativeSurface surface) { super(factory, surface, true); } - protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) { - long context = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXDrawable create(final GLDrawableFactory factory, final GLProfile glp) { + final long context = GLX.glXGetCurrentContext(); if (context == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, context, GLX.GLX_FBCONFIG_ID, val); - X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); + final X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -96,16 +96,16 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new Context(this, shareWith); } - public void setSize(int newWidth, int newHeight) { + public void setSize(final int newWidth, final int newHeight) { throw new GLException("Should not call this"); } class Context extends X11GLXContext { - Context(X11GLXDrawable drawable, GLContext shareWith) { + Context(final X11GLXDrawable drawable, final GLContext shareWith) { super(drawable, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index e0b69ffd4..36e791641 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -41,14 +41,14 @@ public class X11GLCapabilities extends GLCapabilities { final private long fbcfg; final private int fbcfgid; - public X11GLCapabilities(XVisualInfo xVisualInfo, long fbcfg, int fbcfgid, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final long fbcfg, final int fbcfgid, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = fbcfg; this.fbcfgid = fbcfgid; } - public X11GLCapabilities(XVisualInfo xVisualInfo, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = 0; @@ -64,7 +64,7 @@ public class X11GLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -78,7 +78,7 @@ public class X11GLCapabilities extends GLCapabilities { final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid!=VisualIDHolder.VID_UNDEFINED; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 57d39d533..d4c3abc49 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -94,13 +94,13 @@ public class X11GLXContext extends GLContextImpl { extensionNameMap.put(GLExtensions.ARB_pixel_format, X11GLXDrawableFactory.GLX_SGIX_pbuffer); // good enough } - X11GLXContext(GLDrawableImpl drawable, - GLContext shareWith) { + X11GLXContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _glXExt=null; glXExtProcAddressTable = null; hasSwapInterval = 0; @@ -159,7 +159,7 @@ public class X11GLXContext extends GLContextImpl { return isGLXVersionGreaterEqualOneThree(); } - private final boolean glXMakeContextCurrent(long dpy, long writeDrawable, long readDrawable, long ctx) { + private final boolean glXMakeContextCurrent(final long dpy, final long writeDrawable, final long readDrawable, final long ctx) { boolean res = false; try { @@ -173,7 +173,7 @@ public class X11GLXContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if( DEBUG_TRACE_SWITCH ) { System.err.println(getThreadName()+": Warning: X11GLXContext.glXMakeContextCurrent failed: "+re+", with "+ "dpy "+toHexString(dpy)+ @@ -187,7 +187,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void destroyContextARBImpl(long ctx) { + protected void destroyContextARBImpl(final long ctx) { final long display = drawable.getNativeSurface().getDisplayHandle(); glXMakeContextCurrent(display, 0, 0, 0); @@ -207,22 +207,22 @@ public class X11GLXContext extends GLContextImpl { }; @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { updateGLXProcAddressTable(); - GLXExt _glXExt = getGLXExt(); + final GLXExt _glXExt = getGLXExt(); if(DEBUG) { System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct+ ", glXCreateContextAttribsARB: "+toHexString(glXExtProcAddressTable._addressof_glXCreateContextAttribsARB)); } - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; long ctx=0; - IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); + final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); attribs.put(ctx_arb_attribs_idx_major + 1, major); attribs.put(ctx_arb_attribs_idx_minor + 1, minor); @@ -246,8 +246,8 @@ public class X11GLXContext extends GLContextImpl { attribs.put(ctx_arb_attribs_idx_flags + 1, flags); } - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); final long display = device.getHandle(); try { @@ -256,9 +256,9 @@ public class X11GLXContext extends GLContextImpl { X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set X11Lib.XSync(display, false); ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if(DEBUG) { - Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); + final Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); t.printStackTrace(); } } @@ -291,7 +291,7 @@ public class X11GLXContext extends GLContextImpl { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); final X11GLXContext sharedContext = (X11GLXContext) factory.getOrCreateSharedContext(device); - long display = device.getHandle(); + final long display = device.getHandle(); if ( 0 != shareWithHandle ) { direct = GLX.glXIsDirect(display, shareWithHandle); @@ -410,7 +410,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - long dpy = drawable.getNativeSurface().getDisplayHandle(); + final long dpy = drawable.getNativeSurface().getDisplayHandle(); if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { @@ -426,7 +426,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { - long display = drawable.getNativeSurface().getDisplayHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (!glXMakeContextCurrent(display, 0, 0, 0)) { throw new GLException(getThreadName()+": Error freeing OpenGL context"); } @@ -438,10 +438,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void copyImpl(GLContext source, int mask) throws GLException { - long dst = getHandle(); - long src = source.getHandle(); - long display = drawable.getNativeSurface().getDisplayHandle(); + protected void copyImpl(final GLContext source, final int mask) throws GLException { + final long dst = getHandle(); + final long src = source.getHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (0 == display) { throw new GLException(getThreadName()+": Connection to X display not yet set up"); } @@ -482,7 +482,7 @@ public class X11GLXContext extends GLContextImpl { protected final StringBuilder getPlatformExtensionsStringImpl() { final NativeSurface ns = drawable.getNativeSurface(); final X11GraphicsDevice x11Device = (X11GraphicsDevice) ns.getGraphicsConfiguration().getScreen().getDevice(); - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); x11Device.lock(); try{ if (DEBUG) { @@ -519,7 +519,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; } final GLXExt glXExt = getGLXExt(); @@ -536,7 +536,7 @@ public class X11GLXContext extends GLContextImpl { } else { hasSwapInterval = -1; } - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } /* try { switch( hasSwapInterval ) { @@ -549,16 +549,16 @@ public class X11GLXContext extends GLContextImpl { if (2 == hasSwapInterval) { try { return 0 == glXExt.glXSwapIntervalSGI(interval); - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } return false; } - private final int initSwapGroupImpl(GLXExt glXExt) { + private final int initSwapGroupImpl(final GLXExt glXExt) { if(0==hasSwapGroupNV) { try { hasSwapGroupNV = glXExt.isExtensionAvailable(GLXExtensions.GLX_NV_swap_group)?1:-1; - } catch (Throwable t) { hasSwapGroupNV=1; } + } catch (final Throwable t) { hasSwapGroupNV=1; } if(DEBUG) { System.err.println("initSwapGroupImpl: "+GLXExtensions.GLX_NV_swap_group+": "+hasSwapGroupNV); } @@ -567,10 +567,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + protected final boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { final NativeSurface ns = drawable.getNativeSurface(); try { @@ -583,53 +583,53 @@ public class X11GLXContext extends GLContextImpl { maxBarriersNIO.get(maxGroups, maxGroups_offset, maxBarriersNIO.remaining()); res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean joinSwapGroupImpl(int group) { + protected final boolean joinSwapGroupImpl(final int group) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXJoinSwapGroupNV(drawable.getNativeSurface().getDisplayHandle(), drawable.getHandle(), group) ) { currentSwapGroup = group; res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean bindSwapBarrierImpl(int group, int barrier) { + protected final boolean bindSwapBarrierImpl(final int group, final int barrier) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXBindSwapBarrierNV(drawable.getNativeSurface().getDisplayHandle(), group, barrier) ) { res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { getGLXExt().glXFreeMemoryNV(pointer); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java index 155c00c4c..c29bc3bc3 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java @@ -47,7 +47,7 @@ import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { - protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); } @@ -59,7 +59,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { @Override protected void setRealizedImpl() { if(realized) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); config.updateGraphicsConfiguration(); if (DEBUG) { @@ -69,7 +69,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle()); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index f7938f463..fbab32963 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -103,7 +103,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { if(null!=tmp && tmp.isLibComplete()) { GLX.getGLXProcAddressTable().reset(tmp); } - } catch (Exception ex) { + } catch (final Exception ex) { tmp = null; if(DEBUG) { ex.printStackTrace(); @@ -159,7 +159,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return x11GLXDynamicLookupHelper; } @@ -180,9 +180,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { GLDrawableImpl drawable; GLContextImpl context; - SharedResource(X11GraphicsDevice dev, X11GraphicsScreen scrn, - GLDrawableImpl draw, GLContextImpl ctx, - VersionNumber glXServerVer, String glXServerVendor, boolean glXServerMultisampleAvail) { + SharedResource(final X11GraphicsDevice dev, final X11GraphicsScreen scrn, + final GLDrawableImpl draw, final GLContextImpl ctx, + final VersionNumber glXServerVer, final String glXServerVendor, final boolean glXServerMultisampleAvail) { device = dev; screen = scrn; drawable = draw; @@ -227,11 +227,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { + public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { return sharedMap.put(connection, resource); } @Override - public SharedResourceRunner.Resource mapGet(String connection) { + public SharedResourceRunner.Resource mapGet(final String connection) { return sharedMap.get(connection); } @Override @@ -240,7 +240,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(String connection) { + public boolean isDeviceSupported(final String connection) { final boolean res; final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); x11Device.lock(); @@ -257,7 +257,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public SharedResourceRunner.Resource createSharedResource(String connection) { + public SharedResourceRunner.Resource createSharedResource(final String connection) { final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); sharedDevice.lock(); try { @@ -312,7 +312,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, glXServerVersion, glXServerVendorName, glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable()); - } catch (Throwable t) { + } catch (final Throwable t) { throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t); } finally { sharedDevice.unlock(); @@ -320,8 +320,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public void releaseSharedResource(SharedResourceRunner.Resource shared) { - SharedResource sr = (SharedResource) shared; + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; if (DEBUG) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); @@ -361,7 +361,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null != x11GLXDynamicLookupHelper && device instanceof X11GraphicsDevice) { return true; } @@ -374,11 +374,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice device) { return (SharedResource) sharedResourceRunner.getOrCreateShared(device); } - protected final long getOrCreateSharedDpy(AbstractGraphicsDevice device) { + protected final long getOrCreateSharedDpy(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getDevice().getHandle(); @@ -387,12 +387,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } @Override - protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -400,19 +400,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { return new X11PixmapGLXDrawable(this, target); } // PBuffer GLDrawable Creation GLDrawableImpl pbufferDrawable; - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); /** * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277, @@ -420,7 +420,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { * The dummy context shall also use the same Display, * since switching Display in this regard is another ATI bug. */ - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if( null!=sr && sr.isGLXVendorATI() && null == GLContext.getCurrent() ) { sr.getContext().makeCurrent(); try { @@ -434,9 +434,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return pbufferDrawable; } - public final boolean isGLXMultisampleAvailable(AbstractGraphicsDevice device) { + public final boolean isGLXMultisampleAvailable(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXMultisampleAvailable(); } @@ -444,9 +444,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final VersionNumber getGLXVersionNumber(AbstractGraphicsDevice device) { + public final VersionNumber getGLXVersionNumber(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.getGLXVersion(); } @@ -457,9 +457,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return null; } - public final boolean isGLXVersionGreaterEqualOneOne(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneOne(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneOne(); } @@ -471,9 +471,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final boolean isGLXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneThree(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneThree(); } @@ -486,9 +486,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, final GLProfile glp) { if(null == device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); + final SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); if(null!=sr) { device = sr.getDevice(); } @@ -497,10 +497,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); @@ -516,14 +516,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); } @Override - protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx); final int xvisualID = X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle); @@ -546,7 +546,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public final boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return canCreateGLPbuffer(device, null /* GLProfile not used for query on X11 */); } @@ -567,13 +567,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return gammaRampLength; } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return 0; } - int[] size = new int[1]; - boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, + final int[] size = new int[1]; + final boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, X11Lib.DefaultScreen(display), size, 0); if (!res) { @@ -585,19 +585,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final boolean setGammaRamp(float[] ramp) { - long display = getOrCreateSharedDpy(defaultDevice); + protected final boolean setGammaRamp(final float[] ramp) { + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return false; } - int len = ramp.length; - short[] rampData = new short[len]; + final int len = ramp.length; + final short[] rampData = new short[len]; for (int i = 0; i < len; i++) { rampData[i] = (short) (ramp[i] * 65535); } - boolean res = X11Lib.XF86VidModeSetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), rampData.length, rampData, 0, @@ -608,24 +608,24 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @Override protected final Buffer getGammaRamp() { - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return null; } - int size = getGammaRampLength(); - ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); + final int size = getGammaRampLength(); + final ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); - boolean res = X11Lib.XF86VidModeGetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeGetGammaRamp(display, X11Lib.DefaultScreen(display), size, redRampData, @@ -638,30 +638,30 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final void resetGammaRamp(Buffer originalGammaRamp) { + protected final void resetGammaRamp(final Buffer originalGammaRamp) { if (originalGammaRamp == null) { return; // getGammaRamp failed originally } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return; } - ShortBuffer rampData = (ShortBuffer) originalGammaRamp; - int capacity = rampData.capacity(); + final ShortBuffer rampData = (ShortBuffer) originalGammaRamp; + final int capacity = rampData.capacity(); if ((capacity % 3) != 0) { throw new IllegalArgumentException("Must not be the original gamma ramp"); } - int size = capacity / 3; + final int size = capacity / 3; rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java index 951174f71..0e91a6a65 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java @@ -62,14 +62,14 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("glXGetProcAddressARB"); res.add("glXGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return GLX.glXGetProcAddress(toolGetProcAddressHandle, funcName); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index c0a3b46df..5f6a6b344 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -65,8 +65,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem public static final int MAX_ATTRIBS = 128; private final GLCapabilitiesChooser chooser; - X11GLXGraphicsConfiguration(X11GraphicsScreen screen, - X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + X11GLXGraphicsConfiguration(final X11GraphicsScreen screen, + final X11GLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo()); this.chooser=chooser; } @@ -109,7 +109,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static X11GLXGraphicsConfiguration create(GLProfile glp, X11GraphicsScreen x11Screen, int fbcfgID) { + static X11GLXGraphicsConfiguration create(GLProfile glp, final X11GraphicsScreen x11Screen, final int fbcfgID) { final X11GraphicsDevice device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = device.getHandle(); if(0==display) { @@ -131,11 +131,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps, - boolean forFBAttr, boolean isMultisampleAvailable, - long display, int screen) + static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + final boolean forFBAttr, final boolean isMultisampleAvailable, + final long display, final int screen) { - int colorDepth = (caps.getRedBits() + + final int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); if (colorDepth < 15) { @@ -237,12 +237,12 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // FBConfig - static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { - long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); + static boolean GLXFBConfigIDValid(final long display, final int screen, final int fbcfgid) { + final long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ; } - static boolean GLXFBConfigValid(long display, long fbcfg) { + static boolean GLXFBConfigValid(final long display, final long fbcfg) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) { return false; @@ -275,14 +275,14 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return val; } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual) { - XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual) { + final XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); if(null == renderPictFmt) { return null; } return renderPictFmt.getDirect(); } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual, XRenderPictFormat dest) { + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual, final XRenderPictFormat dest) { if( !X11Lib.XRenderFindVisualFormat(dpy, visual, dest) ) { return null; } else { @@ -298,7 +298,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } static List<GLCapabilitiesImmutable> GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL, - final int winattrmask, final boolean isMultisampleAvailable, boolean onlyFirstValid) { + final int winattrmask, final boolean isMultisampleAvailable, final boolean onlyFirstValid) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create(); final List<GLCapabilitiesImmutable> result = new ArrayList<GLCapabilitiesImmutable>(); @@ -424,7 +424,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - private static String glXGetFBConfigErrorCode(int err) { + private static String glXGetFBConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; @@ -432,7 +432,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static boolean glXGetFBConfig(long display, long cfg, int attrib, IntBuffer tmp) { + static boolean glXGetFBConfig(final long display, final long cfg, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } @@ -445,7 +445,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static int glXFBConfig2FBConfigID(long display, long cfg) { + static int glXFBConfig2FBConfigID(final long display, final long cfg) { final IntBuffer tmpID = Buffers.newDirectIntBuffer(1); if( glXGetFBConfig(display, cfg, GLX.GLX_FBCONFIG_ID, tmpID) ) { return tmpID.get(0); @@ -454,11 +454,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static long glXFBConfigID2FBConfig(long display, int screen, int id) { + static long glXFBConfigID2FBConfig(final long display, final int screen, final int id) { final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 }); final IntBuffer count = Buffers.newDirectIntBuffer(1); count.put(0, -1); - PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); + final PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); if (fbcfgsL == null || fbcfgsL.limit()<1) { return 0; } @@ -467,15 +467,15 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // Visual Info - static XVisualInfo XVisualID2XVisualInfo(long display, long visualID) { - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + static XVisualInfo XVisualID2XVisualInfo(final long display, final long visualID) { + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setVisualid(visualID); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); if (infos == null || infos.length == 0) { return null; } - XVisualInfo res = XVisualInfo.create(infos[0]); + final XVisualInfo res = XVisualInfo.create(infos[0]); if (DEBUG) { System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID)); System.err.println("Resulting XVisualInfo: visualid = " + toHexString(res.getVisualid())); @@ -483,8 +483,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info, - final int winattrmask, boolean isMultisampleEnabled) { + static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final XVisualInfo info, + final int winattrmask, final boolean isMultisampleEnabled) { final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT | GLGraphicsConfigurationUtil.FBO_BIT ; @@ -512,7 +512,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return null; } - GLCapabilities res = new X11GLCapabilities(info, glp); + final GLCapabilities res = new X11GLCapabilities(info, glp); res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp) != 0); res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp) != 0); @@ -551,7 +551,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } - private static String glXGetConfigErrorCode(int err) { + private static String glXGetConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN"; @@ -561,11 +561,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static int glXGetConfig(long display, XVisualInfo info, int attrib, IntBuffer tmp) { + static int glXGetConfig(final long display, final XVisualInfo info, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } - int res = GLX.glXGetConfig(display, info, attrib, tmp); + final int res = GLX.glXGetConfig(display, info, attrib, tmp); if (res != 0) { throw new GLException("glXGetConfig("+toHexString(attrib)+") failed: error code " + glXGetConfigErrorCode(res)); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 75771f884..44479acc0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -94,7 +94,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } @@ -124,8 +124,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID); } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { - X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final X11GLXDrawableFactory factory, final AbstractGraphicsDevice device) { + final X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -153,7 +153,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesFBConfig(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { PointerBuffer fbcfgsL = null; // Utilizing FBConfig @@ -184,20 +184,20 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesXVisual(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); final long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final int screen = x11Screen.getIndex(); - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } - ArrayList<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); + final ArrayList<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); for (int i = 0; i < infos.length; i++) { final GLCapabilitiesImmutable caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(absDevice, glProfile, infos[i], GLGraphicsConfigurationUtil.ALL_BITS, isMultisampleAvailable); if(null != caps) { @@ -211,17 +211,17 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { if (x11Screen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } if (capsChosen == null) { capsChosen = new GLCapabilities(null); } - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device); final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer(); @@ -250,7 +250,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return res; } - static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(X11GraphicsScreen x11Screen, int fbID, GLProfile glp) { + static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(final X11GraphicsScreen x11Screen, final int fbID, final GLProfile glp) { final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = x11Device.getHandle(); final int screen = x11Screen.getIndex(); @@ -274,19 +274,19 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { int recommendedIndex = -1; PointerBuffer fbcfgsL = null; - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); // Utilizing FBConfig // - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - long display = x11Device.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = x11Device.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device); @@ -379,27 +379,27 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final X11GraphicsScreen x11Screen, final int xvisualID) { if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen.isOnscreen(), capsChosen.isFBO(), false /* pbuffer */, capsChosen.isBitmap()); - List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); + final List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); int recommendedIndex = -1; - X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); - long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = absDevice.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice); @@ -421,10 +421,10 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } // 2nd choice: get all GLCapabilities available, preferred recommendedIndex might be available if 1st choice was successful - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } @@ -451,7 +451,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { for(int i=0; i<availableCaps.size(); ) { - VisualIDHolder vidh = availableCaps.get(i); + final VisualIDHolder vidh = availableCaps.get(i); if(vidh.getVisualID(VIDType.X11_XVISUAL) != xvisualID ) { availableCaps.remove(i); } else { @@ -468,7 +468,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } } - int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); + final int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); if ( 0 > chosenIndex ) { if (DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: failed, return null"); @@ -476,7 +476,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java index 9da189290..866662950 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java @@ -51,7 +51,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { long glXWindow; // GLXWindow, a GLXDrawable representation boolean useGLXWindow; - protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeSurface component, boolean realized) { + protected X11OnscreenGLXDrawable(final GLDrawableFactory factory, final NativeSurface component, final boolean realized) { super(factory, component, realized); glXWindow=0; useGLXWindow=false; @@ -84,10 +84,10 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { @Override protected final void createHandle() { if(USE_GLXWINDOW) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); if(config.getFBConfig()>=0) { useGLXWindow=true; - long dpy = getNativeSurface().getDisplayHandle(); + final long dpy = getNativeSurface().getDisplayHandle(); if(0!=glXWindow) { GLX.glXDestroyWindow(dpy, glXWindow); } @@ -103,7 +103,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index ae2982269..21ad06020 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -53,7 +53,7 @@ import javax.media.opengl.GLException; import com.jogamp.common.nio.Buffers; public class X11PbufferGLXDrawable extends X11GLXDrawable { - protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PbufferGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { /* GLCapabilities caps, GLCapabilitiesChooser chooser, int width, int height */ @@ -70,12 +70,12 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } protected void destroyPbuffer() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { GLX.glXDestroyPbuffer(ns.getDisplayHandle(), ns.getSurfaceHandle()); } @@ -102,7 +102,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { // Create the p-buffer. int niattribs = 0; - IntBuffer iattributes = Buffers.newDirectIntBuffer(7); + final IntBuffer iattributes = Buffers.newDirectIntBuffer(7); iattributes.put(niattribs++, GLX.GLX_PBUFFER_WIDTH); iattributes.put(niattribs++, ms.getSurfaceWidth()); @@ -112,7 +112,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { iattributes.put(niattribs++, 0); iattributes.put(niattribs++, 0); - long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); + final long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); if (pbuffer == 0) { // FIXME: query X error code for detail error message throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index 42d76097c..e217e1c2a 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -54,7 +54,7 @@ import jogamp.nativewindow.x11.XVisualInfo; public class X11PixmapGLXDrawable extends X11GLXDrawable { private long pixmap; - protected X11PixmapGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PixmapGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -68,26 +68,26 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } private void createPixmap() { - NativeSurface ns = getNativeSurface(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); - XVisualInfo vis = config.getXVisualInfo(); - int bitsPerPixel = vis.getDepth(); - AbstractGraphicsScreen aScreen = config.getScreen(); - AbstractGraphicsDevice aDevice = aScreen.getDevice(); - long dpy = aDevice.getHandle(); - int screen = aScreen.getIndex(); + final NativeSurface ns = getNativeSurface(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); + final XVisualInfo vis = config.getXVisualInfo(); + final int bitsPerPixel = vis.getDepth(); + final AbstractGraphicsScreen aScreen = config.getScreen(); + final AbstractGraphicsDevice aDevice = aScreen.getDevice(); + final long dpy = aDevice.getHandle(); + final int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), surface.getSurfaceWidth(), surface.getSurfaceHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } - long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); + final long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); if (drawable == 0) { X11Lib.XFreePixmap(dpy, pixmap); pixmap = 0; @@ -104,7 +104,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { protected void destroyPixmap() { if (pixmap == 0) return; - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); long display = ns.getDisplayHandle(); long drawable = ns.getSurfaceHandle(); @@ -117,7 +117,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { // Must destroy pixmap and GLXPixmap if (DEBUG) { - long cur = GLX.glXGetCurrentContext(); + final long cur = GLX.glXGetCurrentContext(); if (cur != 0) { System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction"); } |