aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Tsinko <[email protected]>2020-01-28 14:23:19 -0700
committerEgor Tsinko <[email protected]>2020-01-28 14:23:19 -0700
commit80a33622acdc5d76c19cdfe955792a53e0e9f2bd (patch)
tree4a24bd46ff803affc2a4685ae004a8c513698e78
parentf7ca7f55788ddc2c23bf30d6867b50a1e90ac1e7 (diff)
fixed an issue with J3DGraphics2DImpl.clearOffScreen()
In cases when a new transform is set into the graphics there might be some on-screen artifacts caused by improper clearing
-rw-r--r--src/main/java/org/jogamp/java3d/J3DGraphics2DImpl.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/org/jogamp/java3d/J3DGraphics2DImpl.java b/src/main/java/org/jogamp/java3d/J3DGraphics2DImpl.java
index 124fb74..ba3ef68 100644
--- a/src/main/java/org/jogamp/java3d/J3DGraphics2DImpl.java
+++ b/src/main/java/org/jogamp/java3d/J3DGraphics2DImpl.java
@@ -1179,11 +1179,17 @@ final class J3DGraphics2DImpl extends J3DGraphics2D {
void clearOffScreen() {
Composite comp = offScreenGraphics2D.getComposite();
Color c = offScreenGraphics2D.getColor();
+ AffineTransform transform = offScreenGraphics2D.getTransform();
+ // Reset offScreenGraphics2D transform to identity because xmin, ymin, xmax and ymax
+ // are in image space and offScreenGraphics2D might have a
+ // different transform set (i.e. HiDPI transform)
+ offScreenGraphics2D.setTransform(new AffineTransform());
offScreenGraphics2D.setComposite(AlphaComposite.Src);
offScreenGraphics2D.setColor(blackTransparent);
offScreenGraphics2D.fillRect(xmin, ymin, (xmax-xmin), (ymax-ymin));
offScreenGraphics2D.setComposite(comp);
offScreenGraphics2D.setColor(c);
+ offScreenGraphics2D.setTransform(transform);
}
/**