diff options
16 files changed, 101 insertions, 122 deletions
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/*<GLDrawableFactoryImpl>*/ glDrawableFactories = new ArrayList(); + protected static ArrayList<GLDrawableFactory> glDrawableFactories = new ArrayList<GLDrawableFactory>(); // 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; i<glDrawableFactories.size(); i++) { - GLDrawableFactory factory = (GLDrawableFactory) glDrawableFactories.get(i); + GLDrawableFactory factory = glDrawableFactories.get(i); factory.shutdownInstance(); } glDrawableFactories.clear(); @@ -340,14 +340,14 @@ public abstract class GLDrawableFactory { * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. * @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<GLCapabilitiesImmutable> getAvailableCapabilities(AbstractGraphicsDevice device) { device = validateDevice(device); if(null!=device) { return getAvailableCapabilitiesImpl(device); } return null; } - protected abstract List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device); + protected abstract List<GLCapabilitiesImmutable> 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<String /*GLProfile_name*/, GLProfile> 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<GLProfile> 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<String /*GLProfile_name*/, GLProfile> 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<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device); for(int i=0; i<profiles.length; i++) { String profile = profiles[i]; - GLProfile glProfile = (GLProfile) map.get(profile); + GLProfile glProfile = map.get(profile); if(null!=glProfile) { return glProfile; } @@ -1372,7 +1371,7 @@ public class GLProfile { } addedEGLProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */); } else { - setProfileMap(device, new HashMap()); // empty + setProfileMap(device, new HashMap<String /*GLProfile_name*/, GLProfile>()); // 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/*<GLCapabilitiesImmutable>*/ availCaps = desktopFactory.getAvailableCapabilities(device); + List<GLCapabilitiesImmutable> availCaps = desktopFactory.getAvailableCapabilities(device); for(int i=0; i<availCaps.size(); i++) { System.err.println(availCaps.get(i)); } } else if(addedEGLProfile) { dumpGLInfo(eglFactory, device); - List/*<GLCapabilitiesImmutable>*/ availCaps = eglFactory.getAvailableCapabilities(device); + List<GLCapabilitiesImmutable> availCaps = eglFactory.getAvailableCapabilities(device); for(int i=0; i<availCaps.size(); i++) { System.err.println(availCaps.get(i)); } @@ -1587,7 +1586,8 @@ public class GLProfile { } } - private static /*final*/ HashMap/*<device_connection, HashMap<GL-String, GLProfile>*/ deviceConn2ProfileMap = new HashMap(); + private static /*final*/ HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>> deviceConn2ProfileMap = + new HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>>(); /** * This implementation support lazy initialization, while avoiding recursion/deadlocks.<br> @@ -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<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device) throws GLException { validateInitialization(); if(null==device) { device = defaultDevice; } String deviceKey = device.getUniqueID(); - HashMap map = (HashMap) deviceConn2ProfileMap.get(deviceKey); + HashMap<String /*GLProfile_name*/, GLProfile> 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/*<GL-String, GLProfile>*/mappedProfiles) { + private static void setProfileMap(AbstractGraphicsDevice device, HashMap<String /*GLProfile_name*/, GLProfile> 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<GLCapabilitiesImmutable> 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/*<EGLGLCapabilities>*/ getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List<GLCapabilitiesImmutable> 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<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + return new ArrayList<GLCapabilitiesImmutable>(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<GLCapabilitiesImmutable> 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<WGLGLCapabilities> bucket = new ArrayList<WGLGLCapabilities>(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<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(); for(int i = 0; i<numFormats; i++) { if ( pfdIDs[i] >= 1 && @@ -578,7 +578,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio return val; } - static boolean AttribList2GLCapabilities( ArrayList capsBucket, + static boolean AttribList2GLCapabilities( ArrayList<? extends GLCapabilitiesImmutable> 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<WGLGLCapabilities> capsBucket = new ArrayList<WGLGLCapabilities>(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<? extends GLCapabilitiesImmutable> 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/*<WGLGLCapabilities>*/ getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List<GLCapabilitiesImmutable> 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/*<GLCapabilitiesImmutable>*/ 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/*<WGLGLCapabilities>*/ getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) { + static List/*<GLCapabilitiesImmutable>*/ getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) { int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFIDs(sharedResource.getContext(), hdc); return WindowsWGLGraphicsConfiguration.wglARBPFIDs2AllGLCapabilities(sharedResource, hdc, pformats, glProfile); } - static List/*<WGLGLCapabilities>*/ getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) { + static List/*<GLCapabilitiesImmutable>*/ getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) { int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); int numFormats = pformats.length; - ArrayList bucket = new ArrayList(numFormats); + ArrayList<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(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<GLCapabilitiesImmutable> 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/*<X11GLCapabilities>*/ getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List<GLCapabilitiesImmutable> 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<GLCapabilitiesImmutable> availableCaps = null; if( sharedResource.isGLXVersionGreaterEqualOneThree() ) { availableCaps = getAvailableGLCapabilitiesFBConfig(sharedScreen, glp); @@ -120,7 +120,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List/*<X11GLCapabilities>*/ getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile) { + static List<GLCapabilitiesImmutable> 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<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); 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/*<X11GLCapabilities>*/ getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile) { + static List<GLCapabilitiesImmutable> 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<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); for (int i = 0; i < infos.length; i++) { if( !X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(availableCaps, glProfile, display, infos[i], GLGraphicsConfigurationUtil.ALL_BITS, isMultisampleAvailable) ) { if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index f879449b9..6a0ebe14a 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -146,15 +146,15 @@ public abstract class Display { public abstract void dispatchMessages(); // Global Displays - protected static ArrayList displayList = new ArrayList(); + protected static ArrayList<Display> displayList = new ArrayList<Display>(); protected static int displaysActive = 0; public static void dumpDisplayList(String prefix) { synchronized(displayList) { - Iterator i = displayList.iterator(); + Iterator<Display> i = displayList.iterator(); System.err.println(prefix+" DisplayList[] entries: "+displayList.size()+" - "+getThreadName()); for(int j=0; i.hasNext(); j++) { - DisplayImpl d = (DisplayImpl) i.next(); + Display d = i.next(); System.err.println(" ["+j+"] : "+d); } } @@ -198,10 +198,10 @@ public abstract class Display { } /** Returns the global display collection */ - public static Collection getAllDisplays() { - ArrayList list; + public static Collection<Display> getAllDisplays() { + ArrayList<Display> list; synchronized(displayList) { - list = (ArrayList) displayList.clone(); + list = (ArrayList<Display>) displayList.clone(); } return list; } diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index cd44df154..62da8c978 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -52,8 +52,8 @@ public class NewtFactory { WindowImpl.init(NativeWindowFactory.getNativeWindowType(true)); } - public static Class getCustomClass(String packageName, String classBaseName) { - Class clazz = null; + public static Class<?> getCustomClass(String packageName, String classBaseName) { + Class<?> clazz = null; if(packageName!=null || classBaseName!=null) { String clazzName = packageName + "." + classBaseName ; try { @@ -218,17 +218,6 @@ public class NewtFactory { return DisplayImpl.create(type, null, handle, false); } - private static boolean instanceOf(Object obj, String clazzName) { - Class clazz = obj.getClass(); - do { - if(clazz.getName().equals(clazzName)) { - return true; - } - clazz = clazz.getSuperclass(); - } while (clazz!=null); - return false; - } - public static boolean isScreenCompatible(NativeWindow parent, Screen childScreen) { // Get parent's NativeWindow details AbstractGraphicsConfiguration parentConfig = (AbstractGraphicsConfiguration) parent.getGraphicsConfiguration(); diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index fec3613a2..c6943ff22 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -155,7 +155,7 @@ public abstract class Screen { * @return a shallow copy of the internal immutable {@link com.jogamp.newt.ScreenMode}s, * or null if not implemented for this native type {@link com.jogamp.newt.Display#getType()}. */ - public abstract List/*<ScreenMode>*/ getScreenModes(); + public abstract List<ScreenMode> getScreenModes(); /** * Return the original {@link com.jogamp.newt.ScreenMode}, as used at NEWT initialization. @@ -180,7 +180,7 @@ public abstract class Screen { public abstract boolean setCurrentScreenMode(ScreenMode screenMode); // Global Screens - protected static ArrayList screenList = new ArrayList(); + protected static ArrayList<Screen> screenList = new ArrayList<Screen>(); protected static int screensActive = 0; /** @@ -220,10 +220,10 @@ public abstract class Screen { return null; } /** Returns the global display collection */ - public static Collection getAllScreens() { - ArrayList list; + public static Collection<Screen> getAllScreens() { + ArrayList<Screen> list; synchronized(screenList) { - list = (ArrayList) screenList.clone(); + list = (ArrayList<Screen>) screenList.clone(); } return list; } diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 1cc2298ed..f477cd3fc 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -39,7 +39,6 @@ import java.util.List; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.VersionUtil; -import com.jogamp.nativewindow.NativeWindowVersion; import com.jogamp.newt.*; import com.jogamp.newt.event.*; import jogamp.newt.WindowImpl; @@ -635,13 +634,6 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC return fpsCounter.getTotalFPS(); } - private class SwapBuffersAction implements Runnable { - public final void run() { - drawable.swapBuffers(); - } - } - private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); - //---------------------------------------------------------------------- // GLDrawable methods // @@ -872,13 +864,11 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC public static void main(String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); - // System.err.println(NativeWindowVersion.getInstance()); System.err.println(JoglVersion.getInstance()); - System.err.println(NewtVersion.getInstance()); final GLProfile glp = GLProfile.getDefault(); final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); - final List/*<GLCapabilitiesImmutable>*/ availCaps = factory.getAvailableCapabilities(null); + final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); for(int i=0; i<availCaps.size(); i++) { System.err.println(availCaps.get(i)); } diff --git a/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java b/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java index 6986e3657..93797c5fb 100644 --- a/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java @@ -66,13 +66,13 @@ public class ScreenModeUtil { */ public static final int NUM_SCREEN_MODE_PROPERTIES_ALL = 8; - public static int getIndex(List/*<ScreenMode>*/ screenModes, ScreenMode search) { + public static int getIndex(List<ScreenMode> screenModes, ScreenMode search) { return screenModes.indexOf(search); } - public static int getIndexByHashCode(List/*<ScreenMode>*/ screenModes, ScreenMode search) { + public static int getIndexByHashCode(List<ScreenMode> screenModes, ScreenMode search) { for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - if ( search.hashCode() == ((ScreenMode)screenModes.get(i)).hashCode() ) { + if ( search.hashCode() == screenModes.get(i).hashCode() ) { return i; } } @@ -84,16 +84,16 @@ public class ScreenModeUtil { * @param resolution * @return modes with nearest resolution, or matching ones */ - public static List/*<ScreenMode>*/ filterByResolution(List/*<ScreenMode>*/ screenModes, DimensionImmutable resolution) { + public static List<ScreenMode> filterByResolution(List<ScreenMode> screenModes, DimensionImmutable resolution) { if(null==screenModes || screenModes.size()==0) { return null; } - List out = new ArrayList(); + List<ScreenMode> out = new ArrayList<ScreenMode>(); int resolution_sq = resolution.getHeight()*resolution.getWidth(); int sm_dsq=resolution_sq, sm_dsq_idx=0; for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); DimensionImmutable res = sm.getMonitorMode().getSurfaceSize().getResolution(); int dsq = Math.abs(resolution_sq - res.getHeight()*res.getWidth()); if(dsq<sm_dsq) { @@ -108,17 +108,17 @@ public class ScreenModeUtil { return out; } // nearest .. - resolution = ((ScreenMode)screenModes.get(sm_dsq_idx)).getMonitorMode().getSurfaceSize().getResolution(); + resolution = screenModes.get(sm_dsq_idx).getMonitorMode().getSurfaceSize().getResolution(); return filterByResolution(screenModes, resolution); } - public static List/*<ScreenMode>*/ filterBySurfaceSize(List/*<ScreenMode>*/ screenModes, SurfaceSize surfaceSize) { + public static List<ScreenMode> filterBySurfaceSize(List<ScreenMode> screenModes, SurfaceSize surfaceSize) { if(null==screenModes || screenModes.size()==0) { return null; } - List out = new ArrayList(); + List<ScreenMode> out = new ArrayList<ScreenMode>(); for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); if(sm.getMonitorMode().getSurfaceSize().equals(surfaceSize)) { out.add(sm); } @@ -126,13 +126,13 @@ public class ScreenModeUtil { return out.size()>0 ? out : null; } - public static List/*<ScreenMode>*/ filterByRotation(List/*<ScreenMode>*/ screenModes, int rotation) { + public static List<ScreenMode> filterByRotation(List<ScreenMode> screenModes, int rotation) { if(null==screenModes || screenModes.size()==0) { return null; } - List out = new ArrayList(); + List<ScreenMode> out = new ArrayList<ScreenMode>(); for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); if(sm.getRotation() == rotation) { out.add(sm); } @@ -140,13 +140,13 @@ public class ScreenModeUtil { return out.size()>0 ? out : null; } - public static List/*<ScreenMode>*/ filterByBpp(List/*<ScreenMode>*/ screenModes, int bitsPerPixel) { + public static List<ScreenMode> filterByBpp(List<ScreenMode> screenModes, int bitsPerPixel) { if(null==screenModes || screenModes.size()==0) { return null; } - List out = new ArrayList(); + List<ScreenMode> out = new ArrayList<ScreenMode>(); for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); if(sm.getMonitorMode().getSurfaceSize().getBitsPerPixel() == bitsPerPixel) { out.add(sm); } @@ -160,15 +160,15 @@ public class ScreenModeUtil { * @param refreshRate * @return modes with nearest refreshRate, or matching ones */ - public static List/*<ScreenMode>*/ filterByRate(List/*<ScreenMode>*/ screenModes, int refreshRate) { + public static List<ScreenMode> filterByRate(List<ScreenMode> screenModes, int refreshRate) { if(null==screenModes || screenModes.size()==0) { return null; } int sm_dr = refreshRate; int sm_dr_idx = -1; - List out = new ArrayList(); + List<ScreenMode> out = new ArrayList<ScreenMode>(); for (int i=0; null!=screenModes && i<screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); int dr = Math.abs(refreshRate - sm.getMonitorMode().getRefreshRate()); if(dr<sm_dr) { sm_dr = dr; @@ -181,17 +181,17 @@ public class ScreenModeUtil { if(out.size()>0) { return out; } - refreshRate = ((ScreenMode)screenModes.get(sm_dr_idx)).getMonitorMode().getRefreshRate(); + refreshRate = screenModes.get(sm_dr_idx).getMonitorMode().getRefreshRate(); return filterByRate(screenModes, refreshRate); } - public static List/*<ScreenMode>*/ getHighestAvailableBpp(List/*<ScreenMode>*/ screenModes) { + public static List<ScreenMode> getHighestAvailableBpp(List<ScreenMode> screenModes) { if(null==screenModes || screenModes.size()==0) { return null; } int highest = -1; for (int i=0; null!=screenModes && i < screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); int bpp = sm.getMonitorMode().getSurfaceSize().getBitsPerPixel(); if (bpp > highest) { highest = bpp; @@ -200,13 +200,13 @@ public class ScreenModeUtil { return filterByBpp(screenModes, highest); } - public static List/*<ScreenMode>*/ getHighestAvailableRate(List/*<ScreenMode>*/ screenModes) { + public static List<ScreenMode> getHighestAvailableRate(List<ScreenMode> screenModes) { if(null==screenModes || screenModes.size()==0) { return null; } int highest = -1; for (int i=0; null!=screenModes && i < screenModes.size(); i++) { - ScreenMode sm = (ScreenMode)screenModes.get(i); + ScreenMode sm = screenModes.get(i); int rate = sm.getMonitorMode().getRefreshRate(); if (rate > highest) { highest = rate; @@ -254,7 +254,7 @@ public class ScreenModeUtil { /** * WARNING: must be synchronized with ScreenMode.h, native implementation * - * @param resolutionPool hash array of unique DimensionReadOnly resolutions, no duplicates + * @param resolutionPool hash array of unique resolutions, no duplicates * @param surfaceSizePool hash array of unique SurfaceSize, no duplicates * @param monitorModePool hash array of unique MonitorMode, no duplicates * @param screenModePool hash array of unique ScreenMode, no duplicates @@ -263,23 +263,24 @@ public class ScreenModeUtil { * @return index of the identical (old or new) ScreenMode element in <code>screenModePool</code>, * matching the input <code>modeProperties</code>, or -1 if input could not be processed. */ - public static int streamIn(ArrayHashSet resolutionPool, - ArrayHashSet surfaceSizePool, - ArrayHashSet screenSizeMMPool, - ArrayHashSet monitorModePool, - ArrayHashSet screenModePool, + public static int streamIn(ArrayHashSet<DimensionImmutable> resolutionPool, + ArrayHashSet<SurfaceSize> surfaceSizePool, + ArrayHashSet<DimensionImmutable> screenSizeMMPool, + ArrayHashSet<MonitorMode> monitorModePool, + ArrayHashSet<ScreenMode> screenModePool, int[] modeProperties, int offset) { ScreenMode screenMode = streamInImpl(resolutionPool, surfaceSizePool, screenSizeMMPool, monitorModePool, screenModePool, modeProperties, offset); return screenModePool.indexOf(screenMode); } - private static ScreenMode streamInImpl(ArrayHashSet resolutionPool, - ArrayHashSet surfaceSizePool, - ArrayHashSet screenSizeMMPool, - ArrayHashSet monitorModePool, - ArrayHashSet screenModePool, - int[] modeProperties, int offset) { + + private static ScreenMode streamInImpl(ArrayHashSet<DimensionImmutable> resolutionPool, + ArrayHashSet<SurfaceSize> surfaceSizePool, + ArrayHashSet<DimensionImmutable> screenSizeMMPool, + ArrayHashSet<MonitorMode> monitorModePool, + ArrayHashSet<ScreenMode> screenModePool, + int[] modeProperties, int offset) { int count = modeProperties[offset]; if(NUM_SCREEN_MODE_PROPERTIES_ALL != count) { throw new RuntimeException("NUM_SCREEN_MODE_PROPERTIES should be "+NUM_SCREEN_MODE_PROPERTIES_ALL+", is "+count+", len "+(modeProperties.length-offset)); @@ -291,30 +292,30 @@ public class ScreenModeUtil { DimensionImmutable resolution = ScreenModeUtil.streamInResolution(modeProperties, offset); offset += ScreenModeUtil.NUM_RESOLUTION_PROPERTIES; if(null!=resolutionPool) { - resolution = (DimensionImmutable) resolutionPool.getOrAdd(resolution); + resolution = resolutionPool.getOrAdd(resolution); } SurfaceSize surfaceSize = ScreenModeUtil.streamInSurfaceSize(resolution, modeProperties, offset); offset += ScreenModeUtil.NUM_SURFACE_SIZE_PROPERTIES; if(null!=surfaceSizePool) { - surfaceSize = (SurfaceSize) surfaceSizePool.getOrAdd(surfaceSize); + surfaceSize = surfaceSizePool.getOrAdd(surfaceSize); } DimensionImmutable screenSizeMM = ScreenModeUtil.streamInResolution(modeProperties, offset); offset += ScreenModeUtil.NUM_RESOLUTION_PROPERTIES; if(null!=screenSizeMMPool) { - screenSizeMM = (DimensionImmutable) screenSizeMMPool.getOrAdd(screenSizeMM); + screenSizeMM = screenSizeMMPool.getOrAdd(screenSizeMM); } MonitorMode monitorMode = ScreenModeUtil.streamInMonitorMode(surfaceSize, screenSizeMM, modeProperties, offset); offset += ScreenModeUtil.NUM_MONITOR_MODE_PROPERTIES - ScreenModeUtil.NUM_RESOLUTION_PROPERTIES; if(null!=monitorModePool) { - monitorMode = (MonitorMode) monitorModePool.getOrAdd(monitorMode); + monitorMode = monitorModePool.getOrAdd(monitorMode); } ScreenMode screenMode = ScreenModeUtil.streamInScreenMode(monitorMode, modeProperties, offset); if(null!=screenModePool) { - screenMode = (ScreenMode) screenModePool.getOrAdd(screenMode); + screenMode = screenModePool.getOrAdd(screenMode); } return screenMode; } diff --git a/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java b/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java index fff496102..a11b08b5c 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java +++ b/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java @@ -33,7 +33,6 @@ package jogamp.newt.driver.kd; -import com.jogamp.newt.*; import jogamp.newt.ScreenImpl; import javax.media.nativewindow.*; |