< prev index next >

test/java/awt/image/DrawImage/IncorrectDestinationOffset.java

Print this page
rev 14836 : 8159690: [TESTBUG] Mark headful tests with @key headful.
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.AlphaComposite;
  25 import java.awt.Color;
  26 import java.awt.Graphics2D;
  27 import java.awt.GraphicsConfiguration;
  28 import java.awt.GraphicsEnvironment;
  29 import java.awt.image.BufferedImage;
  30 import java.awt.image.VolatileImage;
  31 import java.io.File;
  32 import java.io.IOException;
  33 
  34 import javax.imageio.ImageIO;
  35 
  36 /**
  37  * @test

  38  * @bug 8041129
  39  * @summary Destination offset should be correct in case of Surface->SW blit.
  40  *          Destination outside of the drawing area should be untouched.
  41  * @author Sergey Bylokhov
  42  */
  43 public final class IncorrectDestinationOffset {
  44 
  45     private static final int SIZE = 128;
  46     private static final double[] SCALES = {0.25, 0.5, 1, 1.5, 2.0, 4};
  47 
  48     public static void main(final String[] args) throws IOException {
  49         GraphicsEnvironment ge = GraphicsEnvironment
  50                 .getLocalGraphicsEnvironment();
  51         GraphicsConfiguration gc = ge.getDefaultScreenDevice()
  52                                      .getDefaultConfiguration();
  53         VolatileImage vi = gc.createCompatibleVolatileImage(SIZE, SIZE);
  54         BufferedImage bi = new BufferedImage(SIZE, SIZE,
  55                                              BufferedImage.TYPE_INT_ARGB);
  56         for (double scale : SCALES) {
  57             while (true) {


   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.AlphaComposite;
  25 import java.awt.Color;
  26 import java.awt.Graphics2D;
  27 import java.awt.GraphicsConfiguration;
  28 import java.awt.GraphicsEnvironment;
  29 import java.awt.image.BufferedImage;
  30 import java.awt.image.VolatileImage;
  31 import java.io.File;
  32 import java.io.IOException;
  33 
  34 import javax.imageio.ImageIO;
  35 
  36 /**
  37  * @test
  38  * @key headful
  39  * @bug 8041129
  40  * @summary Destination offset should be correct in case of Surface->SW blit.
  41  *          Destination outside of the drawing area should be untouched.
  42  * @author Sergey Bylokhov
  43  */
  44 public final class IncorrectDestinationOffset {
  45 
  46     private static final int SIZE = 128;
  47     private static final double[] SCALES = {0.25, 0.5, 1, 1.5, 2.0, 4};
  48 
  49     public static void main(final String[] args) throws IOException {
  50         GraphicsEnvironment ge = GraphicsEnvironment
  51                 .getLocalGraphicsEnvironment();
  52         GraphicsConfiguration gc = ge.getDefaultScreenDevice()
  53                                      .getDefaultConfiguration();
  54         VolatileImage vi = gc.createCompatibleVolatileImage(SIZE, SIZE);
  55         BufferedImage bi = new BufferedImage(SIZE, SIZE,
  56                                              BufferedImage.TYPE_INT_ARGB);
  57         for (double scale : SCALES) {
  58             while (true) {


< prev index next >