aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/classes/share/javax/media/j3d/ImageComponent2D.java31
-rw-r--r--src/classes/share/javax/media/j3d/ImageComponentRetained.java10
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java44
3 files changed, 83 insertions, 2 deletions
diff --git a/src/classes/share/javax/media/j3d/ImageComponent2D.java b/src/classes/share/javax/media/j3d/ImageComponent2D.java
index d8124db..0d0164b 100644
--- a/src/classes/share/javax/media/j3d/ImageComponent2D.java
+++ b/src/classes/share/javax/media/j3d/ImageComponent2D.java
@@ -74,6 +74,9 @@ public class ImageComponent2D extends ImageComponent {
int width,
int height) {
+ if (MasterControl.logDevIssues) {
+ MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy");
+ }
((ImageComponent2DRetained)this.retained).processParams(format, width, height, 1);
}
@@ -91,6 +94,9 @@ public class ImageComponent2D extends ImageComponent {
*/
public ImageComponent2D(int format, BufferedImage image) {
+ if (MasterControl.logDevIssues) {
+ MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy");
+ }
((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1);
((ImageComponent2DRetained)this.retained).set(image);
}
@@ -112,6 +118,9 @@ public class ImageComponent2D extends ImageComponent {
public ImageComponent2D(int format, RenderedImage image) {
+ if (MasterControl.logDevIssues) {
+ MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy");
+ }
((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1);
((ImageComponent2DRetained)this.retained).set(image);
}
@@ -144,6 +153,14 @@ public class ImageComponent2D extends ImageComponent {
boolean byReference,
boolean yUp) {
+ if (MasterControl.logDevIssues) {
+ if (byReference && !yUp) {
+ MasterControl.getDevLogger().info("ImageComponent - yUp should " +
+ "be set when using byReference, " +
+ "otherwise an extra copy of the image will be created");
+ }
+ }
+
((ImageComponentRetained)this.retained).setByReference(byReference);
((ImageComponentRetained)this.retained).setYUp(yUp);
((ImageComponent2DRetained)this.retained).processParams(format, width, height, 1);
@@ -173,6 +190,14 @@ public class ImageComponent2D extends ImageComponent {
boolean byReference,
boolean yUp) {
+ if (MasterControl.logDevIssues) {
+ if (byReference && !yUp) {
+ MasterControl.getDevLogger().info("ImageComponent - yUp should " +
+ "be set when using byReference, " +
+ "otherwise an extra copy of the image will be created");
+ }
+ }
+
((ImageComponentRetained)this.retained).setByReference(byReference);
((ImageComponentRetained)this.retained).setYUp(yUp);
((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1);
@@ -206,6 +231,12 @@ public class ImageComponent2D extends ImageComponent {
boolean byReference,
boolean yUp) {
+ if (MasterControl.logDevIssues) {
+ if (byReference && !yUp)
+ MasterControl.getDevLogger().info("ImageComponent - yUp should " +
+ "be set when using byReference, " +
+ "otherwise an extra copy of the image will be created");
+ }
((ImageComponentRetained)this.retained).setByReference(byReference);
((ImageComponentRetained)this.retained).setYUp(yUp);
((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1);
diff --git a/src/classes/share/javax/media/j3d/ImageComponentRetained.java b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
index f2a4ad8..6ebb2a8 100644
--- a/src/classes/share/javax/media/j3d/ImageComponentRetained.java
+++ b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
@@ -853,7 +853,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
*/
void copySupportedImageToImageData(RenderedImage ri, int srcX, int srcY,
int dstX, int dstY, int depthIndex, int copyWidth, int copyHeight, ImageData data) {
-
+
assert (data != null);
ColorModel cm = ri.getColorModel();
@@ -1196,6 +1196,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
void copyUnsupportedNioImageToImageData(NioImageBuffer nioImage, int srcX, int srcY,
int dstX, int dstY, int copyWidth, int copyHeight, ImageData iData) {
+ if (MasterControl.logDevIssues) {
+ MasterControl.getDevLogger().info("ImageComponent - Copying Unsupported NioImage, use a different image type");
+ }
+
assert (iData.getType() == ImageDataType.TYPE_BYTE_BUFFER);
assert (getImageFormatType() == ImageFormatType.TYPE_BYTE_RGBA);
@@ -1221,6 +1225,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
assert (data.getType() == ImageDataType.TYPE_BYTE_ARRAY);
+ if (MasterControl.logDevIssues) {
+ MasterControl.getDevLogger().info("ImageComponent - Copying Unsupported Image, use a different image type");
+ }
+
if (ri instanceof BufferedImage) {
copyUnsupportedImageToImageData((BufferedImage)ri, 0, 0, 0, 0,
depthIndex, data.dataWidth, data.dataHeight, data);
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index 8b830ab..56a7c86 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -20,6 +20,8 @@ package javax.media.j3d;
import java.util.*;
import java.awt.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
class MasterControl {
@@ -67,7 +69,12 @@ class MasterControl {
static final Integer SET_GRAPHICSCONFIG_FEATURES = new Integer(19);
static final Integer SET_QUERYPROPERTIES = new Integer(20);
static final Integer SET_VIEW = new Integer(21);
-
+
+ private static Logger devLogger=null;
+
+ // Should we log developer issues ?
+ static boolean logDevIssues = false;
+
private static boolean librariesLoaded = false;
/**
@@ -688,6 +695,29 @@ class MasterControl {
canvasIds[i] = false;
}
canvasFreeIndex = 0;
+
+ if (devLogger==null) {
+ devLogger = Logger.getLogger("j3d.developer");
+ final Logger fLogger = devLogger;
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ String levelStr = System.getProperty("j3d.developer.level");
+ if (levelStr!=null) {
+ try {
+ fLogger.setLevel( Level.parse(levelStr) );
+ System.err.println("Java 3D: Developer Logger level = "+fLogger.getLevel().getName());
+ } catch (IllegalArgumentException ex) {
+ System.err.println("Java 3D: Developer Logger level unrecognized : "+levelStr);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ }
+ }
+ return null;
+ }
+ });
+ logDevIssues = ((devLogger.getLevel()!=null) && devLogger.getLevel()!=Level.OFF);
+ }
}
private static String getProperty(final String prop) {
@@ -3644,6 +3674,18 @@ class MasterControl {
return Runtime.getRuntime().availableProcessors();
}
+ /**
+ * Get the developer logger
+ *
+ * WARNING - for probable incorrect or inconsistent api usage
+ * INFO - for informational messages such as performance hints (less verbose than FINE)
+ * FINE - for informational messages from inner loops
+ * FINER - using default values which may not be optimal
+ */
+ static Logger getDevLogger() {
+ return devLogger;
+ }
+
//
// The following framework supports code instrumentation. To enable this:
// 1) Uncomment all of the following code