/hg/gfx-test: Helper methods added to CommonBitmapOperations. Th...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Feb 25 02:24:33 PST 2013


changeset ac1a36500a48 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=ac1a36500a48
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Feb 25 11:27:41 2013 +0100

	Helper methods added to CommonBitmapOperations. Those methods are used
	to perform raster operations to raster images during BitBlt.


diffstat:

 ChangeLog                                             |   6 ++
 src/org/gfxtest/framework/CommonBitmapOperations.java |  52 +++++++++++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diffs (89 lines):

diff -r f2fa868add3d -r ac1a36500a48 ChangeLog
--- a/ChangeLog	Fri Feb 22 10:47:26 2013 +0100
+++ b/ChangeLog	Mon Feb 25 11:27:41 2013 +0100
@@ -1,3 +1,9 @@
+2013-02-25  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonBitmapOperations.java:
+	Helper methods added to CommonBitmapOperations. Those methods are used
+	to perform raster operations to raster images during BitBlt.
+
 2013-02-22  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/BitBltScaleImage.java:
diff -r f2fa868add3d -r ac1a36500a48 src/org/gfxtest/framework/CommonBitmapOperations.java
--- a/src/org/gfxtest/framework/CommonBitmapOperations.java	Fri Feb 22 10:47:26 2013 +0100
+++ b/src/org/gfxtest/framework/CommonBitmapOperations.java	Mon Feb 25 11:27:41 2013 +0100
@@ -44,6 +44,7 @@
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
 
 
 
@@ -308,6 +309,31 @@
     }
 
     /**
+     * Performs BitBlt operation for given source and destination image.
+     * Selected raster operator is applied during BitBlt
+     * 
+     * @param sourceImage
+     *            source image for BitBlt
+     * @param destinationImage
+     *            destination image for BitBlt graphics canvas
+     * @param graphics2d
+     *            instance of class used during rendering
+     * @param rop
+     *            raster operator to be applied during BibBlt
+     * @return if the image has completely loaded and its pixels are no longer
+     *         being changed, then returns true. Otherwise, returns false
+     */
+    private static boolean performBitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d,
+                    BufferedImageOp rop)
+    {
+        // compute top-left corner coordinates
+        final int x = (destinationImage.getWidth() - DEFAULT_TEST_IMAGE_WIDTH) >> 1;
+        final int y = (destinationImage.getHeight() - DEFAULT_TEST_IMAGE_HEIGHT) >> 1;
+        graphics2d.drawImage(sourceImage, rop, x, y);
+        return true;
+    }
+
+    /**
      * Create buffered bitmap with given type.
      * 
      * @param type
@@ -545,6 +571,32 @@
     }
 
     /**
+     * Create new buffered image and then perform basic BitBlt test.
+     * 
+     * @param image
+     *            image to which another image is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @param imageType
+     *            type of the created image
+     * @param rop
+     *            selected raster operation
+     */
+    public static TestResult doBitBltTestWithEmptyImage(TestImage image, Graphics2D graphics2d, int imageType, BufferedImageOp rop)
+    {
+        // create new buffered bitmap with given type
+        // bitmap should be empty - solid color pixels
+        BufferedImage bufferedImage = createBufferedBitmap(imageType);
+        // basic check if buffered image was created
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        // BitBlt with 1:1 scaling, no flipping and no cropping and using RescaleOp
+        return performBitBlt(bufferedImage, image, graphics2d, rop) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
      * Create new buffered image containing checker pattern and then perform basic BitBlt test.
      *
      * @param image



More information about the distro-pkg-dev mailing list