author | serb |
Fri, 11 Apr 2014 17:28:45 +0400 | |
changeset 24179 | c80b1690a57b |
child 39056 | d99e63b6d962 |
permissions | -rw-r--r-- |
24179
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
1 |
/* |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
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 |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
33 |
* @bug 8039774 |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
34 |
* @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
|
35 |
* 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
|
36 |
* @author Sergey Bylokhov |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
37 |
* @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
|
38 |
*/ |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
39 |
public final class DrawCachedImageAndTransform { |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
40 |
|
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
41 |
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
|
42 |
GraphicsEnvironment ge = GraphicsEnvironment |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
43 |
.getLocalGraphicsEnvironment(); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
44 |
GraphicsConfiguration gc = ge.getDefaultScreenDevice() |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
45 |
.getDefaultConfiguration(); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
46 |
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
|
47 |
|
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
48 |
Graphics2D g2d = vi.createGraphics(); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
49 |
g2d.scale(2, 2); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
50 |
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
|
51 |
BufferedImage.TYPE_INT_ARGB); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
52 |
|
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
53 |
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
|
54 |
g2d.dispose(); |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
55 |
} |
c80b1690a57b
8039774: [OGL] Image painting is broken if 'sun.java2d.accthreshold' is set to 0
serb
parents:
diff
changeset
|
56 |
} |