test/jdk/sun/java2d/AcceleratedXORModeTest.java
author lancea
Thu, 14 Nov 2019 10:54:32 -0500
changeset 59083 3e4d8b5856f3
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234080: jdk/nio/zipfs/CRCWriteTest.java fails Reviewed-by: clanger, amlu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     4
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     8
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    13
 * accompanied this code).
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    14
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    18
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    21
 * questions.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    22
 */
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    23
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    24
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    25
 * @test
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    26
 * @key headful
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    27
 * @bug     8024343 8042098
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    28
 * @summary Test verifies that accelerated pipelines
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    29
 *          correctly draws primitives in XOR mode.
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    30
 * @run main/othervm -Dsun.java2d.xrender=True AcceleratedXORModeTest
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25204
diff changeset
    31
 */
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    32
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    33
import java.awt.Color;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    34
import java.awt.Graphics2D;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    35
import java.awt.GraphicsConfiguration;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    36
import java.awt.GraphicsEnvironment;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    37
import java.awt.image.BufferedImage;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    38
import java.awt.image.VolatileImage;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    39
import java.io.File;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    40
import java.io.IOException;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    41
import javax.imageio.ImageIO;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    42
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    43
public class AcceleratedXORModeTest {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    44
    public static void main(String argv[]) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    45
        String fileName = argv.length > 0 ? argv[0] : null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    46
        new AcceleratedXORModeTest(fileName).test();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    47
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    48
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    49
    static final Color backColor = Color.red;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    50
    static final Color color1 = Color.green;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    51
    static final Color color2 = Color.yellow;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    52
    static final Color xorColor1 = Color.blue;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    53
    static final Color xorColor2 = Color.white;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    54
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    55
    static final int width = 700, height = 300;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    56
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    57
    VolatileImage vImg = null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    58
    String fileName;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    59
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    60
    public AcceleratedXORModeTest(String fileName) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    61
        this.fileName = fileName;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    62
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    63
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    64
    void draw(Graphics2D g) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    65
        g.setColor(backColor);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    66
        g.fillRect(0, 0, width, height);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    67
        g.setXORMode(xorColor1);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    68
        drawPattern(g, 100);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    69
        g.setXORMode(xorColor2);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    70
        drawPattern(g, 400);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    71
        g.dispose();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    72
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    73
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    74
    void test(BufferedImage bi) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    75
        comparePattern(bi, 150, xorColor1.getRGB());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    76
        comparePattern(bi, 450, xorColor2.getRGB());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    77
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    78
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    79
    void comparePattern(BufferedImage bi, int startX, int xorColor) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    80
        int[] expectedColors = {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    81
            backColor.getRGB() ^ color1.getRGB() ^ xorColor,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    82
            backColor.getRGB() ^ color1.getRGB() ^ xorColor ^
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    83
                color2.getRGB() ^ xorColor,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    84
            backColor.getRGB() ^ color2.getRGB() ^ xorColor
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    85
        };
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    86
        for (int i = 0; i < 3; i++) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    87
            int x = startX + 100 * i;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    88
            int rgb = bi.getRGB(x, 150);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    89
            if (rgb != expectedColors[i]) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    90
                String msg = "Colors mismatch: x = " + x +
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    91
                        ", got " + new Color(rgb) + ", expected " +
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    92
                        new Color(expectedColors[i]);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    93
                System.err.println(msg);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    94
                write(bi);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    95
                throw new RuntimeException("FAILED: " + msg);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    96
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    97
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    98
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    99
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   100
    void drawPattern(Graphics2D g, int x) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   101
        g.setColor(color1);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   102
        g.fillRect(x, 0, 200, 300);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   103
        g.setColor(color2);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   104
        g.fillRect(x+100, 0, 200, 300);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   105
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   106
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   107
    GraphicsConfiguration getDefaultGC() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   108
        return GraphicsEnvironment.getLocalGraphicsEnvironment().
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   109
                getDefaultScreenDevice().getDefaultConfiguration();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   110
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   111
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   112
    void createVImg() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   113
        if (vImg != null) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   114
            vImg.flush();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   115
            vImg = null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   116
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   117
        vImg = getDefaultGC().createCompatibleVolatileImage(width, height);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   118
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   119
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   120
    void write(BufferedImage bi) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   121
        if (fileName != null) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   122
            try {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   123
                ImageIO.write(bi, "png", new File(fileName));
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   124
            } catch (IOException e) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   125
                System.err.println("Can't write image file " + fileName);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   126
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   127
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   128
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   129
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   130
    void test() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   131
        createVImg();
25204
65c62411e10f 8042098: Test sun/java2d/AcceleratedXORModeTest.java fails on Windows
prr
parents: 20417
diff changeset
   132
        BufferedImage bi = null;
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   133
        do {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   134
            int valCode = vImg.validate(getDefaultGC());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   135
            if (valCode == VolatileImage.IMAGE_INCOMPATIBLE) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   136
                createVImg();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   137
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   138
            Graphics2D g = vImg.createGraphics();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   139
            draw(g);
25204
65c62411e10f 8042098: Test sun/java2d/AcceleratedXORModeTest.java fails on Windows
prr
parents: 20417
diff changeset
   140
            bi = vImg.getSnapshot();
65c62411e10f 8042098: Test sun/java2d/AcceleratedXORModeTest.java fails on Windows
prr
parents: 20417
diff changeset
   141
        } while (vImg.contentsLost());
65c62411e10f 8042098: Test sun/java2d/AcceleratedXORModeTest.java fails on Windows
prr
parents: 20417
diff changeset
   142
        if (bi != null) {
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   143
            test(bi);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   144
            write(bi);
25204
65c62411e10f 8042098: Test sun/java2d/AcceleratedXORModeTest.java fails on Windows
prr
parents: 20417
diff changeset
   145
        }
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   146
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   147
}