1 /*
2 * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Color;
25 import java.awt.Frame;
26 import java.awt.Graphics;
27 import java.awt.Graphics2D;
28 import java.awt.GraphicsConfiguration;
29 import java.awt.GraphicsEnvironment;
30 import java.awt.RenderingHints;
31 import java.awt.Toolkit;
32 import java.awt.image.BufferedImage;
33 import java.awt.image.VolatileImage;
34 import java.io.File;
35 import java.io.IOException;
36 import javax.imageio.ImageIO;
37
38 /**
39 * @test
40 * @bug 6429665
41 * @bug 6588884
42 * @summary Tests that the transform is correctly handled
43 * @author Dmitri.Trembovetski area=Graphics
44 * @run main AcceleratedScaleTest
45 * @run main/othervm -Dsun.java2d.d3d=true AcceleratedScaleTest
46 * @run main/othervm -Dsun.java2d.opengl=true AcceleratedScaleTest
47 */
48 public class AcceleratedScaleTest {
49 private static final int IMAGE_SIZE = 200;
50 private static VolatileImage destVI;
51
52 private static void initVI(GraphicsConfiguration gc) {
53 int res;
54 if (destVI == null) {
55 res = VolatileImage.IMAGE_INCOMPATIBLE;
56 } else {
57 res = destVI.validate(gc);
58 }
59 if (res == VolatileImage.IMAGE_INCOMPATIBLE) {
|
1 /*
2 * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Color;
25 import java.awt.Frame;
26 import java.awt.Graphics;
27 import java.awt.Graphics2D;
28 import java.awt.GraphicsConfiguration;
29 import java.awt.GraphicsEnvironment;
30 import java.awt.RenderingHints;
31 import java.awt.Toolkit;
32 import java.awt.image.BufferedImage;
33 import java.awt.image.VolatileImage;
34 import java.io.File;
35 import java.io.IOException;
36 import javax.imageio.ImageIO;
37
38 /**
39 * @test
40 * @key headful
41 * @bug 6429665
42 * @bug 6588884
43 * @summary Tests that the transform is correctly handled
44 * @author Dmitri.Trembovetski area=Graphics
45 * @run main AcceleratedScaleTest
46 * @run main/othervm -Dsun.java2d.d3d=true AcceleratedScaleTest
47 * @run main/othervm -Dsun.java2d.opengl=true AcceleratedScaleTest
48 */
49 public class AcceleratedScaleTest {
50 private static final int IMAGE_SIZE = 200;
51 private static VolatileImage destVI;
52
53 private static void initVI(GraphicsConfiguration gc) {
54 int res;
55 if (destVI == null) {
56 res = VolatileImage.IMAGE_INCOMPATIBLE;
57 } else {
58 res = destVI.validate(gc);
59 }
60 if (res == VolatileImage.IMAGE_INCOMPATIBLE) {
|