jdk/test/sun/java2d/DrawCachedImageAndTransform.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 24179 c80b1690a57b
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24179
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 24179
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
24179
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     4
 *
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     8
 *
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    13
 * accompanied this code).
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    14
 *
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    18
 *
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    21
 * questions.
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    22
 */
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    23
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    24
import java.awt.Color;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    25
import java.awt.Graphics2D;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    26
import java.awt.GraphicsConfiguration;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    27
import java.awt.GraphicsEnvironment;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    28
import java.awt.image.BufferedImage;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    29
import java.awt.image.VolatileImage;
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    30
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    31
/**
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    32
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 24179
diff changeset
    33
 * @key headful
24179
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    34
 * @bug 8039774
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    35
 * @summary Verifies that we get no exception, when we draw with scale
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    36
 *          BufferedImage to VolatileImage via intermediate texture.
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    37
 * @author Sergey Bylokhov
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    38
 * @run main/othervm -Dsun.java2d.accthreshold=0 DrawCachedImageAndTransform
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    39
 */
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    40
public final class DrawCachedImageAndTransform {
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    41
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    42
    public static void main(String[] args) {
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    43
        GraphicsEnvironment ge = GraphicsEnvironment
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    44
                .getLocalGraphicsEnvironment();
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    45
        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    46
                                     .getDefaultConfiguration();
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    47
        VolatileImage vi = gc.createCompatibleVolatileImage(100, 100);
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    48
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    49
        Graphics2D g2d = vi.createGraphics();
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    50
        g2d.scale(2, 2);
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    51
        BufferedImage img = new BufferedImage(50, 50,
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    52
                                              BufferedImage.TYPE_INT_ARGB);
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    53
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    54
        g2d.drawImage(img, 10, 25, Color.blue, null);
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    55
        g2d.dispose();
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    56
    }
c80b1690a57b 8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff changeset
    57
}