From 006f0ffdc63c35b0aed229b626db00c358c9399f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 24 Aug 2011 01:54:31 +0200 Subject: Cleanup: Java Generics Use and Removed Unused Methods --- .../javax/media/opengl/GLDrawableFactory.java | 8 +++--- src/jogl/classes/javax/media/opengl/GLProfile.java | 30 +++++++++++----------- .../jogamp/opengl/egl/EGLDrawableFactory.java | 2 +- .../egl/EGLGraphicsConfigurationFactory.java | 2 +- .../macosx/cgl/MacOSXCGLDrawableFactory.java | 4 +-- .../windows/wgl/WindowsWGLDrawableFactory.java | 2 +- .../wgl/WindowsWGLGraphicsConfiguration.java | 16 ++++++------ .../WindowsWGLGraphicsConfigurationFactory.java | 12 ++++----- .../opengl/x11/glx/X11GLXDrawableFactory.java | 2 +- .../glx/X11GLXGraphicsConfigurationFactory.java | 12 ++++----- 10 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 1340b661d..9bb9480c7 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -96,7 +96,7 @@ public abstract class GLDrawableFactory { static final String macosxFactoryClassNameCGL = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory"; static final String macosxFactoryClassNameAWTCGL = "jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory"; - protected static ArrayList/**/ glDrawableFactories = new ArrayList(); + protected static ArrayList glDrawableFactories = new ArrayList(); // Shutdown hook mechanism for the factory private static boolean factoryShutdownHookRegistered = false; @@ -197,7 +197,7 @@ public abstract class GLDrawableFactory { private static void shutdownImpl() { synchronized(glDrawableFactories) { for(int i=0; inull for the platform's default device. * @return A list of {@link javax.media.opengl.GLCapabilitiesImmutable}'s, maybe empty if none is available. */ - public final List/*GLCapabilitiesImmutable*/ getAvailableCapabilities(AbstractGraphicsDevice device) { + public final List getAvailableCapabilities(AbstractGraphicsDevice device) { device = validateDevice(device); if(null!=device) { return getAvailableCapabilitiesImpl(device); } return null; } - protected abstract List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device); + protected abstract List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device); //---------------------------------------------------------------------- // Methods to create high-level objects diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 0f502ce32..1fd699dfd 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -153,7 +153,6 @@ public class GLProfile { * @return true if the profile is available for the device, otherwise false. */ public static boolean isAvailable(AbstractGraphicsDevice device, String profile) { - HashMap profileMap = null; try { return null != getProfileMap(device).get(profile); } catch (GLException gle) { /* profiles for device n/a */ } @@ -246,13 +245,13 @@ public class GLProfile { } sb.append("], Profiles["); - HashMap profileMap = null; + HashMap profileMap = null; try { profileMap = getProfileMap(device); } catch (GLException gle) { /* profiles for device n/a */ } if(null != profileMap) { - for(Iterator i=profileMap.values().iterator(); i.hasNext(); ) { - sb.append(((GLProfile)i.next()).toString()); + for(Iterator i=profileMap.values().iterator(); i.hasNext(); ) { + sb.append(i.next().toString()); sb.append(", "); } sb.append(", default "); @@ -610,8 +609,8 @@ public class GLProfile { if(null==profile || profile.equals("GL")) { profile = GL_DEFAULT; } - final HashMap glpMap = getProfileMap(device); - final GLProfile glp = (GLProfile) glpMap.get(profile); + final HashMap glpMap = getProfileMap(device); + final GLProfile glp = glpMap.get(profile); if(null == glp) { throw new GLException("Profile "+profile+" is not available on "+device+", but: "+glpMap.values()); } @@ -640,10 +639,10 @@ public class GLProfile { public static GLProfile get(AbstractGraphicsDevice device, String[] profiles) throws GLException { - HashMap map = getProfileMap(device); + HashMap map = getProfileMap(device); for(int i=0; i()); // empty if(DEBUG) { System.err.println("GLProfile: device could not be initialized: "+device); System.err.println("GLProfile: compatible w/ desktop: "+deviceIsDesktopCompatible+ @@ -1393,13 +1392,13 @@ public class GLProfile { System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": "+glAvailabilityToString(device)); if(addedDesktopProfile) { dumpGLInfo(desktopFactory, device); - List/**/ availCaps = desktopFactory.getAvailableCapabilities(device); + List availCaps = desktopFactory.getAvailableCapabilities(device); for(int i=0; i*/ availCaps = eglFactory.getAvailableCapabilities(device); + List availCaps = eglFactory.getAvailableCapabilities(device); for(int i=0; i*/ deviceConn2ProfileMap = new HashMap(); + private static /*final*/ HashMap> deviceConn2ProfileMap = + new HashMap>(); /** * This implementation support lazy initialization, while avoiding recursion/deadlocks.
@@ -1599,13 +1599,13 @@ public class GLProfile { * @return the GLProfile HashMap if exists, otherwise null * @throws GLException if no profile for the given device is available. */ - private static HashMap getProfileMap(AbstractGraphicsDevice device) throws GLException { + private static HashMap getProfileMap(AbstractGraphicsDevice device) throws GLException { validateInitialization(); if(null==device) { device = defaultDevice; } String deviceKey = device.getUniqueID(); - HashMap map = (HashMap) deviceConn2ProfileMap.get(deviceKey); + HashMap map = deviceConn2ProfileMap.get(deviceKey); if( null == map ) { if( !initProfilesForDevice(device) ) { throw new GLException("No Profile available for "+device); @@ -1617,7 +1617,7 @@ public class GLProfile { return map; } - private static void setProfileMap(AbstractGraphicsDevice device, HashMap/**/mappedProfiles) { + private static void setProfileMap(AbstractGraphicsDevice device, HashMap mappedProfiles) { validateInitialization(); synchronized ( deviceConn2ProfileMap ) { deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index e0283abd7..3523b24f3 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -241,7 +241,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected final void shutdownInstance() {} - protected List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { return EGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 3154818db..9e06644fa 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -100,7 +100,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact absScreen); } - protected static List/**/ getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { EGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResource(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 3a0f28352..90232457c 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -132,8 +132,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected final void shutdownInstance() {} - protected List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { - return new ArrayList(0); + protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + return new ArrayList(0); } protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index f8ba8d277..b7941c3bb 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -414,7 +414,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { RegisteredClassFactory.shutdownSharedClasses(); } - protected List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { return WindowsWGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 8859d636a..a82a7a38c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -299,10 +299,10 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format " + pfdID + " of device context " + toHexString(hdc) + ", werr " + GDI.GetLastError()); } - ArrayList bucket = new ArrayList(1); + ArrayList bucket = new ArrayList(1); final int winattrbits = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer); if(AttribList2GLCapabilities(bucket, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits)) { - return (WGLGLCapabilities) bucket.get(0); + return bucket.get(0); } return null; } @@ -376,7 +376,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio int[] iresults = new int [2*MAX_ATTRIBS]; int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes); - ArrayList bucket = new ArrayList(); + ArrayList bucket = new ArrayList(); for(int i = 0; i= 1 && @@ -578,7 +578,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio return val; } - static boolean AttribList2GLCapabilities( ArrayList capsBucket, + static boolean AttribList2GLCapabilities( ArrayList capsBucket, final GLProfile glp, final long hdc, final int pfdID, final int[] iattribs, final int niattribs, final int[] iresults, final int winattrmask) { @@ -590,7 +590,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); - if (GDI.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) { + if (GDI.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) { // remove displayable bits, since pfdID is non displayable drawableTypeBits = drawableTypeBits & ~(GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT); if( 0 == drawableTypeBits ) { @@ -637,14 +637,14 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio static WGLGLCapabilities PFD2GLCapabilities(GLProfile glp, long hdc, int pfdID, boolean onscreen) { final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, false); - ArrayList capsBucket = new ArrayList(1); + ArrayList capsBucket = new ArrayList(1); if( PFD2GLCapabilities(capsBucket, glp, hdc, pfdID, winattrmask) ) { - return (WGLGLCapabilities) capsBucket.get(0); + return capsBucket.get(0); } return null; } - static boolean PFD2GLCapabilities(ArrayList capsBucket, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { + static boolean PFD2GLCapabilities(ArrayList capsBucket, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); if(null == pfd) { return false; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index d765572a6..1c607d2c7 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -105,7 +105,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return new WindowsWGLGraphicsConfiguration( absScreen, capsChosen, capsReq, (GLCapabilitiesChooser)chooser ); } - protected static List/**/ getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) { WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResource(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -113,7 +113,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat WindowsWGLDrawable sharedDrawable = sharedResource.getDrawable(); GLCapabilitiesImmutable capsChosen = sharedDrawable.getChosenGLCapabilities(); WindowsWGLContext sharedContext = sharedResource.getContext(); - List availableCaps = null; + List/**/ availableCaps = null; if ( sharedResource.needsCurrentContext4ARBPFDQueries() ) { if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { @@ -147,15 +147,15 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return availableCaps; } - static List/**/ getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) { + static List/**/ getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) { int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFIDs(sharedResource.getContext(), hdc); return WindowsWGLGraphicsConfiguration.wglARBPFIDs2AllGLCapabilities(sharedResource, hdc, pformats, glProfile); } - static List/**/ getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) { + static List/**/ getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) { int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); int numFormats = pformats.length; - ArrayList bucket = new ArrayList(numFormats); + ArrayList bucket = new ArrayList(numFormats); for (int i = 0; i < numFormats; i++) { WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(bucket, glProfile, hdc, pformats[i], GLGraphicsConfigurationUtil.ALL_BITS); } @@ -391,7 +391,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if( null == pixelFormatCaps) { throw new GLException("Null Capabilities with "+ " chosen pfdID: native recommended "+ (recommendedIndex+1) + - " chosen "+pixelFormatCaps.getPFDID()); + " chosen idx "+chosenIndex); } if (DEBUG) { System.err.println("!!! chosen pfdID (ARB): native recommended "+ (recommendedIndex+1) + diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 1caf1e24b..39bcd2f37 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -338,7 +338,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { X11Util.shutdown( false, DEBUG ); } - protected List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index e167c1467..03d676ec9 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -96,7 +96,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen); } - protected static List/**/ getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResource(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -106,7 +106,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF GLCapabilitiesImmutable capsChosen = sharedDrawable.getChosenGLCapabilities(); GLProfile glp = capsChosen.getGLProfile(); - List/*GLCapabilitiesImmutable*/ availableCaps = null; + List availableCaps = null; if( sharedResource.isGLXVersionGreaterEqualOneThree() ) { availableCaps = getAvailableGLCapabilitiesFBConfig(sharedScreen, glp); @@ -120,7 +120,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List/**/ getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile) { + static List getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile) { PointerBuffer fbcfgsL = null; // Utilizing FBConfig @@ -131,7 +131,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF int screen = x11Screen.getIndex(); boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display); int[] count = { -1 }; - ArrayList availableCaps = new ArrayList(); + ArrayList availableCaps = new ArrayList(); fbcfgsL = GLX.glXChooseFBConfig(display, screen, null, 0, count, 0); if (fbcfgsL == null || fbcfgsL.limit()<=0) { @@ -150,7 +150,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List/**/ getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile) { + static List getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile) { AbstractGraphicsDevice absDevice = x11Screen.getDevice(); long display = absDevice.getHandle(); @@ -164,7 +164,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } - ArrayList availableCaps = new ArrayList(); + ArrayList availableCaps = new ArrayList(); for (int i = 0; i < infos.length; i++) { if( !X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(availableCaps, glProfile, display, infos[i], GLGraphicsConfigurationUtil.ALL_BITS, isMultisampleAvailable) ) { if(DEBUG) { -- cgit v1.2.3