From 9d388c4ffdac2668054a63726717b8e91aaccb59 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 22 Feb 2012 18:57:41 -0800 Subject: j3dutils: remove DVR backdoor in Viewer The Dynamic Video Resize code is effectively disabled internally, remove the API that was publically exposed and the internal HashMap. Signed-off-by: Harvey Harrison --- .../sun/j3d/utils/universe/ConfiguredUniverse.java | 1 - .../com/sun/j3d/utils/universe/SimpleUniverse.java | 2 - .../share/com/sun/j3d/utils/universe/Viewer.java | 177 --------------------- 3 files changed, 180 deletions(-) diff --git a/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java b/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java index afbd081..346f98d 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java @@ -786,7 +786,6 @@ public class ConfiguredUniverse extends SimpleUniverse { locale = null; removeAllLocales(); - Viewer.clearViewerMap(); configContainer.clear(); configContainer = null; diff --git a/src/classes/share/com/sun/j3d/utils/universe/SimpleUniverse.java b/src/classes/share/com/sun/j3d/utils/universe/SimpleUniverse.java index 2865094..9a1e2a4 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/SimpleUniverse.java +++ b/src/classes/share/com/sun/j3d/utils/universe/SimpleUniverse.java @@ -453,8 +453,6 @@ public class SimpleUniverse extends VirtualUniverse { viewer[0].setViewingPlatform(null); removeAllLocales(); - // viewerMap cleanup here to prevent memory leak problem. - Viewer.clearViewerMap(); Primitive.clearGeometryCache(); } diff --git a/src/classes/share/com/sun/j3d/utils/universe/Viewer.java b/src/classes/share/com/sun/j3d/utils/universe/Viewer.java index 4fd113a..6767cf6 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/Viewer.java +++ b/src/classes/share/com/sun/j3d/utils/universe/Viewer.java @@ -57,7 +57,6 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.lang.reflect.Constructor; import java.net.URL; -import java.util.HashMap; import javax.media.j3d.AudioDevice; import javax.media.j3d.Canvas3D; @@ -132,170 +131,6 @@ public class Viewer { private Window[] j3dWindows = null; private ViewingPlatform viewingPlatform = null; - - static HashMap viewerMap = new HashMap(5); - private float dvrFactor = 1.0f; - private boolean doDvr = false; - private boolean doDvrResizeCompensation = true; - - - /** - * Get the Viewer associated with the view object. - * - * @param view The View object for inquiry. - * @return The Viewer object associated with this View object. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public static Viewer getViewer(View view) { - Viewer viewer = null; - synchronized (viewerMap) { - //System.out.println("Viewer.getViewer viewerMap's size is " + viewerMap.size()); - viewer = (Viewer) (viewerMap.get(view)); - } - return viewer; - } - - - /** - * Removes the entry associated with the view object. - * - * @param view The View object to be removed. - * @return The Viewer object associated with this View object. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public static Viewer removeViewerMapEntry(View view) { - Viewer viewer = null; - synchronized (viewerMap) { - - viewer = (Viewer) (viewerMap.remove(view)); - } - // System.out.println("viewerMap.size() " + viewerMap.size()); - - return viewer; - } - - - /** - * Removes all Viewer mappings from the Viewer map. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public static void clearViewerMap() { - synchronized (viewerMap) { - viewerMap.clear(); - } - // System.out.println("clearViewerMap - viewerMap.size() " + viewerMap.size()); - - } - - - /** - * Returns a status flag indicating whether or not dynamic video size - * is enabled. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public boolean isDvrEnabled() { - return doDvr; - } - - /** - * Turns on or off dynamic video size. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @param dvr enables or disables dynamic video size. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public void setDvrEnable(boolean dvr) { - doDvr = dvr; - view.repaint(); - - } - - /** - * Retrieves the dynamic video resize factor of this - * viewer. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public float getDvrFactor() { - return dvrFactor; - } - - - /** - * Set the dynamic video resize factor for this viewer. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @param dvr set the dynamic video resize factor for this viewer. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public void setDvrFactor(float dvr) { - dvrFactor = dvr; - view.repaint(); - - } - - /** - * Turns on or off dynamic video resize compensation. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @param dvrRCE enables or disables dynamic video resize compensation. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public void setDvrResizeCompensationEnable(boolean dvrRCE) { - doDvrResizeCompensation = dvrRCE; - view.repaint(); - } - - /** - * Returns a status flag indicating whether or not dynamic video resize - * compensation is enabled. - * - * Note: This method is targeted for SUN framebuffer XVR-4000 and later - * hardware that support video size extension. - * - * @since Java 3D 1.3.1 - */ - // To support a back door for DVR support. - public boolean getDvrResizeCompensationEnable() { - return doDvrResizeCompensation; - } - /** * Creates a default viewer object. The default values are used to create * the PhysicalBody and PhysicalEnvironment. A single RGB, double buffered @@ -396,10 +231,6 @@ public class Viewer { // Fix to issue 424 view.setUserHeadToVworldEnable(true); - // Add it to the Viewer's HashMap. - synchronized (viewerMap) { - Viewer.viewerMap.put(view, this); - } for (int i=0; i