summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-12 20:00:01 +0200
committerSven Gothel <[email protected]>2013-10-12 20:00:01 +0200
commit38bc1dbe6d2402218bc348516545b25e4db177b9 (patch)
tree0429f6ceac29ce9ba759591a9e4e44be8ce4ff18 /src/jogl
parent2634ce35031be322cb355e4d6055aace6a2c0619 (diff)
Bug 860 - AWT Printing (AWTTilePainter): Shall use the enclosing integer rectangle of the scaled double precision clipping rect
AWTTilePainter simply rounds the scaled double precision clipping rectangle to receive the integer rectangle. This leads to uncovered drawing areas, since the integer rectangle position could be greater - and the size could be smaller than the double precision source. To get the enclosing rectangle, we need to use iPos = floor(position) iSize = ceil(position+size) - floor(position) .. turns our that the double precision 'Rectangle Rectangle2D.getBounds()' already performs this math.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index fbf6faf08..0600d99f5 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -148,11 +148,6 @@ public class AWTTilePainter {
flipVertical = v;
}
- private static Rectangle getRoundedRect(Rectangle2D r) {
- if( null == r ) { return null; }
- return new Rectangle((int)Math.round(r.getX()), (int)Math.round(r.getY()),
- (int)Math.round(r.getWidth()), (int)Math.round(r.getHeight()));
- }
private static Rectangle2D getClipBounds2D(Graphics2D g) {
final Shape shape = g.getClip();
return null != shape ? shape.getBounds2D() : null;
@@ -221,8 +216,8 @@ public class AWTTilePainter {
dClipScaled = scaledATI.createTransformedShape(s0).getBounds2D(); // scaled out
}
}
- final Rectangle iClipScaled = getRoundedRect(dClipScaled);
- final Rectangle iImageSizeScaled = getRoundedRect(dImageSizeScaled);
+ final Rectangle iClipScaled = dClipScaled.getBounds();
+ final Rectangle iImageSizeScaled = dImageSizeScaled.getBounds();
renderer.setImageSize(iImageSizeScaled.width, iImageSizeScaled.height);
renderer.clipImageSize(iClipScaled.width, iClipScaled.height);
final int clipH = Math.min(iImageSizeScaled.height, iClipScaled.height);