summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax/media
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow/classes/javax/media')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java46
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/Capabilities.java46
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java25
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java22
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java34
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java14
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java86
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java40
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java14
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java138
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java22
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java61
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java14
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java18
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java37
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java20
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Insets.java21
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Point.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java31
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java21
32 files changed, 439 insertions, 402 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index 4e45113d4..48f72e574 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -44,7 +44,7 @@ package javax.media.nativewindow;
pixel format in a toolkit-independent manner. */
public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable {
public Object clone();
-
+
/**
* Return the screen this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index ed305d49e..31b64269f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -47,7 +47,7 @@ import jogamp.nativewindow.Debug;
*/
public interface AbstractGraphicsDevice extends Cloneable {
public static final boolean DEBUG = Debug.debug("GraphicsDevice");
-
+
/** Dummy connection value for a default connection where no native support for multiple devices is available */
public static String DEFAULT_CONNECTION = "decon";
@@ -58,7 +58,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
public static int DEFAULT_UNIT = 0;
public Object clone();
-
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -96,7 +96,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The unique ID may be used as a key for semantic device mapping.
* </p>
* <p>
- * The returned string object reference is unique using {@link String#intern()}
+ * The returned string object reference is unique using {@link String#intern()}
* and hence can be used as a key itself.
* </p>
*/
@@ -114,29 +114,29 @@ public interface AbstractGraphicsDevice extends Cloneable {
*/
public void lock();
- /**
+ /**
* Optionally unlocking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#unlock()}.
* The lock implementation must be recursive.
- *
+ *
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Optionally [re]opening the device if handle is <code>null</code>.
* <p>
* The default implementation is a <code>NOP</code>.
* </p>
* <p>
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native open operation in case handle is <code>null</code>.
- * </p>
+ * </p>
*
* @return true if the handle was <code>null</code> and opening was successful, otherwise false.
*/
@@ -148,19 +148,19 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The default implementation {@link ToolkitLock#dispose() dispose} it's {@link ToolkitLock} and sets the handle to <code>null</code>.
* </p>
* <p>
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native close operation or skip it depending on the {@link #isHandleOwner() handles's ownership}.
- * </p>
+ * </p>
*
* @return true if the handle was not <code>null</code> and closing was successful, otherwise false.
*/
public boolean close();
-
+
/**
* @return <code>true</code> if instance owns the handle to issue {@link #close()}, otherwise <code>false</code>.
*/
public boolean isHandleOwner();
-
+
public void clearHandleOwner();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
index acb98073b..da8f12f3e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -45,7 +45,7 @@ package javax.media.nativewindow;
public interface AbstractGraphicsScreen extends Cloneable {
public Object clone();
-
+
/**
* Return the device this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index f2a8e2394..9eed887b5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -61,7 +61,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
// Switch for on- or offscreen
private boolean onscreen = true;
-
+
// offscreen bitmap mode
private boolean isBitmap = false;
@@ -74,7 +74,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public Object cloneMutable() {
return clone();
}
-
+
@Override
public Object clone() {
try {
@@ -85,7 +85,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
/**
- * Copies all {@link Capabilities} values
+ * Copies all {@link Capabilities} values
* from <code>source</code> into this instance.
* @return this instance
*/
@@ -103,7 +103,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
transparentValueAlpha = other.getTransparentAlphaValue();
return this;
}
-
+
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
@@ -150,15 +150,15 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
**/
@Override
public int compareTo(final CapabilitiesImmutable caps) {
- /**
+ /**
if ( ! ( o instanceof CapabilitiesImmutable ) ) {
Class<?> c = (null != o) ? o.getClass() : null ;
throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c);
}
final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */
-
+
final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 );
-
+
final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * ( caps.getAlphaBits() + 1 );
if(rgba > xrgba) {
@@ -222,17 +222,17 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
return alphaBits;
}
- /**
+ /**
* Sets the number of bits requested for the color buffer's alpha
* component. On some systems only the color depth, which is the
* sum of the red, green, and blue bits, is considered.
* <p>
- * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code>
+ * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code>
* by {@link #setBackgroundOpaque(boolean)} and it's OpenGL specialization <code>GLCapabilities::setSampleBuffers(boolean)</code>.<br/>
* Ensure to call this method after the above to ensure a <code>zero</code> value.</br>
* The above automated settings takes into account, that the user calls this method to <i>request</i> alpha bits,
* not to <i>reflect</i> a current state. Nevertheless if this is the case - call it at last.
- * </p>
+ * </p>
*/
public void setAlphaBits(int alphaBits) {
this.alphaBits = alphaBits;
@@ -271,7 +271,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* Defaults to true.
* </p>
* <p>
- * If requesting an offscreen surface without further selection of it's mode,
+ * If requesting an offscreen surface without further selection of it's mode,
* e.g. FBO, Pbuffer or {@link #setBitmap(boolean) bitmap},
* the implementation will choose the best available offscreen mode.
* </p>
@@ -304,12 +304,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
isBitmap = enable;
}
-
+
@Override
public boolean isBitmap() {
- return isBitmap;
+ return isBitmap;
}
-
+
@Override
public final int getTransparentRedValue() { return transparentValueRed; }
@@ -354,7 +354,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public StringBuilder toString(StringBuilder sink) {
return toString(sink, true);
}
-
+
/** Returns a textual representation of this Capabilities
object. */
@Override
@@ -365,7 +365,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
msg.append("]");
return msg.toString();
}
-
+
/** Return a textual representation of this object's on/off screen state. Use the given StringBuilder [optional]. */
protected StringBuilder onoffScreenToString(StringBuilder sink) {
if(null == sink) {
@@ -381,19 +381,19 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
} else if(onscreen) {
sink.append("."); // no additional off-screen modes besides on-screen
} else {
- sink.append("auto-cfg"); // auto-config off-screen mode
+ sink.append("auto-cfg"); // auto-config off-screen mode
}
- sink.append("]");
-
+ sink.append("]");
+
return sink;
}
-
+
/** Element separator */
protected static final String ESEP = "/";
/** Component separator */
protected static final String CSEP = ", ";
-
- protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
+
+ protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
if(null == sink) {
sink = new StringBuilder();
}
@@ -409,6 +409,6 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
return sink;
}
-
+
protected final String toHexString(int val) { return Integer.toHexString(val); }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
index e1fdf4938..1f4db7997 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -58,7 +58,7 @@ public interface CapabilitiesChooser {
not necessarily required, that the chooser select that entry.
<P> <em>Note:</em> this method is called automatically by the
- {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
+ {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
when an instance of this class is passed in to it.
It should generally not be
invoked by users directly, unless it is desired to delegate the
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
index 85659f286..c496a1535 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -70,12 +70,12 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Returns whether an opaque or translucent surface is requested, supported or chosen.
* <p>
* Default is true, i.e. opaque.
- * </p>
+ * </p>
*/
boolean isBackgroundOpaque();
/**
- * Returns whether an on- or offscreen surface is requested, available or chosen.
+ * Returns whether an on- or offscreen surface is requested, available or chosen.
* <p>
* Default is true, i.e. onscreen.
* </p>
@@ -83,7 +83,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Mind that an capabilities intance w/ <i>available</i> semantics
* may show onscreen, but also the offscreen modes FBO, Pbuffer or {@link #setBitmap(boolean) bitmap}.
* This is valid, since one native configuration maybe used for either functionality.
- * </p>
+ * </p>
*/
boolean isOnscreen();
@@ -97,7 +97,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* </p>
*/
boolean isBitmap();
-
+
/**
* Gets the transparent red value for the frame buffer configuration. This
* value is undefined if; equals true.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 4f07bca9b..77cbe2995 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -66,16 +66,17 @@ import jogamp.nativewindow.Debug;
*/
public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
- private static final boolean DEBUG;
+ private static final boolean DEBUG;
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
}
-
+
private final static int NO_SCORE = -9999999;
private final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
-
+
+ @Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List<? extends CapabilitiesImmutable> available,
final int windowSystemRecommendedChoice) {
@@ -112,7 +113,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
if (desired.isOnscreen() && !cur.isOnscreen()) {
continue; // requested onscreen, but n/a
}
-
+
int score = 0;
// Compute difference in color depth
score += (COLOR_MISMATCH_PENALTY_SCALE *
@@ -132,7 +133,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
System.err.println(" ]");
}
- // Ready to select. Choose score closest to 0.
+ // Ready to select. Choose score closest to 0.
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 6b23172e1..42d7f3a23 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -36,12 +36,12 @@ import jogamp.nativewindow.Debug;
public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphicsConfiguration {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
-
+
private AbstractGraphicsScreen screen;
protected CapabilitiesImmutable capabilitiesChosen;
protected CapabilitiesImmutable capabilitiesRequested;
- public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
+ public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
if(null == screen) {
throw new IllegalArgumentException("Null screen");
@@ -69,18 +69,22 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
}
}
+ @Override
final public AbstractGraphicsScreen getScreen() {
return screen;
}
+ @Override
final public CapabilitiesImmutable getChosenCapabilities() {
return capabilitiesChosen;
}
+ @Override
final public CapabilitiesImmutable getRequestedCapabilities() {
return capabilitiesRequested;
}
+ @Override
public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() {
return this;
}
@@ -89,7 +93,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
final public int getVisualID(VIDType type) throws NativeWindowException {
return capabilitiesChosen.getVisualID(type);
}
-
+
/**
* Set the capabilities to a new value.
*
@@ -119,7 +123,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public String toString() {
return getClass().getSimpleName()+"[" + screen +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
"]";
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 0bf5c2937..d74954a0d 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -140,8 +140,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void validateLocked() throws RuntimeException {
toolkitLock.validateLocked();
}
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Locking is perfomed via delegation to {@link ToolkitLock#lock()}, {@link ToolkitLock#unlock()}.
@@ -154,7 +154,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void unlock() {
toolkitLock.unlock();
}
-
+
@Override
public boolean open() {
return false;
@@ -174,11 +174,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public boolean isHandleOwner() {
return false;
}
-
+
@Override
- public void clearHandleOwner() {
+ public void clearHandleOwner() {
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]";
@@ -193,14 +193,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
handle = newHandle;
return oldHandle;
}
-
+
protected Object getHandleOwnership() {
return null;
}
protected Object setHandleOwnership(Object newOwnership) {
return null;
}
-
+
public static final void swapDeviceHandleAndOwnership(final DefaultGraphicsDevice aDevice1, final DefaultGraphicsDevice aDevice2) {
aDevice1.lock();
try {
@@ -219,7 +219,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
aDevice1.unlock();
}
}
-
+
/**
* Set the internal ToolkitLock, which is used within the
* {@link #lock()} and {@link #unlock()} implementation.
@@ -228,7 +228,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* The current ToolkitLock is being locked/unlocked while swapping the reference,
* ensuring no concurrent access can occur during the swap.
* </p>
- *
+ *
* @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used
* @return the previous ToolkitLock instance
*/
@@ -253,8 +253,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return toolkitLock;
}
- /**
- * Returns a unique String object using {@link String#intern()} for the given arguments,
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
* which object reference itself can be used as a key.
*/
protected static String getUniqueID(String type, String connection, int unitID) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 9fa58c7a3..4bd548916 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -54,10 +54,12 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
}
}
+ @Override
public AbstractGraphicsDevice getDevice() {
return device;
}
-
+
+ @Override
public int getIndex() {
return idx;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index 9694f2491..c09e6eaa4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -48,7 +48,7 @@ import java.util.Set;
/**
* Provides the mechanism by which the graphics configuration for a
- * window can be chosen before the window is created. The graphics
+ * window can be chosen before the window is created. The graphics
* configuration decides parameters related to hardware accelerated rendering such
* as the OpenGL pixel format. <br>
* On some window systems (EGL/OpenKODE and X11 in particular) it is necessary to
@@ -69,21 +69,23 @@ public abstract class GraphicsConfigurationFactory {
public final Class<?> deviceType;
public final Class<?> capsType;
private final int hash32;
-
+
public DeviceCapsType(Class<?> deviceType, Class<?> capsType) {
this.deviceType = deviceType;
this.capsType = capsType;
-
+
// 31 * x == (x << 5) - x
int hash32 = 31 + deviceType.hashCode();
hash32 = ((hash32 << 5) - hash32) + capsType.hashCode();
this.hash32 = hash32;
}
-
+
+ @Override
public final int hashCode() {
return hash32;
}
-
+
+ @Override
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof DeviceCapsType) {
@@ -92,18 +94,18 @@ public abstract class GraphicsConfigurationFactory {
}
return false;
}
-
+
@Override
public final String toString() {
return "DeviceCapsType["+deviceType.getName()+", "+capsType.getName()+"]";
}
-
+
}
-
+
private static final Map<DeviceCapsType, GraphicsConfigurationFactory> registeredFactories;
- private static final DeviceCapsType defaultDeviceCapsType;
+ private static final DeviceCapsType defaultDeviceCapsType;
static boolean initialized = false;
-
+
static {
DEBUG = Debug.debug("GraphicsConfiguration");
if(DEBUG) {
@@ -113,7 +115,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories = Collections.synchronizedMap(new HashMap<DeviceCapsType, GraphicsConfigurationFactory>());
defaultDeviceCapsType = new DeviceCapsType(AbstractGraphicsDevice.class, CapabilitiesImmutable.class);
}
-
+
public static synchronized void initSingleton() {
if(!initialized) {
initialized = true;
@@ -121,31 +123,31 @@ public abstract class GraphicsConfigurationFactory {
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - GraphicsConfigurationFactory.initSingleton()");
}
-
+
// Register the default no-op factory for arbitrary
// AbstractGraphicsDevice implementations, including
// AWTGraphicsDevice instances -- the OpenGL binding will take
// care of handling AWTGraphicsDevices on X11 platforms (as
// well as X11GraphicsDevices in non-AWT situations)
registerFactory(defaultDeviceCapsType.deviceType, defaultDeviceCapsType.capsType, new DefaultGraphicsConfigurationFactoryImpl());
-
+
if (NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
}
if(NativeWindowFactory.isAWTAvailable()) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) { /* n/a */ }
}
}
}
}
-
+
public static synchronized void shutdown() {
if(initialized) {
initialized = false;
@@ -155,7 +157,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories.clear();
}
}
-
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
@@ -176,10 +178,10 @@ public abstract class GraphicsConfigurationFactory {
/**
* Returns the graphics configuration factory for use with the
* given device and capability.
- *
+ *
* @see #getFactory(Class, Class)
*/
- public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
+ public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
if (device == null) {
throw new IllegalArgumentException("null device");
}
@@ -195,7 +197,7 @@ public abstract class GraphicsConfigurationFactory {
* <p>
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
* </p>
- *
+ *
* <p>
* Pseudo code for finding a suitable factory is:
* <pre>
@@ -211,7 +213,7 @@ public abstract class GraphicsConfigurationFactory {
* @param deviceType the minimum capabilities class type accepted, must implement or extend {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must implement or extend {@link CapabilitiesImmutable}
*
- * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
+ * @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)
@@ -228,12 +230,12 @@ public abstract class GraphicsConfigurationFactory {
System.err.println("GraphicsConfigurationFactory.getFactory: "+deviceType.getName()+", "+capabilitiesType.getName());
dumpFactories();
}
-
- final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
+
+ final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() deviceTypes: " + deviceTypes);
}
- final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
+ final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() capabilitiesTypes: " + capabilitiesTypes);
}
@@ -259,7 +261,7 @@ public abstract class GraphicsConfigurationFactory {
return factory;
}
private static ArrayList<Class<?>> getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly) {
- // Using a todo list avoiding a recursive loop!
+ // Using a todo list avoiding a recursive loop!
final ArrayList<Class<?>> inspectClasses = new ArrayList<Class<?>>();
final ArrayList<Class<?>> resolvedInterfaces = new ArrayList<Class<?>>();
inspectClasses.add(fromClass);
@@ -277,7 +279,7 @@ public abstract class GraphicsConfigurationFactory {
}
}
types.addAll(Arrays.asList(fromClass.getInterfaces()));
-
+
for(int i=0; i<types.size(); i++) {
final Class<?> iface = types.get(i);
if( superClassOrInterface.isAssignableFrom(iface) && !resolvedInterfaces.contains(iface) ) {
@@ -302,20 +304,20 @@ public abstract class GraphicsConfigurationFactory {
}
}
- /**
+ /**
* Registers a GraphicsConfigurationFactory handling
* the given graphics device and capability class.
* <p>
* This does not need to be called by end users, only implementors of new
* GraphicsConfigurationFactory subclasses.
* </p>
- *
+ *
* <p>
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
- * </p>
- *
+ * </p>
+ *
* <p>See {@link #getFactory(Class, Class)} for a description of the find algorithm.</p>
- *
+ *
* @param deviceType the minimum capabilities class type accepted, must implement or extend interface {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must extend interface {@link CapabilitiesImmutable}
* @return the previous registered factory, or null if none
@@ -329,7 +331,7 @@ public abstract class GraphicsConfigurationFactory {
}
if (!(defaultDeviceCapsType.capsType.isAssignableFrom(capabilitiesType))) {
throw new IllegalArgumentException("Given capabilities class must implement CapabilitiesImmutable");
- }
+ }
final DeviceCapsType dct = new DeviceCapsType(abstractGraphicsDeviceImplementor, capabilitiesType);
final GraphicsConfigurationFactory prevFactory;
if(null == factory) {
@@ -352,7 +354,7 @@ public abstract class GraphicsConfigurationFactory {
* <P> Selects a graphics configuration on the specified graphics
* device compatible with the supplied {@link Capabilities}. Some
* platforms (e.g.: X11, EGL, KD) require the graphics configuration
- * to be specified when the native window is created.
+ * to be specified when the native window is created.
* These architectures have seperated their device, screen, window and drawable
* context and hence are capable of quering the capabilities for each screen.
* A fully established window is not required.</P>
@@ -360,7 +362,7 @@ public abstract class GraphicsConfigurationFactory {
* <P>Other platforms (e.g. Windows, MacOSX) don't offer the mentioned seperation
* and hence need a fully established window and it's drawable.
* Here the validation of the capabilities is performed later.
- * In this case, the AbstractGraphicsConfiguration implementation
+ * In this case, the AbstractGraphicsConfiguration implementation
* must allow an overwrite of the Capabilites, for example
* {@link DefaultGraphicsConfiguration#setChosenCapabilities DefaultGraphicsConfiguration.setChosenCapabilities(..)}.
* </P>
@@ -385,7 +387,7 @@ public abstract class GraphicsConfigurationFactory {
* @param capsRequested the original requested capabilities
* @param chooser the choosing implementation
* @param screen the referring Screen
- * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
+ * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
* @return the complete GraphicsConfiguration
*
* @throws IllegalArgumentException if the data type of the passed
diff --git a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
index ff53c8109..a0db11ad9 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
@@ -31,12 +31,12 @@ package javax.media.nativewindow;
/**
* Provides a {@link NativeSurface} with a mutable <code>surfaceHandle</code>
* via {@link #setSurfaceHandle(long)}.
- *
+ *
* @see NativeSurface
*/
public interface MutableSurface extends NativeSurface {
- /**
+ /**
* Sets the surface handle which is created outside of this implementation.
*/
public void setSurfaceHandle(long surfaceHandle);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
index a89caec76..a755b1812 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow;
/** Provides low-level information required for
@@ -54,10 +54,10 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* <p>
* The surface handle shall be valid after a successfull call,
* ie return a value other than {@link #LOCK_SURFACE_UNLOCKED} and {@link #LOCK_SURFACE_NOT_READY},
- * which is
- * <pre>
- * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
- * </pre>
+ * which is
+ * <pre>
+ * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
+ * </pre>
* </p>
* <p>
* The caller may need to take care of the result {@link #LOCK_SURFACE_CHANGED},
@@ -71,7 +71,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* This call allows recursion from the same thread.
* </p>
* <p>
- * The implementation may want to aquire the
+ * The implementation may want to aquire the
* application level {@link com.jogamp.common.util.locks.RecursiveLock}
* first before proceeding with a native surface lock.
* </p>
@@ -115,7 +115,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* </pre>
*/
public boolean isSurfaceLockedByOtherThread();
-
+
/**
* Return the locking owner's Thread, or null if not locked.
*/
@@ -123,15 +123,15 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/**
* Provide a mechanism to utilize custom (pre-) swap surface
- * code. This method is called before the render toolkit (e.g. JOGL)
+ * code. This method is called before the render toolkit (e.g. JOGL)
* swaps the buffer/surface if double buffering is enabled.
- * <p>
+ * <p>
* The implementation may itself apply the swapping,
* in which case true shall be returned.
* </p>
*
* @return true if this method completed swapping the surface,
- * otherwise false, in which case eg the GLDrawable
+ * otherwise false, in which case eg the GLDrawable
* implementation has to swap the code.
*/
public boolean surfaceSwap();
@@ -153,13 +153,13 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/** Remove the specified {@link SurfaceUpdatedListener} from the list. */
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l);
-
+
/**
* Returns the handle to the surface for this NativeSurface. <P>
- *
+ *
* The surface handle should be set/update by {@link #lockSurface()},
* where {@link #unlockSurface()} is not allowed to modify it.
- * After {@link #unlockSurface()} it is no more guaranteed
+ * After {@link #unlockSurface()} it is no more guaranteed
* that the surface handle is still valid.
*
* The surface handle shall reflect the platform one
@@ -195,16 +195,16 @@ public interface NativeSurface extends SurfaceUpdatedListener {
public AbstractGraphicsConfiguration getGraphicsConfiguration();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice
*/
public long getDisplayHandle();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen
*/
public int getScreenIndex();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
index 593c1e7d6..0943c8c09 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 07d1008b4..6962ce505 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -90,13 +90,13 @@ public abstract class NativeWindowFactory {
private static final String nativeWindowingTypePure; // canonical String via String.intern()
private static final String nativeWindowingTypeCustom; // canonical String via String.intern()
-
+
private static NativeWindowFactory defaultFactory;
private static Map<Class<?>, NativeWindowFactory> registeredFactories;
-
+
private static Class<?> nativeWindowClass;
private static boolean isAWTAvailable;
-
+
private static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ;
/** {@link jogamp.nativewindow.x11.X11Util} implements {@link ToolkitProperties}. */
private static final String X11UtilClassName = "jogamp.nativewindow.x11.X11Util";
@@ -104,16 +104,16 @@ public abstract class NativeWindowFactory {
private static final String OSXUtilClassName = "jogamp.nativewindow.macosx.OSXUtil";
/** {@link jogamp.nativewindow.windows.GDIUtil} implements {@link ToolkitProperties}. */
private static final String GDIClassName = "jogamp.nativewindow.windows.GDIUtil";
-
+
private static ToolkitLock jawtUtilJAWTToolkitLock;
-
+
private static boolean requiresToolkitLock;
private static boolean desktopHasThreadingIssues;
// Shutdown hook mechanism for the factory
private static volatile boolean isJVMShuttingDown = false;
private static final List<Runnable> customShutdownHooks = new ArrayList<Runnable>();
-
+
/** Creates a new NativeWindowFactory instance. End users do not
need to call this method. */
protected NativeWindowFactory() {
@@ -123,6 +123,7 @@ public abstract class NativeWindowFactory {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
private final File vcliblocation = new File(
"/opt/vc/lib/libbcm_host.so");
+ @Override
public Boolean run() {
if ( vcliblocation.isFile() ) {
return Boolean.TRUE;
@@ -139,10 +140,10 @@ public abstract class NativeWindowFactory {
case MACOS:
return TYPE_MACOSX;
case WINDOWS:
- return TYPE_WINDOWS;
+ return TYPE_WINDOWS;
case OPENKODE:
return TYPE_EGL;
-
+
case LINUX:
case FREEBSD:
case SUNOS:
@@ -158,26 +159,28 @@ public abstract class NativeWindowFactory {
static {
final boolean[] _DEBUG = new boolean[] { false };
final String[] _tmp = new String[] { null };
-
+
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
Platform.initSingleton(); // last resort ..
_DEBUG[0] = Debug.debug("NativeWindow");
_tmp[0] = Debug.getProperty("nativewindow.ws.name", true);
Runtime.getRuntime().addShutdownHook(
new Thread(new Runnable() {
+ @Override
public void run() {
NativeWindowFactory.shutdown(true);
- } }, "NativeWindowFactory_ShutdownHook" ) ) ;
+ } }, "NativeWindowFactory_ShutdownHook" ) ) ;
return null;
} } ) ;
-
+
DEBUG = _DEBUG[0];
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - Info: NativeWindowFactory.<init>");
// Thread.dumpStack();
}
-
+
// Gather the windowing TK first
nativeWindowingTypePure = _getNativeWindowingType();
if(null==_tmp[0] || _tmp[0].length()==0) {
@@ -202,23 +205,23 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "initSingleton", null, null, cl );
-
+
final Boolean res1 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "requiresToolkitLock", null, null, cl);
requiresToolkitLock = res1.booleanValue();
final Boolean res2 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "hasThreadingIssues", null, null, cl);
desktopHasThreadingIssues = res2.booleanValue();
- } else {
+ } else {
requiresToolkitLock = false;
desktopHasThreadingIssues = false;
}
}
- /** Returns true if the JVM is shutting down, otherwise false. */
+ /** Returns true if the JVM is shutting down, otherwise false. */
public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; }
-
- /**
+
+ /**
* Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.
- *
+ *
* @param head if true add runnable at the start, otherwise at the end
* @param runnable runnable to be added.
*/
@@ -234,7 +237,7 @@ public abstract class NativeWindowFactory {
}
}
- /**
+ /**
* Cleanup resources at JVM shutdown
*/
public static synchronized void shutdown(boolean _isJVMShuttingDown) {
@@ -246,14 +249,14 @@ public abstract class NativeWindowFactory {
final int cshCount = customShutdownHooks.size();
for(int i=0; i < cshCount; i++) {
try {
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount);
}
customShutdownHooks.get(i).run();
} catch(Throwable t) {
System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount);
- if( DEBUG ) {
- t.printStackTrace();
+ if( DEBUG ) {
+ t.printStackTrace();
}
}
}
@@ -262,7 +265,7 @@ public abstract class NativeWindowFactory {
if(DEBUG) {
System.err.println("NativeWindowFactory.shutdown(): Post customShutdownHook");
}
-
+
if(initialized) {
initialized = false;
if(null != registeredFactories) {
@@ -271,14 +274,14 @@ public abstract class NativeWindowFactory {
}
GraphicsConfigurationFactory.shutdown();
}
-
+
shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown
// SharedResourceToolkitLock.shutdown(DEBUG); // not used yet
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown);
}
}
-
+
private static void shutdownNativeImpl(final ClassLoader cl) {
final String clazzName;
if( TYPE_X11 == nativeWindowingTypePure ) {
@@ -292,11 +295,11 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "shutdown", null, null, cl );
- }
+ }
}
-
+
/** Returns true if {@link #initSingleton()} has been called w/o subsequent {@link #shutdown(boolean)}. */
- public static synchronized boolean isInitialized() { return initialized; }
+ public static synchronized boolean isInitialized() { return initialized; }
/**
* Static one time initialization of this factory.<br>
@@ -316,8 +319,9 @@ public abstract class NativeWindowFactory {
if( Platform.AWT_AVAILABLE &&
ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) {
-
+
Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ @Override
public Method[] run() {
try {
Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader());
@@ -327,7 +331,7 @@ public abstract class NativeWindowFactory {
jawtUtilInitMethod.setAccessible(true);
Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{});
jawtUtilGetJAWTToolkitLockMethod.setAccessible(true);
- return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
+ return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
} catch (Exception e) {
if(DEBUG) {
e.printStackTrace();
@@ -340,7 +344,7 @@ public abstract class NativeWindowFactory {
final Method jawtUtilInitMethod = jawtUtilMethods[0];
final Method jawtUtilIsHeadlessMethod = jawtUtilMethods[1];
final Method jawtUtilGetJAWTToolkitLockMethod = jawtUtilMethods[2];
-
+
ReflectionUtil.callMethod(null, jawtUtilInitMethod);
Object resO = ReflectionUtil.callMethod(null, jawtUtilIsHeadlessMethod);
@@ -351,21 +355,21 @@ public abstract class NativeWindowFactory {
} else {
throw new RuntimeException("JAWTUtil.isHeadlessMode() didn't return a Boolean");
}
- resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
+ resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
if(resO instanceof ToolkitLock) {
jawtUtilJAWTToolkitLock = (ToolkitLock) resO;
} else {
throw new RuntimeException("JAWTUtil.getJAWTToolkitLock() didn't return a ToolkitLock");
- }
+ }
}
}
-
+
// X11 initialization after possible AWT initialization
// This is performed post AWT initialization, allowing AWT to complete the same,
- // which may have been triggered before NativeWindow initialization.
- // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
+ // which may have been triggered before NativeWindow initialization.
+ // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
initSingletonNativeImpl(cl);
-
+
registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>());
// register our default factory -> NativeWindow
@@ -373,17 +377,17 @@ public abstract class NativeWindowFactory {
nativeWindowClass = javax.media.nativewindow.NativeWindow.class;
registerFactory(nativeWindowClass, factory);
defaultFactory = factory;
-
+
if ( isAWTAvailable ) {
// register either our default factory or (if exist) the X11/AWT one -> AWT Component
registerFactory(ReflectionUtil.getClass(ReflectionUtil.AWTNames.ComponentClass, false, cl), factory);
}
-
+
if(DEBUG) {
System.err.println("NativeWindowFactory requiresToolkitLock "+requiresToolkitLock+", desktopHasThreadingIssues "+desktopHasThreadingIssues);
System.err.println("NativeWindowFactory isAWTAvailable "+isAWTAvailable+", defaultFactory "+factory);
}
-
+
GraphicsConfigurationFactory.initSingleton();
}
}
@@ -392,20 +396,20 @@ public abstract class NativeWindowFactory {
public static boolean requiresToolkitLock() {
return requiresToolkitLock;
}
-
+
/** @return true if not headless, AWT Component and NativeWindow's AWT part available */
public static boolean isAWTAvailable() { return isAWTAvailable; }
/**
* @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value.
- * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
+ * @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) {
return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure;
}
- /** Don't know if we shall add this factory here ..
+ /** Don't know if we shall add this factory here ..
public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
if(TYPE_EGL == type) {
return new
@@ -427,13 +431,13 @@ public abstract class NativeWindowFactory {
return defaultFactory;
}
- /**
+ /**
* Returns the AWT {@link ToolkitLock} (JAWT based) if {@link #isAWTAvailable}, otherwise null.
* <p>
* The JAWT based {@link ToolkitLock} also locks the global lock,
* which matters if the latter is required.
- * </p>
- */
+ * </p>
+ */
public static ToolkitLock getAWTToolkitLock() {
return jawtUtilJAWTToolkitLock;
}
@@ -441,7 +445,7 @@ public abstract class NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* Provides the system default {@link ToolkitLock} for the default system windowing type.
* @see #getNativeWindowType(boolean)
@@ -486,7 +490,7 @@ public abstract class NativeWindowFactory {
}
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* @param device
* @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
@@ -510,7 +514,7 @@ public abstract class NativeWindowFactory {
}
return new DefaultGraphicsScreen(device, screen);
}
-
+
/** Returns the appropriate NativeWindowFactory to handle window
objects of the given type. The windowClass might be {@link
NativeWindow NativeWindow}, in which case the client has
@@ -543,7 +547,7 @@ public abstract class NativeWindowFactory {
}
/** Converts the given window object and it's
- {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a
+ {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a
{@link NativeWindow NativeWindow} which can be operated upon by a custom
toolkit, e.g. {@link javax.media.opengl.GLDrawableFactory javax.media.opengl.GLDrawableFactory}.<br>
The object may be a component for a particular window toolkit, such as an AWT
@@ -554,7 +558,7 @@ public abstract class NativeWindowFactory {
NativeWindowFactory is responsible for handling objects from a
particular window toolkit. The built-in NativeWindowFactory
handles NativeWindow instances as well as AWT Components.<br>
-
+
@throws IllegalArgumentException if the given window object
could not be handled by any of the registered
NativeWindowFactory instances
@@ -573,22 +577,22 @@ public abstract class NativeWindowFactory {
NativeWindow. Implementors of concrete NativeWindowFactory
subclasses should override this method. */
protected abstract NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException;
-
+
/**
* Returns the {@link OffscreenLayerSurface} instance of this {@link NativeSurface}.
* <p>
- * In case this surface is a {@link NativeWindow}, we traverse from the given surface
+ * In case this surface is a {@link NativeWindow}, we traverse from the given surface
* up to root until an implementation of {@link OffscreenLayerSurface} is found.
* In case <code>ifEnabled</code> is true, the surface must also implement {@link OffscreenLayerOption}
- * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>.
+ * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>.
* </p>
- *
+ *
* @param surface The surface to query.
- * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
+ * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
* @return
*/
public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) {
- if(surface instanceof OffscreenLayerSurface &&
+ if(surface instanceof OffscreenLayerSurface &&
( !ifEnabled || surface instanceof OffscreenLayerOption ) ) {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
@@ -601,12 +605,12 @@ public abstract class NativeWindowFactory {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) nw;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
}
- nw = nw.getParent();
+ nw = nw.getParent();
}
}
- return null;
+ return null;
}
-
+
/**
* Returns true if the given visualID is valid for further processing, i.e. OpenGL usage,
* otherwise return false.
@@ -619,8 +623,8 @@ public abstract class NativeWindowFactory {
* </p>
*/
public static boolean isNativeVisualIDValidForProcessing(int visualID) {
- return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
+ return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
VisualIDHolder.VID_UNDEFINED != visualID ;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
index 12d30b3cd..11496899a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
@@ -32,30 +32,30 @@ package javax.media.nativewindow;
* within the implementation.
*/
public interface OffscreenLayerOption {
- /**
+ /**
* Request an offscreen layer, if supported.
* <p>
* Shall be called before the first {@link NativeWindow#lockSurface()},
* and hence before realization.
* </p>
- *
+ *
* @see #getShallUseOffscreenLayer()
- * @see #isOffscreenLayerSurfaceEnabled()
+ * @see #isOffscreenLayerSurfaceEnabled()
*/
public void setShallUseOffscreenLayer(boolean v);
/** Returns the property set by {@link #setShallUseOffscreenLayer(boolean)}. */
public boolean getShallUseOffscreenLayer();
- /**
+ /**
* Returns true if this instance uses an offscreen layer, otherwise false.
* <p>
* This instance is an offscreen layer, if {@link #setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
* has been called before it's realization and first lock and the underlying implementation supports it.
* </p>
* The return value is undefined before issuing the first {@link NativeWindow#lockSurface()}.
- *
- * @see #setShallUseOffscreenLayer(boolean)
+ *
+ * @see #setShallUseOffscreenLayer(boolean)
*/
public boolean isOffscreenLayerSurfaceEnabled();
} \ No newline at end of file
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
index 1826008ad..8681422ef 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
@@ -33,36 +33,36 @@ import com.jogamp.common.util.locks.RecursiveLock;
* Interface specifying the offscreen layer surface protocol.
*/
public interface OffscreenLayerSurface {
- /**
+ /**
* Attach the offscreen layer to this offscreen layer surface.
* <p>
* Implementation may realize all required resources at this point.
* </p>
- *
+ *
* @see #isOffscreenLayerSurfaceEnabled()
* @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
*/
public void attachSurfaceLayer(final long layerHandle) throws NativeWindowException;
-
- /**
+
+ /**
* Detaches a previously attached offscreen layer from this offscreen layer surface.
* @see #attachSurfaceLayer(long)
* @see #isOffscreenLayerSurfaceEnabled()
- * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
+ * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
* or no surface layer is attached.
*/
public void detachSurfaceLayer() throws NativeWindowException;
-
+
/** Returns the attached surface layer or null if none is attached. */
public long getAttachedSurfaceLayer();
-
+
/** Returns true if a surface layer is attached, otherwise false. */
public boolean isSurfaceLayerAttached();
-
+
/** Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings. */
public void setChosenCapabilities(CapabilitiesImmutable caps);
-
- /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
+
+ /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
public RecursiveLock getLock();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 15a8738c5..0af2bdaf9 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -33,44 +33,44 @@ import jogamp.nativewindow.Debug;
/**
* Provides a mutable {@link NativeSurface}, i.e. {@link MutableSurface}, while allowing an
* {@link UpstreamSurfaceHook} to influence the lifecycle and information.
- *
+ *
* @see UpstreamSurfaceHook
* @see MutableSurface
* @see NativeSurface
*/
-public interface ProxySurface extends MutableSurface {
+public interface ProxySurface extends MutableSurface {
public static final boolean DEBUG = Debug.debug("ProxySurface");
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's surface handle
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_SURFACE = 1 << 6;
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's {@link AbstractGraphicsDevice}.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_DEVICE = 1 << 7;
-
- /**
+
+ /**
* Implementation specific bitvalue stating the upstream's {@link NativeSurface} is an invisible window, i.e. maybe incomplete.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8;
/** Allow redefining the AbstractGraphicsConfiguration */
- public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
+ public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
/**
* Return the upstream {@link NativeSurface} if used, otherwise <code>null</code>.
- * <p>
+ * <p>
* An upstream {@link NativeSurface} may backup this {@link ProxySurface} instance's representation,
* e.g. via a {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set} {@link UpstreamSurfaceHook}.
* </p>
@@ -80,47 +80,48 @@ public interface ProxySurface extends MutableSurface {
* </p>
*/
public NativeSurface getUpstreamSurface();
-
+
/** Returns the {@link UpstreamSurfaceHook} if {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set}, otherwise <code>null</code>. */
public UpstreamSurfaceHook getUpstreamSurfaceHook();
-
+
/**
* Sets the {@link UpstreamSurfaceHook} and returns the previous value.
*/
public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook);
-
- /**
- * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
+
+ /**
+ * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
* {@link UpstreamSurfaceHook#create(ProxySurface)} and {@link UpstreamSurfaceHook#destroy(ProxySurface)}.
* <p>
* Use this for small code blocks where the native resources shall not change,
* i.e. resizing a derived (OpenGL) drawable.
- * </p>
+ * </p>
*/
public void enableUpstreamSurfaceHookLifecycle(boolean enable);
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#create(ProxySurface)} is being issued and the proxy surface/window handles shall be set.
- */
+ */
public void createNotify();
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#destroy(ProxySurface)} is being issued and all proxy surface/window handles shall be cleared.
- */
+ */
public void destroyNotify();
-
+
public StringBuilder getUpstreamOptionBits(StringBuilder sink);
public int getUpstreamOptionBits();
-
+
/** Returns <code>true</code> if the give bit-mask <code>v</code> is set in this instance upstream-option-bits, otherwise <code>false</code>.*/
public boolean containsUpstreamOptionBits(int v);
-
+
/** Add the given bit-mask to this instance upstream-option-bits using bit-or w/ <code>v</code>.*/
public void addUpstreamOptionBits(int v);
-
+
/** Clear the given bit-mask from this instance upstream-option-bits using bit-and w/ <code>~v</code>*/
public void clearUpstreamOptionBits(int v);
-
+
public StringBuilder toString(StringBuilder sink);
+ @Override
public String toString();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
index 0912b5afe..de65a3031 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package javax.media.nativewindow;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
index eccfcfa4f..017b996d7 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
@@ -53,26 +53,26 @@ public interface ToolkitLock {
* @throws RuntimeException in case of a timeout
*/
public void lock();
-
+
/**
* Release the lock.
*
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
-
+
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Dispose this instance.
- * <p>
+ * <p>
* Shall be called when instance is no more required.
* </p>
* This allows implementations sharing a lock via resources
- * to decrease the reference counter.
+ * to decrease the reference counter.
*/
public void dispose();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
index 6fe2e5364..f08a6c938 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
@@ -28,24 +28,24 @@
package javax.media.nativewindow;
-/**
- * Interface allowing upstream caller to pass lifecycle actions and size info
- * to a {@link ProxySurface} instance.
- */
+/**
+ * Interface allowing upstream caller to pass lifecycle actions and size info
+ * to a {@link ProxySurface} instance.
+ */
public interface UpstreamSurfaceHook {
/** called within {@link ProxySurface#createNotify()} within lock, before using surface. */
public void create(ProxySurface s);
/** called within {@link ProxySurface#destroyNotify()} within lock, before clearing fields. */
public void destroy(ProxySurface s);
- /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getWidth(ProxySurface s);
- /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getHeight(ProxySurface s);
-
+
/**
- * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
- */
+ * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
+ */
public interface MutableSize extends UpstreamSurfaceHook {
public void setSize(int width, int height);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
index 4f3d3ff00..4ed79b1dc 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
@@ -38,7 +38,7 @@ import java.util.Comparator;
* </p>
*/
public interface VisualIDHolder {
-
+
public enum VIDType {
// Generic Values
INTRINSIC(0), NATIVE(1),
@@ -47,19 +47,19 @@ public interface VisualIDHolder {
// X11 Values
X11_XVISUAL(20), X11_FBCONFIG(21),
// Windows Values
- WIN32_PFD(30);
-
+ WIN32_PFD(30);
+
public final int id;
VIDType(int id){
this.id = id;
}
- }
-
+ }
+
/**
* Returns the native visual ID of the given <code>type</code>
* if supported, or {@link #VID_UNDEFINED} if not supported.
- * <p>
+ * <p>
* Depending on the native windowing system, <code>type</code> is handled as follows:
* <ul>
* <li>X11 throws NativeWindowException on <code>EGL_CONFIG</code>, <code>WIN32_PFD</code>
@@ -76,7 +76,7 @@ public interface VisualIDHolder {
* <li><code>X11_XVISUAL</code>: <i>X11 XVisual ID</i></li>
* <li><code>X11_FBCONFIG</code>: <i>X11 FBConfig ID</i> or <code>VID_UNDEFINED</code></li>
* </ul></li>
- * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>
+ * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>
* <ul>
* <li><code>INTRINSIC</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
* <li><code>NATIVE</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
@@ -91,35 +91,36 @@ public interface VisualIDHolder {
* </ul>
* </p>
* Note: <code>INTRINSIC</code> and <code>NATIVE</code> are always handled,
- * but may result in {@link #VID_UNDEFINED}. The latter is true if
- * the native value are actually undefined or the corresponding object is not
+ * but may result in {@link #VID_UNDEFINED}. The latter is true if
+ * the native value are actually undefined or the corresponding object is not
* mapped to a native visual object.
- *
+ *
* @throws NativeWindowException if <code>type</code> is neither
* <code>INTRINSIC</code> nor <code>NATIVE</code>
- * and does not match the native implementation.
+ * and does not match the native implementation.
*/
int getVisualID(VIDType type) throws NativeWindowException ;
-
- /**
+
+ /**
* {@link #getVisualID(VIDType)} result indicating an undefined value,
* which could be cause by an unsupported query.
* <p>
* We assume the const value <code>0</code> doesn't reflect a valid native visual ID
* and is interpreted as <i>no value</i> on all platforms.
* This is currently true for Android, X11 and Windows.
- * </p>
+ * </p>
*/
static final int VID_UNDEFINED = 0;
-
+
/** Comparing {@link VIDType#NATIVE} */
public static class VIDComparator implements Comparator<VisualIDHolder> {
private VIDType type;
-
+
public VIDComparator(VIDType type) {
this.type = type;
}
-
+
+ @Override
public int compare(VisualIDHolder vid1, VisualIDHolder vid2) {
final int id1 = vid1.getVisualID(type);
final int id2 = vid2.getVisualID(type);
@@ -131,5 +132,5 @@ public interface VisualIDHolder {
}
return 0;
}
- }
+ }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
index 02f68f442..8570b78da 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
@@ -37,7 +37,7 @@ package javax.media.nativewindow;
* this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.</p>
*/
public interface WindowClosingProtocol {
-
+
/**
* Window closing mode if triggered by toolkit close operation.
*/
@@ -47,7 +47,7 @@ public interface WindowClosingProtocol {
* This is the default behavior within an AWT environment.
*/
DO_NOTHING_ON_CLOSE,
-
+
/**
* Dispose resources on native window close operation.<br>
* This is the default behavior in case no underlying toolkit defines otherwise.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
index 17b4930c5..b8dc53c83 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,12 +21,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
public class Dimension implements Cloneable, DimensionImmutable {
@@ -45,10 +45,12 @@ public class Dimension implements Cloneable, DimensionImmutable {
this.height=height;
}
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -92,7 +94,7 @@ public class Dimension implements Cloneable, DimensionImmutable {
public int compareTo(final DimensionImmutable d) {
final int tsq = width*height;
final int xsq = d.getWidth()*d.getHeight();
-
+
if(tsq > xsq) {
return 1;
} else if(tsq < xsq) {
@@ -100,13 +102,13 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof Dimension) {
Dimension p = (Dimension)obj;
- return height == p.height &&
+ return height == p.height &&
width == p.width ;
}
return false;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
index 22bd3f48b..e6cacf4ff 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
@@ -46,12 +46,12 @@ public interface DimensionImmutable extends WriteCloneable, Comparable<Dimension
/**
* <p>
* Compares square of size.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final DimensionImmutable d);
-
+
/**
* Checks whether two dimensions objects are equal. Two instances
* of <code>DimensionReadOnly</code> are equal if two components
@@ -59,8 +59,10 @@ public interface DimensionImmutable extends WriteCloneable, Comparable<Dimension
* @return <code>true</code> if the two dimensions are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index 942c12c2b..c84359dcd 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
public class Insets implements Cloneable, InsetsImmutable {
static final InsetsImmutable zeroInsets = new Insets();
public static final InsetsImmutable getZero() { return zeroInsets; }
-
+
int l, r, t, b;
public Insets() {
@@ -44,11 +44,13 @@ public class Insets implements Cloneable, InsetsImmutable {
this.t=top;
this.b=bottom;
}
-
+
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
protected Object clone() {
try {
return super.clone();
@@ -77,7 +79,7 @@ public class Insets implements Cloneable, InsetsImmutable {
public final void setRightWidth(int right) { r = right; }
public final void setTopHeight(int top) { t = top; }
public final void setBottomHeight(int bottom) { b = bottom; }
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -99,6 +101,7 @@ public class Insets implements Cloneable, InsetsImmutable {
return sum3 * (sum3 + 1)/2 + val2;
}
+ @Override
public String toString() {
return new String("[ l "+l+", r "+r+" - t "+t+", b "+b+" - "+getTotalWidth()+"x"+getTotalHeight()+"]");
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
index 075641ede..8256068cd 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
@@ -41,13 +41,13 @@ public interface InsetsImmutable extends WriteCloneable {
/** @return total width, ie. <code>left_width + right_width</code> */
int getTotalWidth();
-
+
/** @return top inset height */
int getTopHeight();
/** @return bottom inset height */
int getBottomHeight();
-
+
/** @return total height, ie. <code>top_height + bottom_height</code> */
int getTotalHeight();
@@ -59,8 +59,10 @@ public interface InsetsImmutable extends WriteCloneable {
* @return <code>true</code> if the two Insets are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index 4c233bb16..57c6fb716 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -42,10 +42,12 @@ public class Point implements Cloneable, PointImmutable {
this(0, 0);
}
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -58,7 +60,7 @@ public class Point implements Cloneable, PointImmutable {
public int compareTo(final PointImmutable d) {
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -66,7 +68,7 @@ public class Point implements Cloneable, PointImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -95,6 +97,7 @@ public class Point implements Cloneable, PointImmutable {
return hash;
}
+ @Override
public String toString() {
return new String( x + " / " + y );
}
@@ -120,5 +123,5 @@ public class Point implements Cloneable, PointImmutable {
y *= sy ;
return this;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
index b00329bb5..08c628cc1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
@@ -41,12 +41,12 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl
/**
* <p>
* Compares the square of the position.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final PointImmutable d);
-
+
/**
* Checks whether two points objects are equal. Two instances
* of <code>PointReadOnly</code> are equal if the two components
@@ -54,8 +54,10 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl
* @return <code>true</code> if the two points are equal;
* otherwise <code>false</code>.
*/
+ @Override
public boolean equals(Object obj);
+ @Override
public int hashCode();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
index bbbfa2932..8dc8f4562 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
import java.util.List;
@@ -46,11 +46,13 @@ public class Rectangle implements Cloneable, RectangleImmutable {
this.width=width;
this.height=height;
}
-
+
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
protected Object clone() {
try {
return super.clone();
@@ -67,7 +69,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
public final int getWidth() { return width; }
@Override
public final int getHeight() { return height; }
-
+
public final void set(int x, int y, int width, int height) {
this.x = x;
this.y = y;
@@ -89,7 +91,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
final int y1 = Math.min(y, ry1);
final int x2 = Math.max(x + width, rx2);
final int y2 = Math.max(y + height, ry2);
- return new Rectangle(x1, y1, x2 - x1, y2 - y1);
+ return new Rectangle(x1, y1, x2 - x1, y2 - y1);
}
/**
* Calculates the union of the given rectangles, stores it in this instance and returns this instance.
@@ -109,7 +111,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
set(x1, y1, x2 - x1, y2 - y1);
return this;
}
-
+
@Override
public final RectangleImmutable intersection(RectangleImmutable r) {
return intersection(r.getX(), r.getY(), r.getX() + r.getWidth(), r.getY() + r.getHeight());
@@ -144,13 +146,13 @@ public class Rectangle implements Cloneable, RectangleImmutable {
final float sqT = (float) ( width*height );
return sqI / sqT;
}
-
+
@Override
public int compareTo(final RectangleImmutable d) {
{
final int sq = width*height;
final int xsq = d.getWidth()*d.getHeight();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -160,7 +162,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
{
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -169,7 +171,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -191,6 +193,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
return sum3 * (sum3 + 1)/2 + val2;
}
+ @Override
public String toString() {
return new String("[ "+x+" / "+y+" "+width+" x "+height+" ]");
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
index 440d9e000..7ca92ff53 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
@@ -49,7 +49,7 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
RectangleImmutable intersection(RectangleImmutable r);
/** Returns the intersection of this rectangleand the given coordinates. */
RectangleImmutable intersection(final int rx1, final int ry1, final int rx2, final int ry2);
- /**
+ /**
* Returns the coverage of given rectangle w/ this this one, i.e. between <code>0.0</code> and <code>1.0</code>.
* <p>
* Coverage is computed by:
@@ -57,19 +57,19 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
* isect = this.intersection(r);
* coverage = area( isect ) / area( this ) ;
* </pre>
- * </p>
+ * </p>
*/
float coverage(RectangleImmutable r);
-
+
/**
* <p>
* Compares square of size 1st, if equal the square of position.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final RectangleImmutable d);
-
+
/**
* Checks whether two rect objects are equal. Two instances
* of <code>Rectangle</code> are equal if the four integer values
@@ -78,8 +78,10 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
* @return <code>true</code> if the two rectangles are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
index 3084816a5..f1749dfa6 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,15 +21,15 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
-/**
+/**
* Immutable SurfaceSize Class, consisting of it's read only components:<br>
* <ul>
* <li>{@link javax.media.nativewindow.util.DimensionImmutable} size in pixels</li>
@@ -56,6 +56,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
return bitsPerPixel;
}
+ @Override
public final String toString() {
return new String("[ "+resolution+" x "+bitsPerPixel+" bpp ]");
}
@@ -63,7 +64,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
/**
* <p>
* Compares {@link DimensionImmutable#compareTo(DimensionImmutable) resolution} 1st, if equal the bitsPerPixel.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
@@ -72,7 +73,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
if( 0 != rres ) {
return rres;
}
- final int xbpp = ssz.getBitsPerPixel();
+ final int xbpp = ssz.getBitsPerPixel();
if(bitsPerPixel > xbpp) {
return 1;
} else if(bitsPerPixel < xbpp) {
@@ -80,7 +81,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
}
return 0;
}
-
+
/**
* Checks whether two size objects are equal. Two instances
* of <code>SurfaceSize</code> are equal if the two components
@@ -89,6 +90,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
* @return <code>true</code> if the two dimensions are equal;
* otherwise <code>false</code>.
*/
+ @Override
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof SurfaceSize) {
@@ -99,6 +101,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
return false;
}
+ @Override
public final int hashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + getResolution().hashCode();