aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/jogamp/java3d/Canvas3D.java13
-rw-r--r--src/main/java/org/jogamp/java3d/CanvasViewEventCatcher.java9
2 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/org/jogamp/java3d/Canvas3D.java b/src/main/java/org/jogamp/java3d/Canvas3D.java
index fe21197..a4f2b95 100644
--- a/src/main/java/org/jogamp/java3d/Canvas3D.java
+++ b/src/main/java/org/jogamp/java3d/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;
@@ -822,6 +824,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.
@@ -1228,10 +1232,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/main/java/org/jogamp/java3d/CanvasViewEventCatcher.java b/src/main/java/org/jogamp/java3d/CanvasViewEventCatcher.java
index 3d72016..966f359 100644
--- a/src/main/java/org/jogamp/java3d/CanvasViewEventCatcher.java
+++ b/src/main/java/org/jogamp/java3d/CanvasViewEventCatcher.java
@@ -26,6 +26,7 @@
package org.jogamp.java3d;
+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,8 +92,9 @@ class CanvasViewEventCatcher extends ComponentAdapter {
// first, then canvas lock in removeComponentListener()
try {
- canvas.newSize = canvas.getSize();
- canvas.newPosition = canvas.getLocationOnScreen();
+ 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) {}
}