Path: blob/master/test/jdk/sun/java2d/DrawCachedImageAndTransform.java
41144 views
/*1* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.awt.Color;24import java.awt.Graphics2D;25import java.awt.GraphicsConfiguration;26import java.awt.GraphicsEnvironment;27import java.awt.image.BufferedImage;28import java.awt.image.VolatileImage;2930/**31* @test32* @key headful33* @bug 803977434* @summary Verifies that we get no exception, when we draw with scale35* BufferedImage to VolatileImage via intermediate texture.36* @author Sergey Bylokhov37* @run main/othervm -Dsun.java2d.accthreshold=0 DrawCachedImageAndTransform38*/39public final class DrawCachedImageAndTransform {4041public static void main(String[] args) {42GraphicsEnvironment ge = GraphicsEnvironment43.getLocalGraphicsEnvironment();44GraphicsConfiguration gc = ge.getDefaultScreenDevice()45.getDefaultConfiguration();46VolatileImage vi = gc.createCompatibleVolatileImage(100, 100);4748Graphics2D g2d = vi.createGraphics();49g2d.scale(2, 2);50BufferedImage img = new BufferedImage(50, 50,51BufferedImage.TYPE_INT_ARGB);5253g2d.drawImage(img, 10, 25, Color.blue, null);54g2d.dispose();55}56}575859