< prev index next >

test/java/awt/image/DrawImage/IncorrectOffset.java

Print this page
rev 14836 : 8159690: [TESTBUG] Mark headful tests with @key headful.
   1 /*
   2  * Copyright (c) 2013, 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 
  32 /**
  33  * @test

  34  * @bug 8000629
  35  * @summary Temporary backbuffer in the DrawImage should have correct offset.
  36  * @author Sergey Bylokhov
  37  */
  38 public final class IncorrectOffset {
  39 
  40     private static final int width = 400;
  41     private static final int height = 400;
  42 
  43     public static void main(final String[] args) {
  44         GraphicsEnvironment ge =
  45                 GraphicsEnvironment.getLocalGraphicsEnvironment();
  46         GraphicsConfiguration gc =
  47                 ge.getDefaultScreenDevice().getDefaultConfiguration();
  48         VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
  49         BufferedImage bi = new BufferedImage(width / 4, height / 4,
  50                                              BufferedImage.TYPE_INT_ARGB);
  51         while (true) {
  52             vi.validate(gc);
  53             Graphics2D g2d = vi.createGraphics();


   1 /*
   2  * Copyright (c) 2013, 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 
  32 /**
  33  * @test
  34  * @key headful
  35  * @bug 8000629
  36  * @summary Temporary backbuffer in the DrawImage should have correct offset.
  37  * @author Sergey Bylokhov
  38  */
  39 public final class IncorrectOffset {
  40 
  41     private static final int width = 400;
  42     private static final int height = 400;
  43 
  44     public static void main(final String[] args) {
  45         GraphicsEnvironment ge =
  46                 GraphicsEnvironment.getLocalGraphicsEnvironment();
  47         GraphicsConfiguration gc =
  48                 ge.getDefaultScreenDevice().getDefaultConfiguration();
  49         VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
  50         BufferedImage bi = new BufferedImage(width / 4, height / 4,
  51                                              BufferedImage.TYPE_INT_ARGB);
  52         while (true) {
  53             vi.validate(gc);
  54             Graphics2D g2d = vi.createGraphics();


< prev index next >