aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-08 19:16:09 +0200
committerSven Gothel <[email protected]>2013-09-08 19:16:09 +0200
commitc9935d087350630f25046b5b757941fbef3a6044 (patch)
tree2658995f08c0fc6be3bc0640adbec65162765bf8
parentd0e0b963da223e00359cad194061f5a967b2caae (diff)
Add AWTTilePainter.dumpHintsAndScale(..), removing more duplicated code from GLCanvas/GLJPanel
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java12
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java17
3 files changed, 19 insertions, 22 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index b2ffc17a2..8745a8d24 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -758,17 +758,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
if( DEBUG ) {
System.err.println("AWT print.setup: canvasSize "+getWidth()+"x"+getWidth()+", scaleMat "+scaleMatX+" x "+scaleMatY+", useAA "+printUseAA+", printAnimator "+printAnimator);
- {
- final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
- int count = 0;
- for(Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
- final Entry<Object, Object> rEntry = rEntryIter.next();
- System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
- }
- }
- final AffineTransform aTrans = g2d.getTransform();
- System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
- System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
+ AWTTilePainter.dumpHintsAndScale(g2d);
}
final int componentCount = isOpaque() ? 3 : 4;
final TileRenderer printRenderer = new TileRenderer();
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index b549ad30c..44586d45b 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -532,17 +532,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
if( DEBUG ) {
System.err.println("AWT print.setup: canvasSize "+getWidth()+"x"+getWidth()+", scaleMat "+scaleMatX+" x "+scaleMatY+", useAA "+printUseAA+", printAnimator "+printAnimator);
- {
- final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
- int count = 0;
- for(Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
- final Entry<Object, Object> rEntry = rEntryIter.next();
- System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
- }
- }
- final AffineTransform aTrans = g2d.getTransform();
- System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
- System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
+ AWTTilePainter.dumpHintsAndScale(g2d);
}
final int componentCount = isOpaque() ? 3 : 4;
final TileRenderer printRenderer = new TileRenderer();
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index 8d07bdb8e..9aa6f3395 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -30,10 +30,14 @@ package jogamp.opengl.awt;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
+import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Map.Entry;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
@@ -62,6 +66,19 @@ public class AWTTilePainter {
private Graphics2D g2d = null;
private AffineTransform saveAT = null;
+ public static void dumpHintsAndScale(Graphics2D g2d) {
+ final RenderingHints rHints = g2d.getRenderingHints();
+ final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
+ int count = 0;
+ for(Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
+ final Entry<Object, Object> rEntry = rEntryIter.next();
+ System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
+ }
+ final AffineTransform aTrans = g2d.getTransform();
+ System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
+ System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
+ }
+
/**
* Assumes a configured {@link TileRenderer}, i.e.
* an {@link TileRenderer#attachToAutoDrawable(GLAutoDrawable) attached}