author | alexsch |
Thu, 31 Jul 2014 14:28:10 +0400 | |
changeset 26019 | 10a56d28f48d |
parent 14646 | 94eed98a7ecb |
child 39056 | d99e63b6d962 |
permissions | -rw-r--r-- |
14646
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
1 |
/* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
4 |
* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
8 |
* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
13 |
* accompanied this code). |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
14 |
* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
18 |
* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
21 |
* questions. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
22 |
*/ |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
23 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
24 |
/* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
25 |
* @test |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
26 |
* @bug 7124347 |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
27 |
* @summary Verifies that rendering with XOR composite, and arbitraty |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
28 |
* custom composite doesn not cause internal errors. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
29 |
* |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
30 |
* @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
31 |
*/ |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
32 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
33 |
import java.awt.AWTException; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
34 |
import java.awt.Color; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
35 |
import java.awt.Composite; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
36 |
import java.awt.CompositeContext; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
37 |
import java.awt.Dimension; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
38 |
import java.awt.GradientPaint; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
39 |
import java.awt.Graphics; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
40 |
import java.awt.Graphics2D; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
41 |
import java.awt.GraphicsConfiguration; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
42 |
import java.awt.GraphicsEnvironment; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
43 |
import java.awt.ImageCapabilities; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
44 |
import java.awt.RenderingHints; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
45 |
import java.awt.image.BufferedImage; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
46 |
import java.awt.image.ColorModel; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
47 |
import java.awt.image.DataBufferInt; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
48 |
import java.awt.image.Raster; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
49 |
import java.awt.image.SinglePixelPackedSampleModel; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
50 |
import java.awt.image.VolatileImage; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
51 |
import java.awt.image.WritableRaster; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
52 |
import java.util.concurrent.CountDownLatch; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
53 |
import javax.swing.JComponent; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
54 |
import javax.swing.JFrame; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
55 |
import javax.swing.SwingUtilities; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
56 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
57 |
public class CustomCompositeTest { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
58 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
59 |
private static JFrame frame; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
60 |
private static CountDownLatch paintLatch; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
61 |
private static Throwable paintError; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
62 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
63 |
public static void main(String[] args) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
64 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
65 |
paintLatch = new CountDownLatch(1); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
66 |
paintError = null; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
67 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
68 |
SwingUtilities.invokeLater(new Runnable() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
69 |
public void run() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
70 |
initGUI(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
71 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
72 |
}); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
73 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
74 |
try { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
75 |
paintLatch.await(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
76 |
} catch (InterruptedException e) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
77 |
}; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
78 |
System.out.println("Paint is done!"); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
79 |
if (paintError != null) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
80 |
frame.dispose(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
81 |
throw new RuntimeException("Test FAILED.", paintError); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
82 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
83 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
84 |
System.out.println("Phase 1: PASSED."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
85 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
86 |
// now resise the frame in order to cause re-paint with accelerated |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
87 |
// source images. |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
88 |
paintError = null; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
89 |
paintLatch = new CountDownLatch(1); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
90 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
91 |
SwingUtilities.invokeLater(new Runnable() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
92 |
@Override |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
93 |
public void run() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
94 |
Dimension size = frame.getSize(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
95 |
size.width += 50; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
96 |
size.height += 50; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
97 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
98 |
frame.setSize(size); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
99 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
100 |
}); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
101 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
102 |
try { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
103 |
paintLatch.await(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
104 |
} catch (InterruptedException e) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
105 |
}; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
106 |
if (paintError != null) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
107 |
frame.dispose(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
108 |
throw new RuntimeException("Resize test FAILED.", paintError); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
109 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
110 |
frame.dispose(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
111 |
System.out.println("Phase 2: PASSED."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
112 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
113 |
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
114 |
GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
115 |
// test rendering to accelerated volatile image |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
116 |
testVolatileImage(cfg, true); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
117 |
System.out.println("Phase 3: PASSED."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
118 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
119 |
// test rendering to unaccelerated volatile image |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
120 |
testVolatileImage(cfg, false); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
121 |
System.out.println("Phase 4: PASSED."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
122 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
123 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
124 |
private static void testVolatileImage(GraphicsConfiguration cfg, |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
125 |
boolean accelerated) |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
126 |
{ |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
127 |
VolatileImage dst = null; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
128 |
try { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
129 |
dst = cfg.createCompatibleVolatileImage(640, 480, |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
130 |
new ImageCapabilities(accelerated)); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
131 |
} catch (AWTException e) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
132 |
System.out.println("Unable to create volatile image, skip the test."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
133 |
return; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
134 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
135 |
renderToVolatileImage(dst); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
136 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
137 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
138 |
private static void renderToVolatileImage(VolatileImage dst) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
139 |
Graphics2D g = dst.createGraphics(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
140 |
do { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
141 |
System.out.println("Render to volatile image.."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
142 |
try { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
143 |
MyComp.renderTest(g, dst.getHeight(), dst.getHeight()); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
144 |
} catch (Throwable e) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
145 |
throw new RuntimeException("Test FAILED.", e); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
146 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
147 |
} while (dst.contentsLost()); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
148 |
System.out.println("Done."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
149 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
150 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
151 |
private static void initGUI() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
152 |
frame = new JFrame("Silly composite"); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
153 |
frame.getContentPane().add(new MyComp()); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
154 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
155 |
frame.pack(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
156 |
frame.setVisible(true); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
157 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
158 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
159 |
private static class MyComp extends JComponent { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
160 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
161 |
private static BufferedImage theImage; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
162 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
163 |
public MyComp() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
164 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
165 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
166 |
private static BufferedImage getTestImage() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
167 |
if (theImage == null) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
168 |
theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
169 |
Graphics2D g2d = theImage.createGraphics(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
170 |
g2d.setColor(Color.red); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
171 |
g2d.fillRect(0, 0, 256, 256); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
172 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
173 |
g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue)); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
174 |
g2d.fillRect(0, 100, 256, 256); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
175 |
g2d.dispose(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
176 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
177 |
return theImage; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
178 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
179 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
180 |
public Dimension getPreferredSize() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
181 |
return new Dimension(640, 375); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
182 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
183 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
184 |
public void paintComponent(Graphics g) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
185 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
186 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
187 |
Graphics2D g2d = (Graphics2D) g; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
188 |
try { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
189 |
renderTest(g2d, getWidth(), getHeight()); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
190 |
} catch (Throwable e) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
191 |
paintError = e; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
192 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
193 |
if (paintLatch != null) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
194 |
paintLatch.countDown(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
195 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
196 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
197 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
198 |
public static void renderTest(Graphics2D g2d, int w, int h) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
199 |
g2d.setColor(Color.yellow); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
200 |
g2d.fillRect(0, 0, w, h); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
201 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
202 |
BufferedImage image = getTestImage(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
203 |
// draw original image |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
204 |
g2d.drawRenderedImage(image, null); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
205 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
206 |
// draw image with custom composite |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
207 |
g2d.translate(175, 25); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
208 |
Composite currentComposite = g2d.getComposite(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
209 |
g2d.setComposite(new TestComposite()); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
210 |
g2d.drawRenderedImage(image, null); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
211 |
g2d.setComposite(currentComposite); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
212 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
213 |
// draw image with XOR |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
214 |
g2d.translate(175, 25); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
215 |
g2d.setXORMode(Color.red); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
216 |
g2d.drawRenderedImage(image, null); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
217 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
218 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
219 |
System.out.println("Painting is done..."); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
220 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
221 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
222 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
223 |
// A silly custom Composite to demonstrate the problem - just inverts the RGB |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
224 |
private static class TestComposite implements Composite { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
225 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
226 |
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
227 |
return new TestCompositeContext(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
228 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
229 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
230 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
231 |
private static class TestCompositeContext implements CompositeContext { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
232 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
233 |
public void dispose() { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
234 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
235 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
236 |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
237 |
int w = src.getWidth(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
238 |
int h = src.getHeight(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
239 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
240 |
DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
241 |
DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
242 |
int srcRGB[] = srcDB.getBankData()[0]; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
243 |
int dstOutRGB[] = dstOutDB.getBankData()[0]; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
244 |
int srcOffset = srcDB.getOffset(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
245 |
int dstOutOffset = dstOutDB.getOffset(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
246 |
int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
247 |
int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
248 |
int srcAdjust = srcScanStride - w; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
249 |
int dstOutAdjust = dstOutScanStride - w; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
250 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
251 |
int si = srcOffset; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
252 |
int doi = dstOutOffset; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
253 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
254 |
for (int i = 0; i < h; i++) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
255 |
for (int j = 0; j < w; j++) { |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
256 |
dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
257 |
si++; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
258 |
doi++; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
259 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
260 |
|
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
261 |
si += srcAdjust; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
262 |
doi += dstOutAdjust; |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
263 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
264 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
265 |
} |
94eed98a7ecb
7124347: [macosx] java.lang.InternalError: not implemented yet on call Graphics2D.drawRenderedImage
bae
parents:
diff
changeset
|
266 |
} |