summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
committerSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
commit556d92b63555a085b25e32b1cd55afce24edd07a (patch)
tree6be2b02c62a77d5aba81ffbe34c46960608be163 /src/nativewindow/classes/javax
parenta90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/Capabilities.java40
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java10
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java40
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java56
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java18
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Insets.java28
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java18
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Point.java22
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java20
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java6
16 files changed, 154 insertions, 150 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index 9eed887b5..bf8952565 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -79,7 +79,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new NativeWindowException(e);
}
}
@@ -89,7 +89,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* from <code>source</code> into this instance.
* @return this instance
*/
- public Capabilities copyFrom(CapabilitiesImmutable other) {
+ public Capabilities copyFrom(final CapabilitiesImmutable other) {
redBits = other.getRedBits();
greenBits = other.getGreenBits();
blueBits = other.getBlueBits();
@@ -122,12 +122,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if(!(obj instanceof CapabilitiesImmutable)) {
return false;
}
- CapabilitiesImmutable other = (CapabilitiesImmutable)obj;
+ final CapabilitiesImmutable other = (CapabilitiesImmutable)obj;
boolean res = other.getRedBits()==redBits &&
other.getGreenBits()==greenBits &&
other.getBlueBits()==blueBits &&
@@ -171,7 +171,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
@Override
- public int getVisualID(VIDType type) throws NativeWindowException {
+ public int getVisualID(final VIDType type) throws NativeWindowException {
switch(type) {
case INTRINSIC:
case NATIVE:
@@ -189,7 +189,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
/** Sets the number of bits requested for the color buffer's red
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
- public void setRedBits(int redBits) {
+ public void setRedBits(final int redBits) {
this.redBits = redBits;
}
@@ -201,7 +201,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
/** Sets the number of bits requested for the color buffer's green
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
- public void setGreenBits(int greenBits) {
+ public void setGreenBits(final int greenBits) {
this.greenBits = greenBits;
}
@@ -213,7 +213,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
/** Sets the number of bits requested for the color buffer's blue
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
- public void setBlueBits(int blueBits) {
+ public void setBlueBits(final int blueBits) {
this.blueBits = blueBits;
}
@@ -234,7 +234,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* not to <i>reflect</i> a current state. Nevertheless if this is the case - call it at last.
* </p>
*/
- public void setAlphaBits(int alphaBits) {
+ public void setAlphaBits(final int alphaBits) {
this.alphaBits = alphaBits;
}
@@ -253,7 +253,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* due to the composite work required by the window manager.
* </p>
*/
- public void setBackgroundOpaque(boolean opaque) {
+ public void setBackgroundOpaque(final boolean opaque) {
backgroundOpaque = opaque;
if(!opaque && getAlphaBits()==0) {
setAlphaBits(1);
@@ -277,7 +277,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* </p>
* @param onscreen
*/
- public void setOnscreen(boolean onscreen) {
+ public void setOnscreen(final boolean onscreen) {
this.onscreen=onscreen;
}
@@ -298,7 +298,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* Requesting offscreen bitmap mode disables the offscreen auto selection.
* </p>
*/
- public void setBitmap(boolean enable) {
+ public void setBitmap(final boolean enable) {
if(enable) {
setOnscreen(false);
}
@@ -327,31 +327,31 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
This value is ignored if {@link #isBackgroundOpaque()} equals true.<br>
It defaults to half of the frambuffer value for red. <br>
A value of -1 is interpreted as any value. */
- public void setTransparentRedValue(int transValueRed) { transparentValueRed=transValueRed; }
+ public void setTransparentRedValue(final int transValueRed) { transparentValueRed=transValueRed; }
/** Sets the transparent green value for the frame buffer configuration,
ranging from 0 to the maximum frame buffer value for green.
This value is ignored if {@link #isBackgroundOpaque()} equals true.<br>
It defaults to half of the frambuffer value for green.<br>
A value of -1 is interpreted as any value. */
- public void setTransparentGreenValue(int transValueGreen) { transparentValueGreen=transValueGreen; }
+ public void setTransparentGreenValue(final int transValueGreen) { transparentValueGreen=transValueGreen; }
/** Sets the transparent blue value for the frame buffer configuration,
ranging from 0 to the maximum frame buffer value for blue.
This value is ignored if {@link #isBackgroundOpaque()} equals true.<br>
It defaults to half of the frambuffer value for blue.<br>
A value of -1 is interpreted as any value. */
- public void setTransparentBlueValue(int transValueBlue) { transparentValueBlue=transValueBlue; }
+ public void setTransparentBlueValue(final int transValueBlue) { transparentValueBlue=transValueBlue; }
/** Sets the transparent alpha value for the frame buffer configuration,
ranging from 0 to the maximum frame buffer value for alpha.
This value is ignored if {@link #isBackgroundOpaque()} equals true.<br>
It defaults to half of the frambuffer value for alpha.<br>
A value of -1 is interpreted as any value. */
- public void setTransparentAlphaValue(int transValueAlpha) { transparentValueAlpha=transValueAlpha; }
+ public void setTransparentAlphaValue(final int transValueAlpha) { transparentValueAlpha=transValueAlpha; }
@Override
- public StringBuilder toString(StringBuilder sink) {
+ public StringBuilder toString(final StringBuilder sink) {
return toString(sink, true);
}
@@ -359,7 +359,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
object. */
@Override
public String toString() {
- StringBuilder msg = new StringBuilder();
+ final StringBuilder msg = new StringBuilder();
msg.append("Caps[");
toString(msg);
msg.append("]");
@@ -393,7 +393,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
/** Component separator */
protected static final String CSEP = ", ";
- protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
+ protected StringBuilder toString(StringBuilder sink, final boolean withOnOffScreen) {
if(null == sink) {
sink = new StringBuilder();
}
@@ -410,5 +410,5 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
return sink;
}
- protected final String toHexString(int val) { return Integer.toHexString(val); }
+ protected final String toHexString(final int val) { return Integer.toHexString(val); }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 77cbe2995..d0c1a9b85 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -42,6 +42,8 @@ package javax.media.nativewindow;
import java.util.List;
+import com.jogamp.common.util.PropertyAccess;
+
import jogamp.nativewindow.Debug;
/** <P> The default implementation of the {@link
@@ -70,7 +72,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
static {
Debug.initSingleton();
- DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
+ DEBUG = PropertyAccess.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
}
private final static int NO_SCORE = -9999999;
@@ -100,7 +102,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
}
// Create score array
- int[] scores = new int[availnum];
+ final int[] scores = new int[availnum];
for (int i = 0; i < availnum; i++) {
scores[i] = NO_SCORE;
}
@@ -137,7 +139,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
- int score = scores[i];
+ final int score = scores[i];
if (score == NO_SCORE) {
continue;
}
@@ -161,7 +163,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
return chosenIndex;
}
- private static int sign(int score) {
+ private static int sign(final int score) {
if (score < 0) {
return -1;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 42d7f3a23..7912832c1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -41,8 +41,8 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
protected CapabilitiesImmutable capabilitiesChosen;
protected CapabilitiesImmutable capabilitiesRequested;
- public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
- CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
+ public DefaultGraphicsConfiguration(final AbstractGraphicsScreen screen,
+ final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested) {
if(null == screen) {
throw new IllegalArgumentException("Null screen");
}
@@ -64,7 +64,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new NativeWindowException(e);
}
}
@@ -90,7 +90,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
}
@Override
- final public int getVisualID(VIDType type) throws NativeWindowException {
+ final public int getVisualID(final VIDType type) throws NativeWindowException {
return capabilitiesChosen.getVisualID(type);
}
@@ -103,7 +103,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
* </p>
* @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
*/
- protected void setChosenCapabilities(CapabilitiesImmutable capsChosen) {
+ protected void setChosenCapabilities(final CapabilitiesImmutable capsChosen) {
this.capabilitiesChosen = capsChosen;
}
@@ -115,7 +115,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
* a change of the graphics device in a multi-screen environment.
* </p>
*/
- protected void setScreen(AbstractGraphicsScreen screen) {
+ protected void setScreen(final AbstractGraphicsScreen screen) {
this.screen = screen;
}
@@ -127,11 +127,11 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
"]";
}
- public static String toHexString(int val) {
+ public static String toHexString(final int val) {
return "0x"+Integer.toHexString(val);
}
- public static String toHexString(long val) {
+ public static String toHexString(final long val) {
return "0x"+Long.toHexString(val);
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index f733f91de..ab9286b3f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -82,7 +82,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new NativeWindowException(e);
}
}
@@ -178,7 +178,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* Set the native handle of the underlying native device
* and return the previous one.
*/
- protected final long setHandle(long newHandle) {
+ protected final long setHandle(final long newHandle) {
final long oldHandle = handle;
handle = newHandle;
return oldHandle;
@@ -187,7 +187,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
protected Object getHandleOwnership() {
return null;
}
- protected Object setHandleOwnership(Object newOwnership) {
+ protected Object setHandleOwnership(final Object newOwnership) {
return null;
}
@@ -222,7 +222,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used
* @return the previous ToolkitLock instance
*/
- protected ToolkitLock setToolkitLock(ToolkitLock locker) {
+ protected ToolkitLock setToolkitLock(final ToolkitLock locker) {
final ToolkitLock _toolkitLock = toolkitLock;
_toolkitLock.lock();
try {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 4bd548916..3ee775904 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -36,12 +36,12 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
private final AbstractGraphicsDevice device;
private final int idx;
- public DefaultGraphicsScreen(AbstractGraphicsDevice device, int idx) {
+ public DefaultGraphicsScreen(final AbstractGraphicsDevice device, final int idx) {
this.device = device;
this.idx = idx;
}
- public static AbstractGraphicsScreen createDefault(String type) {
+ public static AbstractGraphicsScreen createDefault(final String type) {
return new DefaultGraphicsScreen(new DefaultGraphicsDevice(type, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT), 0);
}
@@ -49,7 +49,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new NativeWindowException(e);
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index c09e6eaa4..3f8113baa 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -70,7 +70,7 @@ public abstract class GraphicsConfigurationFactory {
public final Class<?> capsType;
private final int hash32;
- public DeviceCapsType(Class<?> deviceType, Class<?> capsType) {
+ public DeviceCapsType(final Class<?> deviceType, final Class<?> capsType) {
this.deviceType = deviceType;
this.capsType = capsType;
@@ -86,10 +86,10 @@ public abstract class GraphicsConfigurationFactory {
}
@Override
- public final boolean equals(Object obj) {
+ public final boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof DeviceCapsType) {
- DeviceCapsType dct = (DeviceCapsType)obj;
+ final DeviceCapsType dct = (DeviceCapsType)obj;
return deviceType == dct.deviceType && capsType == dct.capsType;
}
return false;
@@ -135,14 +135,14 @@ public abstract class GraphicsConfigurationFactory {
try {
ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
"registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
if(NativeWindowFactory.isAWTAvailable()) {
try {
ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
"registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
- } catch (Exception e) { /* n/a */ }
+ } catch (final Exception e) { /* n/a */ }
}
}
}
@@ -162,11 +162,11 @@ public abstract class GraphicsConfigurationFactory {
return Thread.currentThread().getName();
}
- protected static String toHexString(int val) {
+ protected static String toHexString(final int val) {
return "0x" + Integer.toHexString(val);
}
- protected static String toHexString(long val) {
+ protected static String toHexString(final long val) {
return "0x" + Long.toHexString(val);
}
@@ -181,7 +181,7 @@ public abstract class GraphicsConfigurationFactory {
*
* @see #getFactory(Class, Class)
*/
- public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
+ public static GraphicsConfigurationFactory getFactory(final AbstractGraphicsDevice device, final CapabilitiesImmutable caps) {
if (device == null) {
throw new IllegalArgumentException("null device");
}
@@ -216,7 +216,7 @@ public abstract class GraphicsConfigurationFactory {
* @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
* capabilitiesType does not implement {@link CapabilitiesImmutable}
*/
- public static GraphicsConfigurationFactory getFactory(Class<?> deviceType, Class<?> capabilitiesType)
+ public static GraphicsConfigurationFactory getFactory(final Class<?> deviceType, final Class<?> capabilitiesType)
throws IllegalArgumentException, NativeWindowException
{
if (!(defaultDeviceCapsType.deviceType.isAssignableFrom(deviceType))) {
@@ -242,7 +242,7 @@ public abstract class GraphicsConfigurationFactory {
for(int j=0; j<deviceTypes.size(); j++) {
final Class<?> interfaceDevice = deviceTypes.get(j);
for(int i=0; i<capabilitiesTypes.size(); i++) {
- Class<?> interfaceCaps = capabilitiesTypes.get(i);
+ final Class<?> interfaceCaps = capabilitiesTypes.get(i);
final DeviceCapsType dct = new DeviceCapsType(interfaceDevice, interfaceCaps);
final GraphicsConfigurationFactory factory = registeredFactories.get(dct);
if (factory != null) {
@@ -260,7 +260,7 @@ public abstract class GraphicsConfigurationFactory {
}
return factory;
}
- private static ArrayList<Class<?>> getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly) {
+ private static ArrayList<Class<?>> getAllAssignableClassesFrom(final Class<?> superClassOrInterface, final Class<?> fromClass, final boolean interfacesOnly) {
// Using a todo list avoiding a recursive loop!
final ArrayList<Class<?>> inspectClasses = new ArrayList<Class<?>>();
final ArrayList<Class<?>> resolvedInterfaces = new ArrayList<Class<?>>();
@@ -271,7 +271,7 @@ public abstract class GraphicsConfigurationFactory {
}
return resolvedInterfaces;
}
- private static void getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly, List<Class<?>> resolvedInterfaces, List<Class<?>> inspectClasses) {
+ private static void getAllAssignableClassesFrom(final Class<?> superClassOrInterface, final Class<?> fromClass, final boolean interfacesOnly, final List<Class<?>> resolvedInterfaces, final List<Class<?>> inspectClasses) {
final ArrayList<Class<?>> types = new ArrayList<Class<?>>();
if( superClassOrInterface.isAssignableFrom(fromClass) && !resolvedInterfaces.contains(fromClass)) {
if( !interfacesOnly || fromClass.isInterface() ) {
@@ -295,10 +295,10 @@ public abstract class GraphicsConfigurationFactory {
}
}
private static void dumpFactories() {
- Set<DeviceCapsType> dcts = registeredFactories.keySet();
+ final Set<DeviceCapsType> dcts = registeredFactories.keySet();
int i=0;
- for(Iterator<DeviceCapsType> iter = dcts.iterator(); iter.hasNext(); ) {
- DeviceCapsType dct = iter.next();
+ for(final Iterator<DeviceCapsType> iter = dcts.iterator(); iter.hasNext(); ) {
+ final DeviceCapsType dct = iter.next();
System.err.println("Factory #"+i+": "+dct+" -> "+registeredFactories.get(dct));
i++;
}
@@ -323,7 +323,7 @@ public abstract class GraphicsConfigurationFactory {
* @return the previous registered factory, or null if none
* @throws IllegalArgumentException if the given class does not implement AbstractGraphicsDevice
*/
- protected static GraphicsConfigurationFactory registerFactory(Class<?> abstractGraphicsDeviceImplementor, Class<?> capabilitiesType, GraphicsConfigurationFactory factory)
+ protected static GraphicsConfigurationFactory registerFactory(final Class<?> abstractGraphicsDeviceImplementor, final Class<?> capabilitiesType, final GraphicsConfigurationFactory factory)
throws IllegalArgumentException
{
if (!(defaultDeviceCapsType.deviceType.isAssignableFrom(abstractGraphicsDeviceImplementor))) {
@@ -400,9 +400,9 @@ public abstract class GraphicsConfigurationFactory {
* @see javax.media.nativewindow.DefaultGraphicsConfiguration#setChosenCapabilities(Capabilities caps)
*/
public final AbstractGraphicsConfiguration
- chooseGraphicsConfiguration(CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
- CapabilitiesChooser chooser,
- AbstractGraphicsScreen screen, int nativeVisualID)
+ chooseGraphicsConfiguration(final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested,
+ final CapabilitiesChooser chooser,
+ final AbstractGraphicsScreen screen, final int nativeVisualID)
throws IllegalArgumentException, NativeWindowException {
if(null==capsChosen) {
throw new NativeWindowException("Chosen Capabilities are null");
@@ -413,7 +413,7 @@ public abstract class GraphicsConfigurationFactory {
if(null==screen) {
throw new NativeWindowException("Screen is null");
}
- AbstractGraphicsDevice device = screen.getDevice();
+ final AbstractGraphicsDevice device = screen.getDevice();
if(null==device) {
throw new NativeWindowException("Screen's Device is null");
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
index 0943c8c09..16355032f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
@@ -50,19 +50,19 @@ public class NativeWindowException extends RuntimeException {
/** Constructs a NativeWindowException object with the specified detail
message. */
- public NativeWindowException(String message) {
+ public NativeWindowException(final String message) {
super(message);
}
/** Constructs a NativeWindowException object with the specified detail
message and root cause. */
- public NativeWindowException(String message, Throwable cause) {
+ public NativeWindowException(final String message, final Throwable cause) {
super(message, cause);
}
/** Constructs a NativeWindowException object with the specified root
cause. */
- public NativeWindowException(Throwable cause) {
+ public NativeWindowException(final Throwable cause) {
super(cause);
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index edaed3a39..b2889fdcf 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -45,6 +45,7 @@ import java.util.Map;
import javax.media.nativewindow.util.PointImmutable;
+import jogamp.common.os.PlatformPropsImpl;
import jogamp.nativewindow.Debug;
import jogamp.nativewindow.NativeWindowFactoryImpl;
import jogamp.nativewindow.ToolkitProperties;
@@ -55,6 +56,7 @@ import jogamp.nativewindow.windows.GDIUtil;
import jogamp.nativewindow.x11.X11Lib;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
@@ -143,7 +145,7 @@ public abstract class NativeWindowFactory {
}
private static String _getNativeWindowingType() {
- switch(Platform.OS_TYPE) {
+ switch(PlatformPropsImpl.OS_TYPE) {
case ANDROID:
return TYPE_ANDROID;
case MACOS:
@@ -174,7 +176,7 @@ public abstract class NativeWindowFactory {
public Object run() {
Platform.initSingleton(); // last resort ..
_DEBUG[0] = Debug.debug("NativeWindow");
- _tmp[0] = Debug.getProperty("nativewindow.ws.name", true);
+ _tmp[0] = PropertyAccess.getProperty("nativewindow.ws.name", true);
Runtime.getRuntime().addShutdownHook(
new Thread(new Runnable() {
@Override
@@ -234,7 +236,7 @@ public abstract class NativeWindowFactory {
* @param head if true add runnable at the start, otherwise at the end
* @param runnable runnable to be added.
*/
- public static void addCustomShutdownHook(boolean head, Runnable runnable) {
+ public static void addCustomShutdownHook(final boolean head, final Runnable runnable) {
synchronized( customShutdownHooks ) {
if( !customShutdownHooks.contains( runnable ) ) {
if( head ) {
@@ -249,7 +251,7 @@ public abstract class NativeWindowFactory {
/**
* Cleanup resources at JVM shutdown
*/
- public static synchronized void shutdown(boolean _isJVMShuttingDown) {
+ public static synchronized void shutdown(final boolean _isJVMShuttingDown) {
isJVMShuttingDown = _isJVMShuttingDown;
if(DEBUG) {
System.err.println("NativeWindowFactory.shutdown() START: JVM Shutdown "+isJVMShuttingDown+", on thread "+Thread.currentThread().getName());
@@ -262,7 +264,7 @@ public abstract class NativeWindowFactory {
System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount);
}
customShutdownHooks.get(i).run();
- } catch(Throwable t) {
+ } catch(final Throwable t) {
System.err.println("NativeWindowFactory.shutdown: Caught "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount);
if( DEBUG ) {
t.printStackTrace();
@@ -329,19 +331,19 @@ public abstract class NativeWindowFactory {
if( Platform.AWT_AVAILABLE &&
ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) {
- Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ final Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
try {
- Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader());
- Method jawtUtilIsHeadlessMethod = _jawtUtilClass.getDeclaredMethod("isHeadlessMode", (Class[])null);
+ final Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader());
+ final Method jawtUtilIsHeadlessMethod = _jawtUtilClass.getDeclaredMethod("isHeadlessMode", (Class[])null);
jawtUtilIsHeadlessMethod.setAccessible(true);
- Method jawtUtilInitMethod = _jawtUtilClass.getDeclaredMethod("initSingleton", (Class[])null);
+ final Method jawtUtilInitMethod = _jawtUtilClass.getDeclaredMethod("initSingleton", (Class[])null);
jawtUtilInitMethod.setAccessible(true);
- Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{});
+ final Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{});
jawtUtilGetJAWTToolkitLockMethod.setAccessible(true);
return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
- } catch (Exception e) {
+ } catch (final Exception e) {
if(DEBUG) {
e.printStackTrace();
}
@@ -382,7 +384,7 @@ public abstract class NativeWindowFactory {
registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>());
// register our default factory -> NativeWindow
- NativeWindowFactory factory = new NativeWindowFactoryImpl();
+ final NativeWindowFactory factory = new NativeWindowFactoryImpl();
nativeWindowClass = javax.media.nativewindow.NativeWindow.class;
registerFactory(nativeWindowClass, factory);
defaultFactory = factory;
@@ -414,7 +416,7 @@ public abstract class NativeWindowFactory {
* @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
* Hence {@link String#equals(Object)} and <code>==</code> produce the same result.
*/
- public static String getNativeWindowType(boolean useCustom) {
+ public static String getNativeWindowType(final boolean useCustom) {
return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure;
}
@@ -431,7 +433,7 @@ public abstract class NativeWindowFactory {
} */
/** Sets the default NativeWindowFactory. */
- public static void setDefaultFactory(NativeWindowFactory factory) {
+ public static void setDefaultFactory(final NativeWindowFactory factory) {
defaultFactory = factory;
}
@@ -472,7 +474,7 @@ public abstract class NativeWindowFactory {
* <li> {@link jogamp.nativewindow.NullToolkitLock} </li>
* </ul>
*/
- public static ToolkitLock getDefaultToolkitLock(String type) {
+ public static ToolkitLock getDefaultToolkitLock(final String type) {
if( requiresToolkitLock ) {
if( TYPE_AWT == type && isAWTAvailable() ) {
return getAWTToolkitLock();
@@ -490,7 +492,7 @@ public abstract class NativeWindowFactory {
* <li> {@link jogamp.nativewindow.NullToolkitLock} </li>
* </ul>
*/
- public static ToolkitLock getDefaultToolkitLock(String type, long deviceHandle) {
+ public static ToolkitLock getDefaultToolkitLock(final String type, final long deviceHandle) {
if( requiresToolkitLock ) {
if( TYPE_AWT == type && isAWTAvailable() ) {
return getAWTToolkitLock();
@@ -505,7 +507,7 @@ public abstract class NativeWindowFactory {
* @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
* @return newly created AbstractGraphicsScreen matching device's native type
*/
- public static AbstractGraphicsScreen createScreen(AbstractGraphicsDevice device, int screen) {
+ public static AbstractGraphicsScreen createScreen(final AbstractGraphicsDevice device, int screen) {
final String type = device.getType();
if( TYPE_X11 == type ) {
final X11GraphicsDevice x11Device = (X11GraphicsDevice)device;
@@ -530,13 +532,13 @@ public abstract class NativeWindowFactory {
already assumed the responsibility of creating a compatible
NativeWindow implementation, or it might be that of a toolkit
class like {@link java.awt.Component Component}. */
- public static NativeWindowFactory getFactory(Class<?> windowClass) throws IllegalArgumentException {
+ public static NativeWindowFactory getFactory(final Class<?> windowClass) throws IllegalArgumentException {
if (nativeWindowClass.isAssignableFrom(windowClass)) {
return registeredFactories.get(nativeWindowClass);
}
Class<?> clazz = windowClass;
while (clazz != null) {
- NativeWindowFactory factory = registeredFactories.get(clazz);
+ final NativeWindowFactory factory = registeredFactories.get(clazz);
if (factory != null) {
return factory;
}
@@ -548,7 +550,7 @@ public abstract class NativeWindowFactory {
/** Registers a NativeWindowFactory handling window objects of the
given class. This does not need to be called by end users,
only implementors of new NativeWindowFactory subclasses. */
- protected static void registerFactory(Class<?> windowClass, NativeWindowFactory factory) {
+ protected static void registerFactory(final Class<?> windowClass, final NativeWindowFactory factory) {
if(DEBUG) {
System.err.println("NativeWindowFactory.registerFactory() "+windowClass+" -> "+factory);
}
@@ -574,7 +576,7 @@ public abstract class NativeWindowFactory {
@see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
*/
- public static NativeWindow getNativeWindow(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException {
+ public static NativeWindow getNativeWindow(final Object winObj, final AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException {
if (winObj == null) {
throw new IllegalArgumentException("Null window object");
}
@@ -600,7 +602,7 @@ public abstract class NativeWindowFactory {
* @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
* @return
*/
- public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) {
+ public static OffscreenLayerSurface getOffscreenLayerSurface(final NativeSurface surface, final boolean ifEnabled) {
if(surface instanceof OffscreenLayerSurface &&
( !ifEnabled || surface instanceof OffscreenLayerOption ) ) {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface;
@@ -631,7 +633,7 @@ public abstract class NativeWindowFactory {
* at creation time (see above), it is not valid for further processing.
* </p>
*/
- public static boolean isNativeVisualIDValidForProcessing(int visualID) {
+ public static boolean isNativeVisualIDValidForProcessing(final int visualID) {
return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
VisualIDHolder.VID_UNDEFINED != visualID ;
}
@@ -642,7 +644,7 @@ public abstract class NativeWindowFactory {
* The device will be opened if <code>own</code> is true, otherwise no native handle will ever be acquired.
* </p>
*/
- public static AbstractGraphicsDevice createDevice(String displayConnection, boolean own) {
+ public static AbstractGraphicsDevice createDevice(final String displayConnection, final boolean own) {
final String nwt = NativeWindowFactory.getNativeWindowType(true);
if( NativeWindowFactory.TYPE_X11 == nwt ) {
if( own ) {
@@ -679,8 +681,8 @@ public abstract class NativeWindowFactory {
* or a simple <i>dummy</i> instance, see {@link #createDevice(String, boolean)}.
* </p>
*/
- public static NativeWindow createWrappedWindow(AbstractGraphicsScreen aScreen, long surfaceHandle, long windowHandle,
- UpstreamWindowHookMutableSizePos hook) {
+ public static NativeWindow createWrappedWindow(final AbstractGraphicsScreen aScreen, final long surfaceHandle, final long windowHandle,
+ final UpstreamWindowHookMutableSizePos hook) {
final CapabilitiesImmutable caps = new Capabilities();
final AbstractGraphicsConfiguration config = new DefaultGraphicsConfiguration(aScreen, caps, caps);
return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle);
@@ -690,7 +692,7 @@ public abstract class NativeWindowFactory {
* @param nw
* @return top-left client-area position in window units
*/
- public static PointImmutable getLocationOnScreen(NativeWindow nw) {
+ public static PointImmutable getLocationOnScreen(final NativeWindow nw) {
final String nwt = NativeWindowFactory.getNativeWindowType(true);
if( NativeWindowFactory.TYPE_X11 == nwt ) {
return X11Lib.GetRelativeLocation(nw.getDisplayHandle(), nw.getScreenIndex(), nw.getWindowHandle(), 0, 0, 0);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
index 4ed79b1dc..e337166d4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
@@ -51,7 +51,7 @@ public interface VisualIDHolder {
public final int id;
- VIDType(int id){
+ VIDType(final int id){
this.id = id;
}
}
@@ -114,14 +114,14 @@ public interface VisualIDHolder {
/** Comparing {@link VIDType#NATIVE} */
public static class VIDComparator implements Comparator<VisualIDHolder> {
- private VIDType type;
+ private final VIDType type;
- public VIDComparator(VIDType type) {
+ public VIDComparator(final VIDType type) {
this.type = type;
}
@Override
- public int compare(VisualIDHolder vid1, VisualIDHolder vid2) {
+ public int compare(final VisualIDHolder vid1, final VisualIDHolder vid2) {
final int id1 = vid1.getVisualID(type);
final int id2 = vid2.getVisualID(type);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
index 5c9dc279d..4c9672c26 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
@@ -58,7 +58,7 @@ public class Dimension implements Cloneable, DimensionImmutable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
@@ -68,22 +68,22 @@ public class Dimension implements Cloneable, DimensionImmutable {
@Override
public final int getHeight() { return height; }
- public final void set(int width, int height) {
+ public final void set(final int width, final int height) {
this.width = width;
this.height = height;
}
- public final void setWidth(int width) {
+ public final void setWidth(final int width) {
this.width = width;
}
- public final void setHeight(int height) {
+ public final void setHeight(final int height) {
this.height = height;
}
- public final Dimension scale(int s) {
+ public final Dimension scale(final int s) {
width *= s;
height *= s;
return this;
}
- public final Dimension add(Dimension pd) {
+ public final Dimension add(final Dimension pd) {
width += pd.width ;
height += pd.height ;
return this;
@@ -108,10 +108,10 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof Dimension) {
- Dimension p = (Dimension)obj;
+ final Dimension p = (Dimension)obj;
return height == p.height &&
width == p.width ;
}
@@ -121,7 +121,7 @@ public class Dimension implements Cloneable, DimensionImmutable {
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
- int hash = 31 + width;
+ final int hash = 31 + width;
return ((hash << 5) - hash) + height;
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index dfe78b06f..5ec4c758f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -42,7 +42,7 @@ public class Insets implements Cloneable, InsetsImmutable {
this(0, 0, 0, 0);
}
- public Insets(int left, int right, int top, int bottom) {
+ public Insets(final int left, final int right, final int top, final int bottom) {
this.l=left;
this.r=right;
this.t=top;
@@ -58,7 +58,7 @@ public class Insets implements Cloneable, InsetsImmutable {
protected Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
@@ -83,35 +83,35 @@ public class Insets implements Cloneable, InsetsImmutable {
* @param top top inset width in window units.
* @param bottom bottom inset width in window units.
*/
- public final void set(int left, int right, int top, int bottom) {
+ public final void set(final int left, final int right, final int top, final int bottom) {
l = left; r = right; t = top; b = bottom;
}
/**
* Set the left inset value of this instance in window units.
* @param left left inset width in window units.
*/
- public final void setLeftWidth(int left) { l = left; }
+ public final void setLeftWidth(final int left) { l = left; }
/**
* Set the right inset value of this instance in window units.
* @param right right inset width in window units.
*/
- public final void setRightWidth(int right) { r = right; }
+ public final void setRightWidth(final int right) { r = right; }
/**
* Set the top inset value of this instance in window units.
* @param top top inset width in window units.
*/
- public final void setTopHeight(int top) { t = top; }
+ public final void setTopHeight(final int top) { t = top; }
/**
* Set the bottom inset value of this instance in window units.
* @param bottom bottom inset width in window units.
*/
- public final void setBottomHeight(int bottom) { b = bottom; }
+ public final void setBottomHeight(final int bottom) { b = bottom; }
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof Insets) {
- Insets insets = (Insets)obj;
+ final Insets insets = (Insets)obj;
return (r == insets.r) && (l == insets.l) &&
(b == insets.b) && (t == insets.t);
}
@@ -120,11 +120,11 @@ public class Insets implements Cloneable, InsetsImmutable {
@Override
public int hashCode() {
- int sum1 = l + b;
- int sum2 = t + r;
- int val1 = sum1 * (sum1 + 1)/2 + l;
- int val2 = sum2 * (sum2 + 1)/2 + r;
- int sum3 = val1 + val2;
+ final int sum1 = l + b;
+ final int sum2 = t + r;
+ final int val1 = sum1 * (sum1 + 1)/2 + l;
+ final int val2 = sum2 * (sum2 + 1)/2 + r;
+ final int sum3 = val1 + val2;
return sum3 * (sum3 + 1)/2 + val2;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java
index 823496a92..fd3c31f7f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java
@@ -189,7 +189,7 @@ public enum PixelFormat {
/** Number of bytes per pixel, e.g. 4 for RGBA. */
public final int bytesPerPixel() { return (7+bitsPerPixel)/8; }
- private PixelFormat(int componentCount, int bpp) {
+ private PixelFormat(final int componentCount, final int bpp) {
this.componentCount = componentCount;
this.bitsPerPixel = bpp;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java
index 87a9ca4fc..21bfa8a54 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java
@@ -85,7 +85,7 @@ public class PixelFormatUtil {
* Returns the {@link PixelFormat} with reversed components of <code>fmt</code>.
* If no reversed {@link PixelFormat} is available, returns <code>fmt</code>.
*/
- public static PixelFormat getReversed(PixelFormat fmt) {
+ public static PixelFormat getReversed(final PixelFormat fmt) {
switch(fmt) {
case LUMINANCE:
return PixelFormat.LUMINANCE;
@@ -106,7 +106,7 @@ public class PixelFormatUtil {
}
}
- public static int getValue32(PixelFormat src_fmt, ByteBuffer src, int srcOff) {
+ public static int getValue32(final PixelFormat src_fmt, final ByteBuffer src, int srcOff) {
switch(src_fmt) {
case LUMINANCE: {
final byte c1 = src.get(srcOff++);
@@ -134,7 +134,7 @@ public class PixelFormatUtil {
}
}
- public static int convertToInt32(PixelFormat dest_fmt, final byte r, final byte g, final byte b, final byte a) {
+ public static int convertToInt32(final PixelFormat dest_fmt, final byte r, final byte g, final byte b, final byte a) {
switch(dest_fmt) {
case LUMINANCE: {
final byte l = ( byte) ( ( ( ( 0xff & r ) + ( 0xff & g ) + ( 0xff & b ) ) / 3 ) );
@@ -157,7 +157,7 @@ public class PixelFormatUtil {
}
}
- public static int convertToInt32(PixelFormat dest_fmt, PixelFormat src_fmt, ByteBuffer src, int srcOff) {
+ public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final ByteBuffer src, int srcOff) {
final byte r, g, b, a;
switch(src_fmt) {
case LUMINANCE:
@@ -208,7 +208,7 @@ public class PixelFormatUtil {
return convertToInt32(dest_fmt, r, g, b, a);
}
- public static int convertToInt32(PixelFormat dest_fmt, PixelFormat src_fmt, final int src_pixel) {
+ public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final int src_pixel) {
final byte r, g, b, a;
switch(src_fmt) {
case LUMINANCE:
@@ -260,7 +260,7 @@ public class PixelFormatUtil {
}
public static PixelRectangle convert32(final PixelRectangle src,
- final PixelFormat destFmt, int ddestStride, final boolean isGLOriented,
+ final PixelFormat destFmt, final int ddestStride, final boolean isGLOriented,
final boolean destIsDirect) {
final int width = src.getSize().getWidth();
final int height = src.getSize().getHeight();
@@ -281,7 +281,7 @@ public class PixelFormatUtil {
// System.err.println("XXX: DEST fmt "+destFmt+", stride "+destStride+" ("+ddestStride+"), isGL "+isGLOriented+", "+width+"x"+height+", capacity "+capacity+", "+bb);
final PixelFormatUtil.PixelSink32 imgSink = new PixelFormatUtil.PixelSink32() {
- public void store(int x, int y, int pixel) {
+ public void store(final int x, final int y, final int pixel) {
int o = destStride*y+x*bpp;
bb.put(o++, (byte) ( pixel )); // 1
if( 3 <= bpp ) {
@@ -309,7 +309,7 @@ public class PixelFormatUtil {
return new PixelRectangle.GenericPixelRect(destFmt, src.getSize(), destStride, isGLOriented, bb);
}
- public static void convert32(PixelSink32 destInt32, final PixelRectangle src) {
+ public static void convert32(final PixelSink32 destInt32, final PixelRectangle src) {
convert32(destInt32,
src.getPixels(), src.getPixelformat(),
src.isGLOriented(),
@@ -333,7 +333,7 @@ public class PixelFormatUtil {
* Must be >= {@link PixelFormat#bytesPerPixel() src_fmt.bytesPerPixel()} * width.
* @throws IllegalArgumentException if <code>strideInBytes</code> is invalid
*/
- public static void convert32(PixelSink32 dest32,
+ public static void convert32(final PixelSink32 dest32,
final ByteBuffer src_bb, final PixelFormat src_fmt, final boolean src_glOriented, final int width, final int height, int stride_bytes) {
final int src_bpp = src_fmt.bytesPerPixel();
if( 0 != stride_bytes ) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index e544118d0..3576a7dd0 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -33,7 +33,7 @@ public class Point implements Cloneable, PointImmutable {
int x;
int y;
- public Point(int x, int y) {
+ public Point(final int x, final int y) {
this.x=x;
this.y=y;
}
@@ -51,7 +51,7 @@ public class Point implements Cloneable, PointImmutable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
@@ -70,10 +70,10 @@ public class Point implements Cloneable, PointImmutable {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof Point) {
- Point p = (Point)obj;
+ final Point p = (Point)obj;
return y == p.y && x == p.x;
}
return false;
@@ -102,9 +102,9 @@ public class Point implements Cloneable, PointImmutable {
return x + " / " + y;
}
- public final void set(int x, int y) { this.x = x; this.y = y; }
- public final void setX(int x) { this.x = x; }
- public final void setY(int y) { this.y = y; }
+ public final void set(final int x, final int y) { this.x = x; this.y = y; }
+ public final void setX(final int x) { this.x = x; }
+ public final void setY(final int y) { this.y = y; }
/**
* Translate this instance's x- and y-components,
@@ -112,7 +112,7 @@ public class Point implements Cloneable, PointImmutable {
* @param pd delta point
* @return this instance for scaling
*/
- public final Point translate(Point pd) {
+ public final Point translate(final Point pd) {
x += pd.x ;
y += pd.y ;
return this;
@@ -125,7 +125,7 @@ public class Point implements Cloneable, PointImmutable {
* @param dy delta for y
* @return this instance for scaling
*/
- public final Point translate(int dx, int dy) {
+ public final Point translate(final int dx, final int dy) {
x += dx ;
y += dy ;
return this;
@@ -138,7 +138,7 @@ public class Point implements Cloneable, PointImmutable {
* @param sy scale factor for y
* @return this instance for scaling
*/
- public final Point scale(int sx, int sy) {
+ public final Point scale(final int sx, final int sy) {
x *= sx ;
y *= sy ;
return this;
@@ -151,7 +151,7 @@ public class Point implements Cloneable, PointImmutable {
* @param sy inverse scale factor for y
* @return this instance for scaling
*/
- public final Point scaleInv(int sx, int sy) {
+ public final Point scaleInv(final int sx, final int sy) {
x /= sx ;
y /= sy ;
return this;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
index 57535c26e..acc7b722d 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
@@ -56,7 +56,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
protected Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
@@ -154,7 +154,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
* @param sy scale factor for y
* @return this instance for scaling
*/
- public final Rectangle scale(int sx, int sy) {
+ public final Rectangle scale(final int sx, final int sy) {
x *= sx ;
y *= sy ;
width *= sx ;
@@ -169,7 +169,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
* @param sy inverse scale factor for y
* @return this instance for scaling
*/
- public final Rectangle scaleInv(int sx, int sy) {
+ public final Rectangle scaleInv(final int sx, final int sy) {
x /= sx ;
y /= sy ;
width /= sx ;
@@ -203,10 +203,10 @@ public class Rectangle implements Cloneable, RectangleImmutable {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof Rectangle) {
- Rectangle rect = (Rectangle)obj;
+ final Rectangle rect = (Rectangle)obj;
return (y == rect.y) && (x == rect.x) &&
(height == rect.height) && (width == rect.width);
}
@@ -215,11 +215,11 @@ public class Rectangle implements Cloneable, RectangleImmutable {
@Override
public int hashCode() {
- int sum1 = x + height;
- int sum2 = width + y;
- int val1 = sum1 * (sum1 + 1)/2 + x;
- int val2 = sum2 * (sum2 + 1)/2 + y;
- int sum3 = val1 + val2;
+ final int sum1 = x + height;
+ final int sum2 = width + y;
+ final int val1 = sum1 * (sum1 + 1)/2 + x;
+ final int val2 = sum2 * (sum2 + 1)/2 + y;
+ final int sum3 = val1 + val2;
return sum3 * (sum3 + 1)/2 + val2;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
index 6b4d2f19c..601e6dd71 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
@@ -40,7 +40,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
final DimensionImmutable resolution;
final int bitsPerPixel;
- public SurfaceSize(DimensionImmutable resolution, int bitsPerPixel) {
+ public SurfaceSize(final DimensionImmutable resolution, final int bitsPerPixel) {
if(null==resolution || bitsPerPixel<=0) {
throw new IllegalArgumentException("resolution must be set and bitsPerPixel greater 0");
}
@@ -92,10 +92,10 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
* otherwise <code>false</code>.
*/
@Override
- public final boolean equals(Object obj) {
+ public final boolean equals(final Object obj) {
if(this == obj) { return true; }
if (obj instanceof SurfaceSize) {
- SurfaceSize p = (SurfaceSize)obj;
+ final SurfaceSize p = (SurfaceSize)obj;
return getResolution().equals(p.getResolution()) &&
getBitsPerPixel() == p.getBitsPerPixel();
}