diff options
author | Sven Gothel <[email protected]> | 2013-09-05 16:32:15 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-05 16:32:15 +0200 |
commit | d2ed1b9d211391e8eccc9a4e6afb321d4b77dbb5 (patch) | |
tree | 2835cec50c428cff84ced9342989158318ac980f /src/test/com/jogamp | |
parent | cd34ea267adf538bb7e11267f81d2941a5987d8f (diff) |
TestTiledPrintingGearsAWT: Fix margin translate for high dpi, i.e. other than 72dpi
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java index 657217462..0f0f492b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java @@ -153,15 +153,20 @@ public class TestTiledPrintingGearsAWT extends UITestCase implements Printable { final int frameWidthS = frameWidth*xScaleComp; final int frameHeightS = frameHeight*yScaleComp; - System.err.println("DPI: "+printDPI+", scale "+xScale+"/"+yScale+", frame: "+frameWidth+"x"+frameHeight+" -> "+frameWidthS+"x"+frameHeightS); + double xMargin = (pf.getImageableWidth() - frameWidthS*xScale)/2; + double yMargin = (pf.getImageableHeight() - frameHeightS*yScale)/2; + final double moveX, moveY; + moveX = pf.getImageableX() + xMargin; + moveY = pf.getImageableY() + yMargin; + System.err.println("DPI: "+printDPI+", scale "+xScale+"/"+yScale+", margin "+xMargin+"/"+yMargin+", move "+moveX+"/"+moveY+ + ", frame: "+frameWidth+"x"+frameHeight+" -> "+frameWidthS+"x"+frameHeightS); + frame.setSize(frameWidthS, frameHeightS); - - // double xMargin = (pf.getImageableWidth() - img.getWidth()*xScale)/2; - // double yMargin = (pf.getImageableHeight() - img.getHeight()*yScale)/2; - // g2d.translate(pf.getImageableX() + xMargin, pf.getImageableY() + yMargin); + g2d.translate(moveX, moveY); g2d.scale(xScale , yScale ); + } else { + g2d.translate(pf.getImageableX(), pf.getImageableY()); } - g2d.translate(pf.getImageableX(), pf.getImageableY()); frame.printAll(g); |