diff options
Diffstat (limited to 'src/javax/media')
-rw-r--r-- | src/javax/media/j3d/Canvas3D.java | 14 | ||||
-rw-r--r-- | src/javax/media/j3d/CanvasViewEventCatcher.java | 7 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/javax/media/j3d/Canvas3D.java b/src/javax/media/j3d/Canvas3D.java index 080bd18..8824191 100644 --- a/src/javax/media/j3d/Canvas3D.java +++ b/src/javax/media/j3d/Canvas3D.java @@ -32,12 +32,14 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.IllegalComponentStateException; import java.awt.Point; import java.awt.Window; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Hashtable; @@ -820,6 +822,8 @@ ArrayList<Integer> textureIdResourceFreeList = new ArrayList<Integer>(); // CanvasViewEventCatcher. Point newPosition = new Point(); Dimension newSize = new Dimension(); + double xscale = 1.0; + double yscale = 1.0; // Remember OGL context resources to free // before context is destroy. @@ -1227,9 +1231,15 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine if (!firstPaintCalled && added && validCanvas && validGraphicsMode()) { + final Graphics2D g2d = (Graphics2D) g; + final AffineTransform t = g2d.getTransform(); + try { - newSize = getSize(); - newPosition = getLocationOnScreen(); + Dimension scaledSize = getSize(); + xscale = t.getScaleX(); + yscale = t.getScaleY(); + newSize = new Dimension((int)(scaledSize.getWidth()*xscale), (int)(scaledSize.getHeight()*yscale)); + newPosition = getLocationOnScreen(); } catch (IllegalComponentStateException e) { return; } diff --git a/src/javax/media/j3d/CanvasViewEventCatcher.java b/src/javax/media/j3d/CanvasViewEventCatcher.java index aadbf5f..478a84c 100644 --- a/src/javax/media/j3d/CanvasViewEventCatcher.java +++ b/src/javax/media/j3d/CanvasViewEventCatcher.java @@ -26,6 +26,7 @@ package javax.media.j3d; +import java.awt.Dimension; import java.awt.IllegalComponentStateException; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; @@ -65,7 +66,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // see comment below try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} @@ -90,7 +92,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // first, then canvas lock in removeComponentListener() try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} |