diff options
author | Sven Gothel <[email protected]> | 2012-05-01 03:19:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-05-01 03:19:57 +0200 |
commit | cc93cf413a59532bb31a4768c9d268234b859858 (patch) | |
tree | d31738ef66de312806e58ce41c8cc0539280c48c /src/nativewindow/classes | |
parent | 8b0aa0e7653f74e713880e77f9afbe59caff38f0 (diff) |
EGLGraphicsConfigurationFactory: Add 'unregisterFactory()' static entry allowing to remove EGL/ES based factory
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index e5f230b4c..2610f2cfa 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -190,10 +190,19 @@ public abstract class GraphicsConfigurationFactory { if (!(abstractGraphicsDeviceClass.isAssignableFrom(abstractGraphicsDeviceImplementor))) { throw new IllegalArgumentException("Given class must implement AbstractGraphicsDevice"); } - GraphicsConfigurationFactory prevFactory = registeredFactories.put(abstractGraphicsDeviceImplementor, factory); - if(DEBUG) { - System.err.println("GraphicsConfigurationFactory.registerFactory() "+abstractGraphicsDeviceImplementor+" -> "+factory+ - ", overridding: "+prevFactory); + final GraphicsConfigurationFactory prevFactory; + if(null == factory) { + prevFactory = registeredFactories.remove(abstractGraphicsDeviceImplementor); + if(DEBUG) { + System.err.println("GraphicsConfigurationFactory.registerFactory() remove "+abstractGraphicsDeviceImplementor+ + ", deleting: "+prevFactory); + } + } else { + prevFactory = registeredFactories.put(abstractGraphicsDeviceImplementor, factory); + if(DEBUG) { + System.err.println("GraphicsConfigurationFactory.registerFactory() put "+abstractGraphicsDeviceImplementor+" -> "+factory+ + ", overridding: "+prevFactory); + } } return prevFactory; } |