< prev index next >

test/java/awt/image/DrawImage/UnmanagedDrawImagePerformance.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  */


  24 import java.awt.AlphaComposite;
  25 import java.awt.Graphics2D;
  26 import java.awt.GraphicsConfiguration;
  27 import java.awt.GraphicsDevice;
  28 import java.awt.GraphicsEnvironment;
  29 import java.awt.Image;
  30 import java.awt.Polygon;
  31 import java.awt.geom.AffineTransform;
  32 import java.awt.image.BufferedImage;
  33 import java.awt.image.DataBuffer;
  34 import java.awt.image.DataBufferByte;
  35 import java.awt.image.DataBufferInt;
  36 import java.awt.image.DataBufferShort;
  37 import java.awt.image.VolatileImage;
  38 
  39 import static java.awt.Transparency.*;
  40 import static java.awt.image.BufferedImage.*;
  41 
  42 /*
  43  * @test

  44  * @bug 8029253 8059941
  45  * @summary Unmanaged images should be drawn fast.
  46  * @author Sergey Bylokhov
  47  */
  48 public final class UnmanagedDrawImagePerformance {
  49 
  50     private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB,
  51                                         TYPE_INT_ARGB_PRE, TYPE_INT_BGR,
  52                                         TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR,
  53                                         TYPE_4BYTE_ABGR_PRE,
  54                                         TYPE_USHORT_565_RGB,
  55                                         TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY,
  56                                         TYPE_USHORT_GRAY, TYPE_BYTE_BINARY,
  57                                         TYPE_BYTE_INDEXED};
  58     private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT};
  59     private static final int SIZE = 1000;
  60     private static final AffineTransform[] TRANSFORMS = {
  61             AffineTransform.getScaleInstance(.5, .5),
  62             AffineTransform.getScaleInstance(1, 1),
  63             AffineTransform.getScaleInstance(2, 2),


   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  */


  24 import java.awt.AlphaComposite;
  25 import java.awt.Graphics2D;
  26 import java.awt.GraphicsConfiguration;
  27 import java.awt.GraphicsDevice;
  28 import java.awt.GraphicsEnvironment;
  29 import java.awt.Image;
  30 import java.awt.Polygon;
  31 import java.awt.geom.AffineTransform;
  32 import java.awt.image.BufferedImage;
  33 import java.awt.image.DataBuffer;
  34 import java.awt.image.DataBufferByte;
  35 import java.awt.image.DataBufferInt;
  36 import java.awt.image.DataBufferShort;
  37 import java.awt.image.VolatileImage;
  38 
  39 import static java.awt.Transparency.*;
  40 import static java.awt.image.BufferedImage.*;
  41 
  42 /*
  43  * @test
  44  * @key headful
  45  * @bug 8029253 8059941
  46  * @summary Unmanaged images should be drawn fast.
  47  * @author Sergey Bylokhov
  48  */
  49 public final class UnmanagedDrawImagePerformance {
  50 
  51     private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB,
  52                                         TYPE_INT_ARGB_PRE, TYPE_INT_BGR,
  53                                         TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR,
  54                                         TYPE_4BYTE_ABGR_PRE,
  55                                         TYPE_USHORT_565_RGB,
  56                                         TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY,
  57                                         TYPE_USHORT_GRAY, TYPE_BYTE_BINARY,
  58                                         TYPE_BYTE_INDEXED};
  59     private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT};
  60     private static final int SIZE = 1000;
  61     private static final AffineTransform[] TRANSFORMS = {
  62             AffineTransform.getScaleInstance(.5, .5),
  63             AffineTransform.getScaleInstance(1, 1),
  64             AffineTransform.getScaleInstance(2, 2),


< prev index next >