author | goetz |
Tue, 14 Jun 2016 10:44:59 +0200 | |
changeset 39056 | d99e63b6d962 |
parent 32130 | 28cc13849717 |
permissions | -rw-r--r-- |
31155
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
1 |
/* |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
4 |
* |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
8 |
* |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
14 |
* |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
18 |
* |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
21 |
* questions. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
22 |
*/ |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
23 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
24 |
import java.awt.Color; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
25 |
import java.awt.Graphics2D; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
26 |
import java.awt.GraphicsConfiguration; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
27 |
import java.awt.GraphicsEnvironment; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
28 |
import java.awt.Image; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
29 |
import java.awt.Rectangle; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
30 |
import java.awt.Shape; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
31 |
import java.awt.geom.AffineTransform; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
32 |
import java.awt.image.BufferedImage; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
33 |
import java.awt.image.VolatileImage; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
34 |
import java.io.File; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
35 |
import java.io.IOException; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
36 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
37 |
import javax.imageio.ImageIO; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
38 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
39 |
import static java.awt.geom.Rectangle2D.Double; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
40 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
41 |
/** |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
42 |
* @test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
32130
diff
changeset
|
43 |
* @key headful |
32130
28cc13849717
8130400: Test java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java fails with ClassCastException
azvegint
parents:
31155
diff
changeset
|
44 |
* @bug 8061831 8130400 |
31155
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
45 |
* @summary Tests drawing volatile image to volatile image using different |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
46 |
* clips + xor mode. Results of the blit compatibleImage to |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
47 |
* compatibleImage is used for comparison. |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
48 |
*/ |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
49 |
public final class IncorrectClipXorModeSurface2Surface { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
50 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
51 |
private static int[] SIZES = {2, 10, 100}; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
52 |
private static final Shape[] SHAPES = { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
53 |
new Rectangle(0, 0, 0, 0), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
54 |
new Rectangle(0, 0, 1, 1), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
55 |
new Rectangle(0, 1, 1, 1), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
56 |
new Rectangle(1, 0, 1, 1), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
57 |
new Rectangle(1, 1, 1, 1), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
58 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
59 |
new Double(0, 0, 0.5, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
60 |
new Double(0, 0.5, 0.5, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
61 |
new Double(0.5, 0, 0.5, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
62 |
new Double(0.5, 0.5, 0.5, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
63 |
new Double(0.25, 0.25, 0.5, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
64 |
new Double(0, 0.25, 1, 0.5), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
65 |
new Double(0.25, 0, 0.5, 1), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
66 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
67 |
new Double(.10, .10, .20, .20), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
68 |
new Double(.75, .75, .20, .20), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
69 |
new Double(.75, .10, .20, .20), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
70 |
new Double(.10, .75, .20, .20), |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
71 |
}; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
72 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
73 |
public static void main(final String[] args) throws IOException { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
74 |
GraphicsEnvironment ge = GraphicsEnvironment |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
75 |
.getLocalGraphicsEnvironment(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
76 |
GraphicsConfiguration gc = ge.getDefaultScreenDevice() |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
77 |
.getDefaultConfiguration(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
78 |
AffineTransform at; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
79 |
for (int size : SIZES) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
80 |
at = AffineTransform.getScaleInstance(size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
81 |
for (Shape clip : SHAPES) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
82 |
clip = at.createTransformedShape(clip); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
83 |
for (Shape to : SHAPES) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
84 |
to = at.createTransformedShape(to); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
85 |
// Prepare test images |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
86 |
BufferedImage snapshot; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
87 |
VolatileImage source = getVolatileImage(gc, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
88 |
VolatileImage target = getVolatileImage(gc, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
89 |
int attempt = 0; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
90 |
while (true) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
91 |
if (++attempt > 10) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
92 |
throw new RuntimeException("Too many attempts: " + attempt); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
93 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
94 |
// Prepare source images |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
95 |
source.validate(gc); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
96 |
Graphics2D g2d = source.createGraphics(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
97 |
g2d.setColor(Color.RED); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
98 |
g2d.fillRect(0, 0, size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
99 |
g2d.dispose(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
100 |
if (source.validate(gc) != VolatileImage.IMAGE_OK) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
101 |
continue; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
102 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
103 |
// Prepare target images |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
104 |
target.validate(gc); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
105 |
g2d = target.createGraphics(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
106 |
g2d.setColor(Color.GREEN); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
107 |
g2d.fillRect(0, 0, size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
108 |
g2d.dispose(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
109 |
if (target.validate(gc) != VolatileImage.IMAGE_OK) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
110 |
continue; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
111 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
112 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
113 |
draw(clip, to, source, target); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
114 |
snapshot = target.getSnapshot(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
115 |
if (source.contentsLost() || target.contentsLost()) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
116 |
continue; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
117 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
118 |
break; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
119 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
120 |
// Prepare gold images |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
121 |
BufferedImage goldS = getSourceGold(gc, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
122 |
BufferedImage goldT = getTargetGold(gc, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
123 |
draw(clip, to, goldS, goldT); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
124 |
validate(snapshot, goldT); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
125 |
source.flush(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
126 |
target.flush(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
127 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
128 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
129 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
130 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
131 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
132 |
private static void draw(Shape clip, Shape shape, Image from, Image to) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
133 |
Graphics2D g2d = (Graphics2D) to.getGraphics(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
134 |
g2d.setXORMode(Color.BLACK); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
135 |
g2d.setClip(clip); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
136 |
Rectangle toBounds = shape.getBounds(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
137 |
g2d.drawImage(from, toBounds.x, toBounds.y, toBounds.width, |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
138 |
toBounds.height, null); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
139 |
g2d.dispose(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
140 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
141 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
142 |
private static BufferedImage getSourceGold(GraphicsConfiguration gc, |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
143 |
int size) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
144 |
final BufferedImage bi = gc.createCompatibleImage(size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
145 |
Graphics2D g2d = bi.createGraphics(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
146 |
g2d.setColor(Color.RED); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
147 |
g2d.fillRect(0, 0, size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
148 |
g2d.dispose(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
149 |
return bi; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
150 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
151 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
152 |
private static BufferedImage getTargetGold(GraphicsConfiguration gc, |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
153 |
int size) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
154 |
BufferedImage image = gc.createCompatibleImage(size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
155 |
Graphics2D g2d = image.createGraphics(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
156 |
g2d.setColor(Color.GREEN); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
157 |
g2d.fillRect(0, 0, size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
158 |
g2d.dispose(); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
159 |
return image; |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
160 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
161 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
162 |
private static VolatileImage getVolatileImage(GraphicsConfiguration gc, |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
163 |
int size) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
164 |
return gc.createCompatibleVolatileImage(size, size); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
165 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
166 |
|
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
167 |
private static void validate(BufferedImage bi, BufferedImage goldbi) |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
168 |
throws IOException { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
169 |
for (int x = 0; x < bi.getWidth(); ++x) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
170 |
for (int y = 0; y < bi.getHeight(); ++y) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
171 |
if (goldbi.getRGB(x, y) != bi.getRGB(x, y)) { |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
172 |
ImageIO.write(bi, "png", new File("actual.png")); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
173 |
ImageIO.write(goldbi, "png", new File("expected.png")); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
174 |
throw new RuntimeException("Test failed."); |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
175 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
176 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
177 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
178 |
} |
272c0790761f
8061831: [OGL] "java.lang.InternalError: not implemented yet" during the blit of VI to VI in xor mode
serb
parents:
diff
changeset
|
179 |
} |