aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-05-01 03:19:57 +0200
committerSven Gothel <[email protected]>2012-05-01 03:19:57 +0200
commitcc93cf413a59532bb31a4768c9d268234b859858 (patch)
treed31738ef66de312806e58ce41c8cc0539280c48c /src/nativewindow
parent8b0aa0e7653f74e713880e77f9afbe59caff38f0 (diff)
EGLGraphicsConfigurationFactory: Add 'unregisterFactory()' static entry allowing to remove EGL/ES based factory
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java17
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;
}