aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-15 17:04:35 +0200
committerSven Gothel <[email protected]>2013-10-15 17:04:35 +0200
commita05b87a369441d9ef38f97929f866b3d4ced0e57 (patch)
treec44dff9e82edf89ba1c85a2541e20f3bc725b6ca /src/test/com/jogamp/opengl
parentbc72e232a4b74c2be8c91c540a7b6153bfefb8c0 (diff)
AWTPrintLifecycle.setupPrint(..): Add optional tileWidth and tileHeight, allowing user to set custom tile size for performance evaluation/tweak
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java31
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java42
9 files changed, 98 insertions, 58 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
index bd526419c..78fdde3ee 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
@@ -45,6 +45,7 @@ import javax.imageio.ImageIO;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.nativewindow.awt.DirectDataBufferInt;
+import com.jogamp.opengl.util.TileRenderer;
/**
* {@link Printable} implementation using NIO {@link DirectDataBufferInt} {@link BufferedImage}
@@ -64,11 +65,13 @@ public class OffscreenPrintable extends PrintableBase implements Printable {
* @param printContainer
* @param printDPI
* @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
* @param imageType AWT BufferedImage type (must be one of the integer types)
* @param pngFilename TODO
*/
- public OffscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int imageType, String pngFilename) {
- super(job, printContainer, printDPI, numSamples);
+ public OffscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight, int imageType, String pngFilename) {
+ super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight);
this.imageType = imageType;
this.pngFilename = pngFilename;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
index 7e8bac295..6f73ef2b4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
@@ -39,6 +39,7 @@ import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.opengl.util.TileRenderer;
/**
* <h5>Scaling of Frame and GL content</h5>
@@ -66,11 +67,14 @@ public class OnscreenPrintable extends PrintableBase implements Printable {
* @param printContainer
* @param printDPI
* @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
*/
- public OnscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples) {
- super(job, printContainer, printDPI, numSamples);
+ public OnscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) {
+ super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight);
}
+
@Override
public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
if (page > 0) { // We have only one page, and 'page' is zero-based
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java
index 830ded960..dd9de60c3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java
@@ -33,6 +33,7 @@ import java.awt.print.PrinterJob;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
+import com.jogamp.opengl.util.TileRenderer;
/**
* Base {@link Printable} implementation class.
@@ -58,6 +59,7 @@ public abstract class PrintableBase implements Printable {
public final Container cont;
public final int dpi;
public final int numSamples;
+ public final int tileWidth, tileHeight;
protected final RecursiveLock lockPrinting = LockFactory.createRecursiveLock();
/**
@@ -66,12 +68,16 @@ public abstract class PrintableBase implements Printable {
* @param printContainer
* @param printDPI
* @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
*/
- public PrintableBase(PrinterJob job, Container printContainer, int printDPI, int numSamples) {
+ public PrintableBase(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) {
this.job = job;
this.cont = printContainer;
this.dpi = printDPI;
this.numSamples = numSamples;
+ this.tileWidth = tileWidth;
+ this.tileHeight = tileHeight;
}
/** Wait for idle .. simply acquiring all locks and releasing them. */
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 4883df501..30e0ba4e6 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
@@ -116,15 +116,15 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 72, 0);
+ doPrintManual(frame, 72, 0, -1, -1);
} };
final ActionListener print300DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 300, -1);
+ doPrintManual(frame, 300, -1, -1, -1);
} };
final ActionListener print600DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 600, -1);
+ doPrintManual(frame, 600, -1, -1, -1);
} };
final Button print72DPIButton = new Button("72dpi");
print72DPIButton.addActionListener(print72DPIAction);
@@ -178,36 +178,41 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
if( !printDone ) {
printDone = true;
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, true /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, true/* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true/* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
if( allow600dpi ) {
// No AA needed for 300 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
index a256d964f..ec1d7b1d6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
@@ -121,15 +121,15 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 72, 0);
+ doPrintManual(frame, 72, 0, -1, -1);
} };
final ActionListener print300DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 300, -1);
+ doPrintManual(frame, 300, -1, -1, -1);
} };
final ActionListener print600DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 600, -1);
+ doPrintManual(frame, 600, -1, -1, -1);
} };
final Button print72DPIButton = new Button("72dpi");
print72DPIButton.addActionListener(print72DPIAction);
@@ -183,36 +183,41 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
if( !printDone ) {
printDone = true;
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, true /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, true /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
if( allow600dpi ) {
// No AA needed for 300 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
index f1759798b..72cb219ab 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
@@ -152,15 +152,15 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 72, 0);
+ doPrintManual(frame, 72, 0, -1, -1);
} };
final ActionListener print300DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 300, -1);
+ doPrintManual(frame, 300, -1, -1, -1);
} };
final ActionListener print600DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 600, -1);
+ doPrintManual(frame, 600, -1, -1, -1);
} };
final Button print72DPIButton = new Button("72dpi");
print72DPIButton.addActionListener(print72DPIAction);
@@ -217,51 +217,56 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
if( !printDone ) {
printDone = true;
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, true /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_RGB /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_BGR /* offscreen-type */, 150, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_RGB /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_BGR /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, true /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
if( allow600dpi ) {
// No AA needed for 300 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, false /* resizeWithinPrint */);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
index d18def075..2d4973d6b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
@@ -142,15 +142,15 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 72, 0);
+ doPrintManual(frame, 72, 0, -1, -1);
} };
final ActionListener print150DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 150, -1);
+ doPrintManual(frame, 150, -1, -1, -1);
} };
final ActionListener print300DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- doPrintManual(frame, 300, -1);
+ doPrintManual(frame, 300, -1, -1, -1);
} };
final Button print72DPIButton = new Button("72dpi");
print72DPIButton.addActionListener(print72DPIAction);
@@ -220,7 +220,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
printDone = true;
{
// No AA needed for 150 dpi and greater :)
- final PrintableBase p = doPrintAuto(frame, PageFormat.PORTRAIT, null, -1 /* offscreen-type */, 150, -1, false);
+ final PrintableBase p = doPrintAuto(frame, PageFormat.PORTRAIT, null, -1 /* offscreen-type */, 150, -1, -1, -1, false);
waitUntilPrintJobsIdle(p);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
index 0fe08ebc2..b51bfae87 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
@@ -128,7 +128,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// frame.paintAll(g2d);
- final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, 1.0/scaleComp72, 1.0/scaleComp72, 0);
+ final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, 1.0/scaleComp72, 1.0/scaleComp72, 0, -1, -1);
try {
frame.printAll(g2d);
} finally {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
index e6179aa95..4e9d4bdbe 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
@@ -51,11 +51,13 @@ import jogamp.nativewindow.awt.AWTMisc;
import org.junit.Assert;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.TileRenderer;
/**
* Base unit test class implementing
@@ -79,9 +81,12 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
* @param offscrnImageType if < 0 onscreen, otherwise integer BufferedImage type
* @param dpi
* @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
* @param resizeWithinPrintTest TODO
*/
- public PrintableBase doPrintAuto(Container cont, int pOrientation, Paper paper, int offscrnImageType, int dpi, int numSamples, boolean resizeWithinPrintTest) {
+ public PrintableBase doPrintAuto(Container cont, int pOrientation, Paper paper,
+ int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) {
lock.lock();
try {
final PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
@@ -98,12 +103,13 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(pdfMimeType);
if (factories.length > 0) {
- final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, "pdf", resizeWithinPrintTest);
+ final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "pdf", resizeWithinPrintTest);
System.err.println("doPrint: dpi "+dpi+", "+fname);
FileOutputStream outstream;
try {
outstream = new FileOutputStream(fname);
- return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, resizeWithinPrintTest);
+ return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper,
+ offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest);
} catch (FileNotFoundException e) {
Assert.assertNull("Unexpected exception", e);
}
@@ -112,12 +118,12 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
factories = PrinterJob.lookupStreamPrintServices(psMimeType);
if (factories.length > 0) {
- final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, "ps", resizeWithinPrintTest);
+ final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "ps", resizeWithinPrintTest);
System.err.println("doPrint: dpi "+dpi+", "+fname);
FileOutputStream outstream;
try {
outstream = new FileOutputStream(fname);
- return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, resizeWithinPrintTest);
+ return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest);
} catch (FileNotFoundException e) {
Assert.assertNull("Unexpected exception", e);
}
@@ -128,17 +134,17 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
lock.unlock();
}
}
- private String getPrintFilename(int offscrnImageType, int dpi, int numSamples, String suffix, boolean resizeWithinPrintTest) {
+ private String getPrintFilename(int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, String suffix, boolean resizeWithinPrintTest) {
final int maxSimpleTestNameLen = getMaxTestNameLen()+getClass().getSimpleName().length()+1;
final String simpleTestName = getSimpleTestName(".");
final String onoffscrn = 0 > offscrnImageType ? "on_screen" : "offscrn_"+offscrnImageType;
final String aa = 0 <= numSamples ? "aa"+numSamples : "aaN";
- return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-resize%d.%s",
- simpleTestName, printCount, onoffscrn, dpi, aa, resizeWithinPrintTest?1:0, suffix).replace(' ', '_');
+ return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s",
+ simpleTestName, printCount, onoffscrn, dpi, aa, tileWidth, tileHeight, resizeWithinPrintTest?1:0, suffix).replace(' ', '_');
}
private PrintableBase doPrintAutoImpl(Container cont, PrinterJob job,
StreamPrintService ps, int pOrientation, Paper paper,
- int offscrnImageType, int dpi, int numSamples, boolean resizeWithinPrintTest) {
+ int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) {
try {
PageFormat pageFormat = job.defaultPage();
if( null != paper ) {
@@ -152,9 +158,9 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
job.setPrintService(ps);
final PrintableBase printable;
if( 0 < offscrnImageType ) {
- printable = new OffscreenPrintable(job, cont, dpi, numSamples, offscrnImageType, getPrintFilename(offscrnImageType, dpi, numSamples, "png", resizeWithinPrintTest));
+ printable = new OffscreenPrintable(job, cont, dpi, numSamples, tileWidth, tileHeight, offscrnImageType, getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "png", resizeWithinPrintTest));
} else {
- printable = new OnscreenPrintable(job, cont, dpi, numSamples);
+ printable = new OnscreenPrintable(job, cont, dpi, numSamples, tileWidth, tileHeight);
}
printable.job.setPrintable(printable, pageFormat);
doPrintImpl(printable, resizeWithinPrintTest);
@@ -166,15 +172,16 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
}
/**
- *
* @param cont
* @param dpi
* @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
*/
- public PrintableBase doPrintManual(Container cont, int dpi, int numSamples) {
+ public PrintableBase doPrintManual(Container cont, int dpi, int numSamples, int tileWidth, int tileHeight) {
lock.lock();
try {
- final OnscreenPrintable printable = new OnscreenPrintable(PrinterJob.getPrinterJob(), cont, dpi, numSamples);
+ final OnscreenPrintable printable = new OnscreenPrintable(PrinterJob.getPrinterJob(), cont, dpi, numSamples, tileWidth, tileHeight);
printable.job.setPrintable(printable);
boolean ok = printable.job.printDialog();
if (ok) {
@@ -207,10 +214,13 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
final double scaleGLMatXY = 72.0 / printable.dpi;
System.err.println("PRINTable: "+printable.getClass().getSimpleName());
System.err.println("PRINT DPI: "+printable.dpi+", AA "+printable.numSamples+", scaleGL "+scaleGLMatXY);
- final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(printable.cont, scaleGLMatXY, scaleGLMatXY, printable.numSamples);
+ final AWTPrintLifecycle.Context ctx =
+ AWTPrintLifecycle.Context.setupPrint(printable.cont, scaleGLMatXY, scaleGLMatXY,
+ printable.numSamples, printable.tileWidth, printable.tileHeight);
System.err.println("PRINT AWTPrintLifecycle.setup.count "+ctx.getCount());
final int w = printable.cont.getWidth();
final int h = printable.cont.getHeight();
+ final long t0 = Platform.currentTimeMillis();
try {
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
public void run() {
@@ -230,6 +240,8 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
} });
} finally {
ctx.releasePrint();
+ final long td = Platform.currentTimeMillis() - t0;
+ System.err.println("PRINT Duration "+td+" ms");
if( resizeWithinPrintTest ) {
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
public void run() {