author | lancea |
Thu, 14 Nov 2019 10:54:32 -0500 | |
changeset 59083 | 3e4d8b5856f3 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
8940
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
1 |
/* |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
2 |
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
8940
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
4 |
* |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
8 |
* |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
13 |
* accompanied this code). |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
14 |
* |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
18 |
* |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
21 |
* questions. |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
22 |
*/ |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
23 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
24 |
/* |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
25 |
* @test |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
26 |
* @key headful |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
27 |
* @bug 6985593 |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
28 |
* @summary Test verifies that rendering standard images to screen does |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
29 |
* not caiuse a crash in case of XRender. |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
30 |
* @run main/othervm -Dsun.java2d.xrender=True XRenderBlitsTest |
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
8940
diff
changeset
|
31 |
*/ |
8940
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
32 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
33 |
import java.awt.Color; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
34 |
import java.awt.Component; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
35 |
import java.awt.Dimension; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
36 |
import java.awt.Frame; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
37 |
import java.awt.Graphics; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
38 |
import java.awt.Graphics2D; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
39 |
import java.awt.image.BufferedImage; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
40 |
import java.util.ArrayList; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
41 |
import java.util.concurrent.CountDownLatch; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
42 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
43 |
public class XRenderBlitsTest { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
44 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
45 |
private static final int w = 10; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
46 |
private static final int h = 10; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
47 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
48 |
public static void main(String[] args) { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
49 |
final CountDownLatch done = new CountDownLatch(1); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
50 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
51 |
final ArrayList<BufferedImage> images = new ArrayList<BufferedImage>(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
52 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
53 |
int type = BufferedImage.TYPE_INT_RGB; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
54 |
do { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
55 |
BufferedImage img = new BufferedImage(w, h, type++); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
56 |
Graphics2D g2d = img.createGraphics(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
57 |
g2d.setColor(Color.pink); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
58 |
g2d.fillRect(0, 0, w, h); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
59 |
g2d.dispose(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
60 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
61 |
images.add(img); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
62 |
} while (type <= BufferedImage.TYPE_BYTE_INDEXED); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
63 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
64 |
Frame f = new Frame("Draw images"); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
65 |
Component c = new Component() { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
66 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
67 |
@Override |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
68 |
public Dimension getPreferredSize() { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
69 |
return new Dimension(w * images.size(), h); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
70 |
} |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
71 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
72 |
@Override |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
73 |
public void paint(Graphics g) { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
74 |
int x = 0; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
75 |
for (BufferedImage img : images) { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
76 |
System.out.println("Draw image " + img.getType()); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
77 |
g.drawImage(img, x, 0, this); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
78 |
x += w; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
79 |
} |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
80 |
done.countDown(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
81 |
} |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
82 |
}; |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
83 |
f.add("Center", c); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
84 |
f.pack(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
85 |
f.setVisible(true); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
86 |
|
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
87 |
// now wait for test results |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
88 |
try { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
89 |
done.await(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
90 |
} catch (InterruptedException e) { |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
91 |
} |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
92 |
System.out.println("Test passed"); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
93 |
f.dispose(); |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
94 |
} |
7a0c1d4e2982
6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64
bae
parents:
diff
changeset
|
95 |
} |