Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/classes/sun/java2d/d3d/D3DDrawImage.java
32288 views
/*1* Copyright (c) 2007, 2008, 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. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.java2d.d3d;2627import java.awt.Color;28import java.awt.Image;29import java.awt.geom.AffineTransform;30import java.awt.image.AffineTransformOp;31import java.awt.image.BufferedImage;32import java.awt.image.BufferedImageOp;33import sun.java2d.SunGraphics2D;34import sun.java2d.SurfaceData;35import sun.java2d.loops.SurfaceType;36import sun.java2d.loops.TransformBlit;37import sun.java2d.pipe.DrawImage;3839public class D3DDrawImage extends DrawImage {4041@Override42protected void renderImageXform(SunGraphics2D sg, Image img,43AffineTransform tx, int interpType,44int sx1, int sy1, int sx2, int sy2,45Color bgColor)46{47// punt to the MediaLib-based transformImage() in the superclass if:48// - bicubic interpolation is specified49// - a background color is specified and will be used50// - an appropriate TransformBlit primitive could not be found51if (interpType != AffineTransformOp.TYPE_BICUBIC) {52SurfaceData dstData = sg.surfaceData;53SurfaceData srcData =54dstData.getSourceSurfaceData(img,55sg.TRANSFORM_GENERIC,56sg.imageComp,57bgColor);5859if (srcData != null && !isBgOperation(srcData, bgColor)) {60SurfaceType srcType = srcData.getSurfaceType();61SurfaceType dstType = dstData.getSurfaceType();62TransformBlit blit = TransformBlit.getFromCache(srcType,63sg.imageComp,64dstType);6566if (blit != null) {67blit.Transform(srcData, dstData,68sg.composite, sg.getCompClip(),69tx, interpType,70sx1, sy1, 0, 0, sx2-sx1, sy2-sy1);71return;72}73}74}7576super.renderImageXform(sg, img, tx, interpType,77sx1, sy1, sx2, sy2, bgColor);78}7980@Override81public void transformImage(SunGraphics2D sg, BufferedImage img,82BufferedImageOp op, int x, int y)83{84if (op != null) {85if (op instanceof AffineTransformOp) {86AffineTransformOp atop = (AffineTransformOp) op;87transformImage(sg, img, x, y,88atop.getTransform(),89atop.getInterpolationType());90return;91} else {92if (D3DBufImgOps.renderImageWithOp(sg, img, op, x, y)) {93return;94}95}96img = op.filter(img, null);97}98copyImage(sg, img, x, y, null);99}100}101102103