aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2012-05-19 01:31:07 -0700
committerHarvey Harrison <[email protected]>2012-05-19 01:40:52 -0700
commitc29725f319d1ce1042eb85ff17f51ffeaf15bc70 (patch)
treeaff10669f76ec7d413dbfd2edf4bc0b7fca3f259
parentfce661d53b1e9641159acbdc7d3ac11c8727d1a0 (diff)
j3dcore: annotate the Device->Renderer map and always use static access
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java3
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java29
-rw-r--r--src/classes/share/javax/media/j3d/Screen3D.java4
3 files changed, 15 insertions, 21 deletions
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index b5a6321..62b778d 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -2077,8 +2077,7 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine
// is shared by another onScreen Canvas and this callback
// is from that Canvas. In this case it need one more
// round before the renderer.
- screen.renderer = (Renderer) screen.deviceRendererMap.get(
- screen.graphicsDevice);
+ screen.renderer = Screen3D.deviceRendererMap.get(screen.graphicsDevice);
// screen.renderer may equal to null when multiple
// screen is used and this Canvas3D is in different
// screen sharing the same View not yet initialize.
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index 8c5da1b..2ef3987 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -1100,7 +1100,7 @@ class MasterControl {
private Renderer createRenderer(GraphicsConfiguration gc) {
final GraphicsDevice gd = gc.getDevice();
- Renderer rdr = (Renderer) Screen3D.deviceRendererMap.get(gd);
+ Renderer rdr = Screen3D.deviceRendererMap.get(gd);
if (rdr != null) {
return rdr;
}
@@ -1122,7 +1122,7 @@ class MasterControl {
threadListsChanged = true;
- return (Renderer) Screen3D.deviceRendererMap.get(gd);
+ return Screen3D.deviceRendererMap.get(gd);
}
/**
@@ -2047,9 +2047,9 @@ class MasterControl {
"MC: Destroy all Renderers");
}
// remove all Renderers if this is the last View
- for (Enumeration e = Screen3D.deviceRendererMap.elements();
+ for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements();
e.hasMoreElements(); ) {
- Renderer rdr = (Renderer) e.nextElement();
+ Renderer rdr = e.nextElement();
Screen3D scr;
rendererCleanupArgs[2] = REMOVEALLCTXS_CLEANUP;
@@ -2078,10 +2078,9 @@ class MasterControl {
}
// cleanup ThreadData corresponds to the view in renderer
- for (Enumeration e = Screen3D.deviceRendererMap.elements();
+ for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements();
e.hasMoreElements(); ) {
- Renderer rdr = (Renderer) e.nextElement();
- rdr.cleanup();
+ e.nextElement().cleanup();
}
// We have to reuse renderer even though MC exit
// see bug 4363279
@@ -2089,10 +2088,9 @@ class MasterControl {
} else {
// cleanup ThreadData corresponds to the view in renderer
- for (Enumeration e = Screen3D.deviceRendererMap.elements();
+ for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements();
e.hasMoreElements(); ) {
- Renderer rdr = (Renderer) e.nextElement();
- rdr.cleanupView();
+ e.nextElement().cleanupView();
}
}
@@ -2276,9 +2274,7 @@ class MasterControl {
// device of the screen of the canvas
// No need to synchronized since only
// MC use it.
- Renderer rdr =
- (Renderer) screen.deviceRendererMap.get(
- cv.screen.graphicsDevice);
+ Renderer rdr = Screen3D.deviceRendererMap.get(cv.screen.graphicsDevice);
if (rdr == null) {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@@ -2294,8 +2290,7 @@ class MasterControl {
}
});
screen.renderer.initialize();
- screen.deviceRendererMap.put(
- screen.graphicsDevice, screen.renderer);
+ Screen3D.deviceRendererMap.put(screen.graphicsDevice, screen.renderer);
} else {
screen.renderer = rdr;
}
@@ -2826,9 +2821,9 @@ class MasterControl {
thread = null;
- for (Enumeration e = Screen3D.deviceRendererMap.elements();
+ for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements();
e.hasMoreElements(); ) {
- Renderer rdr = (Renderer) e.nextElement();
+ Renderer rdr = e.nextElement();
thread = rdr.getThreadData(null, null);
requestRenderWorkThreads.add(thread);
thread.threadOpts = J3dThreadData.CONT_THREAD;
diff --git a/src/classes/share/javax/media/j3d/Screen3D.java b/src/classes/share/javax/media/j3d/Screen3D.java
index 9243363..4ae6817 100644
--- a/src/classes/share/javax/media/j3d/Screen3D.java
+++ b/src/classes/share/javax/media/j3d/Screen3D.java
@@ -166,8 +166,8 @@ public class Screen3D extends Object {
// The renderer for this screen
Renderer renderer = null;
- // Hashtable that maps a GraphicsDevice to its associated renderer
- static Hashtable deviceRendererMap = new Hashtable();
+// Hashtable that maps a GraphicsDevice to its associated renderer
+static Hashtable<GraphicsDevice, Renderer> deviceRendererMap = new Hashtable<GraphicsDevice, Renderer>();
// A count of the number of canvases associated with this screen
int canvasCount = 0;