diff options
7 files changed, 198 insertions, 137 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 8b832b310..61ab2e58d 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-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 @@ -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. */ @@ -41,6 +41,7 @@ package javax.media.opengl; import javax.media.nativewindow.Capabilities; +import javax.media.nativewindow.CapabilitiesImmutable; /** Specifies a set of OpenGL capabilities.<br> At creation time of a {@link GLDrawable} using {@link GLDrawableFactory}, @@ -86,10 +87,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice()); } + @Override public Object cloneMutable() { return clone(); } + @Override public Object clone() { try { return super.clone(); @@ -98,6 +101,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } } + @Override public int hashCode() { // 31 * x == (x << 5) - x int hash = 31 + this.glProfile.hashCode() ; @@ -119,6 +123,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil return hash; } + @Override public boolean equals(Object obj) { if(this == obj) { return true; } if(!(obj instanceof GLCapabilitiesImmutable)) { @@ -142,46 +147,52 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil other.getPbufferRenderToTextureRectangle()==pbufferRenderToTextureRectangle; if(sampleBuffers) { res = res && - other.getNumSamples()==numSamples && + other.getNumSamples()==numSamples && other.getSampleExtension().equals(sampleExtension) ; } return res; } /** comparing hw/sw, stereo, multisample, stencil, RGBA and depth only */ - public int compareTo(Object o) { - if ( ! ( o instanceof GLCapabilities ) ) { + @Override + public int compareTo(final CapabilitiesImmutable o) { + if ( ! ( o instanceof GLCapabilitiesImmutable ) ) { Class<?> c = (null != o) ? o.getClass() : null ; - throw new ClassCastException("Not a GLCapabilities object: " + c); + throw new ClassCastException("Not a GLCapabilitiesImmutable object, but " + c); } + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) o; - final GLCapabilities caps = (GLCapabilities) o; + if(hardwareAccelerated && !caps.getHardwareAccelerated()) { + return 1; + } else if(!hardwareAccelerated && caps.getHardwareAccelerated()) { + return -1; + } - if(hardwareAccelerated && !caps.hardwareAccelerated) { + if(stereo && !caps.getStereo()) { return 1; - } else if(!hardwareAccelerated && caps.hardwareAccelerated) { + } else if(!stereo && caps.getStereo()) { return -1; } - if(stereo && !caps.stereo) { + if(doubleBuffered && !caps.getDoubleBuffered()) { return 1; - } else if(!stereo && caps.stereo) { + } else if(!doubleBuffered && caps.getDoubleBuffered()) { return -1; } final int ms = sampleBuffers ? numSamples : 0; - final int xms = caps.sampleBuffers ? caps.numSamples : 0; + final int xms = caps.getSampleBuffers() ? caps.getNumSamples() : 0; if(ms > xms) { return 1; } else if( ms < xms ) { return -1; } - // ignore the sample extension + // ignore the sample extension - if(stencilBits > caps.stencilBits) { + if(stencilBits > caps.getStencilBits()) { return 1; - } else if(stencilBits < caps.stencilBits) { + } else if(stencilBits < caps.getStencilBits()) { return -1; } @@ -190,16 +201,17 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil return sc; } - if(depthBits > caps.depthBits) { + if(depthBits > caps.getDepthBits()) { return 1; - } else if(depthBits < caps.depthBits) { + } else if(depthBits < caps.getDepthBits()) { return -1; } return 0; // they are equal: hw/sw, stereo, multisample, stencil, RGBA and depth } - public GLProfile getGLProfile() { + @Override + public final GLProfile getGLProfile() { return glProfile; } @@ -208,11 +220,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil glProfile=profile; } - public boolean isPBuffer() { + @Override + public final boolean isPBuffer() { return pbuffer; } - /** + /** * Enables or disables pbuffer usage.<br> * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)}<br> * Defaults to false. @@ -229,6 +242,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * If enabled this method also invokes {@link #setPBuffer(int) setPBuffer(false)}<br> * Defaults to true. */ + @Override public void setOnscreen(boolean onscreen) { if(onscreen) { setPBuffer(false); @@ -236,7 +250,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil super.setOnscreen(onscreen); } - public boolean getDoubleBuffered() { + @Override + public final boolean getDoubleBuffered() { return doubleBuffered; } @@ -245,25 +260,28 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil doubleBuffered = enable; } - public boolean getStereo() { + @Override + public final boolean getStereo() { return stereo; } - + /** Enables or disables stereo viewing. */ public void setStereo(boolean enable) { stereo = enable; } - public boolean getHardwareAccelerated() { + @Override + public final boolean getHardwareAccelerated() { return hardwareAccelerated; } - + /** Enables or disables hardware acceleration. */ public void setHardwareAccelerated(boolean enable) { hardwareAccelerated = enable; } - public int getDepthBits() { + @Override + public final int getDepthBits() { return depthBits; } @@ -271,8 +289,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public void setDepthBits(int depthBits) { this.depthBits = depthBits; } - - public int getStencilBits() { + + @Override + public final int getStencilBits() { return stencilBits; } @@ -280,8 +299,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public void setStencilBits(int stencilBits) { this.stencilBits = stencilBits; } - - public int getAccumRedBits() { + + @Override + public final int getAccumRedBits() { return accumRedBits; } @@ -293,7 +313,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumRedBits = accumRedBits; } - public int getAccumGreenBits() { + @Override + public final int getAccumGreenBits() { return accumGreenBits; } @@ -305,7 +326,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumGreenBits = accumGreenBits; } - public int getAccumBlueBits() { + @Override + public final int getAccumBlueBits() { return accumBlueBits; } @@ -317,7 +339,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumBlueBits = accumBlueBits; } - public int getAccumAlphaBits() { + @Override + public final int getAccumAlphaBits() { return accumAlphaBits; } @@ -333,14 +356,15 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Sets the desired extension for full-scene antialiasing * (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}. */ - public void setSampleExtension(String se) { - sampleExtension = se; + public void setSampleExtension(String se) { + sampleExtension = se; } - - public String getSampleExtension() { - return sampleExtension; + + @Override + public final String getSampleExtension() { + return sampleExtension; } - + /** * Defaults to false.<br> * Indicates whether sample buffers for full-scene antialiasing @@ -353,10 +377,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil sampleBuffers = enable; if(sampleBuffers && getAlphaBits()==0) { setAlphaBits(1); - } + } } - public boolean getSampleBuffers() { + @Override + public final boolean getSampleBuffers() { return sampleBuffers; } @@ -366,7 +391,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.numSamples = numSamples; } - public int getNumSamples() { + @Override + public final int getNumSamples() { return numSamples; } @@ -376,7 +402,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferFloatingPointBuffers = enable; } - public boolean getPbufferFloatingPointBuffers() { + @Override + public final boolean getPbufferFloatingPointBuffers() { return pbufferFloatingPointBuffers; } @@ -386,7 +413,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferRenderToTexture = enable; } - public boolean getPbufferRenderToTexture() { + @Override + public final boolean getPbufferRenderToTexture() { return pbufferRenderToTexture; } @@ -397,10 +425,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferRenderToTextureRectangle = enable; } - public boolean getPbufferRenderToTextureRectangle() { + @Override + public final boolean getPbufferRenderToTextureRectangle() { return pbufferRenderToTextureRectangle; } + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); @@ -441,12 +471,13 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil sink.append(", pixmap"); } } - + return sink; } /** Returns a textual representation of this GLCapabilities - object. */ + object. */ + @Override public String toString() { StringBuilder msg = new StringBuilder(); msg.append("GLCaps["); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index f813edf86..70a570174 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -37,17 +37,17 @@ import javax.media.opengl.GLProfile; public class EGLGLCapabilities extends GLCapabilities { private long eglcfg; final private int eglcfgid; - final private int renderableType; + final private int renderableType; final private int nativeVisualID; - + /** - * + * * @param eglcfg * @param eglcfgid * @param visualID native visualID if valid, otherwise VisualIDHolder.VID_UNDEFINED * @param glp desired GLProfile, or null if determined by renderableType * @param renderableType actual EGL renderableType - * + * * May throw GLException if given GLProfile is not compatible w/ renderableType */ public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) { @@ -62,10 +62,12 @@ public class EGLGLCapabilities extends GLCapabilities { this.nativeVisualID = visualID; } + @Override public Object cloneMutable() { return clone(); } + @Override public Object clone() { try { return super.clone(); @@ -73,13 +75,13 @@ public class EGLGLCapabilities extends GLCapabilities { throw new GLException(e); } } - + final protected void setEGLConfig(long v) { eglcfg=v; } final public long getEGLConfig() { return eglcfg; } final public int getEGLConfigID() { return eglcfgid; } final public int getRenderableType() { return renderableType; } final public int getNativeVisualID() { return nativeVisualID; } - + @Override final public int getVisualID(VIDType type) throws NativeWindowException { switch(type) { @@ -90,9 +92,9 @@ public class EGLGLCapabilities extends GLCapabilities { return getNativeVisualID(); default: throw new NativeWindowException("Invalid type <"+type+">"); - } + } } - + public static boolean isCompatible(GLProfile glp, int renderableType) { if(null == glp) { return true; @@ -121,7 +123,7 @@ public class EGLGLCapabilities extends GLCapabilities { } return null; } - + public static StringBuilder renderableTypeToString(StringBuilder sink, int renderableType) { if(null == sink) { sink = new StringBuilder(); @@ -139,9 +141,10 @@ public class EGLGLCapabilities extends GLCapabilities { if(0 != (renderableType & EGL.EGL_OPENVG_API)) { if(!first) sink.append(", "); sink.append("VG"); first=false; } - return sink; + return sink; } - + + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index 5ff63d93b..e255a0672 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -119,7 +119,7 @@ public class WGLGLCapabilities extends GLCapabilities { if (iresults[i] == WGLExt.WGL_TYPE_RGBA_FLOAT_ARB) { setPbufferFloatingPointBuffers(true); } - + // normal RGBA FB: WGLExt.WGL_TYPE_RGBA_ARB // ignore unknown results here break; @@ -177,10 +177,12 @@ public class WGLGLCapabilities extends GLCapabilities { return true; } + @Override public Object cloneMutable() { return clone(); } + @Override public Object clone() { try { return super.clone(); @@ -191,11 +193,11 @@ public class WGLGLCapabilities extends GLCapabilities { final public PIXELFORMATDESCRIPTOR getPFD() { return pfd; } final public int getPFDID() { return pfdID; } - + final public boolean isSetByARB() { return 0 < arb_pixelformat; } final public boolean isSetByGDI() { return 0 > arb_pixelformat; } final public boolean isSet() { return 0 != arb_pixelformat; } - + @Override final public int getVisualID(VIDType type) throws NativeWindowException { switch(type) { @@ -205,16 +207,17 @@ public class WGLGLCapabilities extends GLCapabilities { return getPFDID(); default: throw new NativeWindowException("Invalid type <"+type+">"); - } + } } - + + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); } sink.append("wgl vid 0x").append(Integer.toHexString(pfdID)).append(" "); switch (arb_pixelformat) { - case -1: + case -1: sink.append("gdi"); break; case 0: diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index 96d4c7713..e0b69ffd4 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -55,10 +55,12 @@ public class X11GLCapabilities extends GLCapabilities { this.fbcfgid = VisualIDHolder.VID_UNDEFINED; } + @Override public Object cloneMutable() { return clone(); } + @Override public Object clone() { try { return super.clone(); @@ -86,9 +88,10 @@ public class X11GLCapabilities extends GLCapabilities { return getFBConfigID(); default: throw new NativeWindowException("Invalid type <"+type+">"); - } + } } - + + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java index b422f50e6..196f23598 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java +++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.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. */ @@ -44,7 +44,7 @@ package javax.media.nativewindow; must support, such as color depth per channel. It currently contains the minimal number of routines which allow configuration on all supported window systems. */ -public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparable { +public class Capabilities implements CapabilitiesImmutable, Cloneable { protected final static String na_str = "----" ; private int redBits = 8; @@ -67,10 +67,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl */ public Capabilities() {} + @Override public Object cloneMutable() { return clone(); } - + + @Override public Object clone() { try { return super.clone(); @@ -79,6 +81,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl } } + @Override public int hashCode() { // 31 * x == (x << 5) - x int hash = 31 + this.redBits; @@ -94,6 +97,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl return hash; } + @Override public boolean equals(Object obj) { if(this == obj) { return true; } if(!(obj instanceof CapabilitiesImmutable)) { @@ -116,20 +120,23 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl return res; } - /** comparing RGBA values only */ - public int compareTo(Object o) { - if ( ! ( o instanceof Capabilities ) ) { + /** + * Comparing RGBA values only + **/ + @Override + public int compareTo(final CapabilitiesImmutable caps) { + /** + if ( ! ( o instanceof CapabilitiesImmutable ) ) { Class<?> c = (null != o) ? o.getClass() : null ; - throw new ClassCastException("Not a Capabilities object: " + c); + throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c); } - - final Capabilities caps = (Capabilities) o; - + final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */ + final int a = ( alphaBits > 0 ) ? alphaBits : 1; final int rgba = redBits * greenBits * blueBits * a; - final int xa = ( caps.alphaBits ) > 0 ? caps.alphaBits : 1; - final int xrgba = caps.redBits * caps.greenBits * caps.blueBits * xa; + final int xa = ( caps.getAlphaBits() ) > 0 ? caps.getAlphaBits() : 1; + final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * xa; if(rgba > xrgba) { return 1; @@ -148,13 +155,14 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl return VisualIDHolder.VID_UNDEFINED; default: throw new NativeWindowException("Invalid type <"+type+">"); - } + } } - + /** Returns the number of bits requested for the color buffer's red component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public int getRedBits() { + @Override + public final int getRedBits() { return redBits; } @@ -168,7 +176,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl /** Returns the number of bits requested for the color buffer's green component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public int getGreenBits() { + @Override + public final int getGreenBits() { return greenBits; } @@ -182,7 +191,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl /** Returns the number of bits requested for the color buffer's blue component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public int getBlueBits() { + @Override + public final int getBlueBits() { return blueBits; } @@ -192,11 +202,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl public void setBlueBits(int blueBits) { this.blueBits = blueBits; } - + /** Returns 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. */ - public int getAlphaBits() { + @Override + public final int getAlphaBits() { return alphaBits; } @@ -207,36 +218,36 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl this.alphaBits = alphaBits; } - /** - * Defaults to true, ie. opaque surface. - * <p> - * On supported platforms, setting opaque to false may result in a translucent surface. </p> - * - * <p> - * Platform implementations may need an alpha component in the surface (eg. Windows), - * or expect pre-multiplied alpha values (eg. X11/XRender).<br> - * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} - * if {@link #getAlphaBits()} == 0.<br> - * Please note that in case alpha is required on the platform the - * clear color shall have an alpha lower than 1.0 to allow anything shining through. - * </p> - * - * <p> - * Mind that translucency may cause a performance penalty - * due to the composite work required by the window manager.</p> - * - * <p> - * The platform implementation may utilize the transparency RGBA values.<br> - * This is true for the original GLX transparency specification, which is no more used today.<br> - * Actually these values are currently not used by any implementation, - * so we may mark them deprecated soon, if this doesn't change.<br> - * </p> - */ + /** + * Defaults to true, ie. opaque surface. + * <p> + * On supported platforms, setting opaque to false may result in a translucent surface. </p> + * + * <p> + * Platform implementations may need an alpha component in the surface (eg. Windows), + * or expect pre-multiplied alpha values (eg. X11/XRender).<br> + * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} + * if {@link #getAlphaBits()} == 0.<br> + * Please note that in case alpha is required on the platform the + * clear color shall have an alpha lower than 1.0 to allow anything shining through. + * </p> + * + * <p> + * Mind that translucency may cause a performance penalty + * due to the composite work required by the window manager.</p> + * + * <p> + * The platform implementation may utilize the transparency RGBA values.<br> + * This is true for the original GLX transparency specification, which is no more used today.<br> + * Actually these values are currently not used by any implementation, + * so we may mark them deprecated soon, if this doesn't change.<br> + * </p> + */ public void setBackgroundOpaque(boolean opaque) { - backgroundOpaque = opaque; - if(!opaque && getAlphaBits()==0) { - setAlphaBits(1); - } + backgroundOpaque = opaque; + if(!opaque && getAlphaBits()==0) { + setAlphaBits(1); + } } /** Indicates whether the background of this OpenGL context should @@ -244,7 +255,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl @see #setBackgroundOpaque */ - public boolean isBackgroundOpaque() { + @Override + public final boolean isBackgroundOpaque() { return backgroundOpaque; } @@ -258,7 +270,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl /** Indicates whether the drawable surface is onscreen. Defaults to true. */ - public boolean isOnscreen() { + @Override + public final boolean isOnscreen() { return onscreen; } @@ -266,25 +279,29 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl * This value is undefined if {@link #isBackgroundOpaque()} equals true. * @see #setTransparentRedValue */ - public int getTransparentRedValue() { return transparentValueRed; } + @Override + public final int getTransparentRedValue() { return transparentValueRed; } /** Gets the transparent green value for the frame buffer configuration. * This value is undefined if {@link #isBackgroundOpaque()} equals true. * @see #setTransparentGreenValue */ - public int getTransparentGreenValue() { return transparentValueGreen; } + @Override + public final int getTransparentGreenValue() { return transparentValueGreen; } /** Gets the transparent blue value for the frame buffer configuration. * This value is undefined if {@link #isBackgroundOpaque()} equals true. * @see #setTransparentBlueValue */ - public int getTransparentBlueValue() { return transparentValueBlue; } + @Override + public final int getTransparentBlueValue() { return transparentValueBlue; } /** Gets the transparent alpha value for the frame buffer configuration. * This value is undefined if {@link #isBackgroundOpaque()} equals true. * @see #setTransparentAlphaValue */ - public int getTransparentAlphaValue() { return transparentValueAlpha; } + @Override + public final int getTransparentAlphaValue() { return transparentValueAlpha; } /** Sets the transparent red value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for red. @@ -314,6 +331,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl A value of -1 is interpreted as any value. */ public void setTransparentAlphaValue(int transValueAlpha) { transparentValueAlpha=transValueAlpha; } + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); @@ -334,7 +352,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl protected final String toHexString(int val) { return Integer.toHexString(val); } /** Returns a textual representation of this Capabilities - object. */ + object. */ + @Override public String toString() { StringBuilder msg = new StringBuilder(); msg.append("Caps["); @@ -342,5 +361,4 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl msg.append("]"); return msg.toString(); } - } diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java index 3d7362c40..b984a4626 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java @@ -33,10 +33,10 @@ import com.jogamp.common.type.WriteCloneable; /** * Specifies an immutable set of capabilities that a window's rendering context * must support, such as color depth per channel. - * + * * @see javax.media.nativewindow.Capabilities */ -public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable { +public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, Comparable<CapabilitiesImmutable> { /** * Returns the number of bits requested for the color buffer's red diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java index 0e69c738f..4f8cff8c5 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java @@ -40,10 +40,12 @@ public class X11Capabilities extends Capabilities { this.xVisualInfo = xVisualInfo; } + @Override public Object cloneMutable() { return clone(); } + @Override public Object clone() { try { return super.clone(); @@ -68,9 +70,10 @@ public class X11Capabilities extends Capabilities { return VisualIDHolder.VID_UNDEFINED; default: throw new NativeWindowException("Invalid type <"+type+">"); - } + } } - + + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); |