2370N/A/*
2685N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2370N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2370N/A *
2370N/A * This code is free software; you can redistribute it and/or modify it
2370N/A * under the terms of the GNU General Public License version 2 only, as
2685N/A * published by the Free Software Foundation. Oracle designates this
2370N/A * particular file as subject to the "Classpath" exception as provided
2685N/A * by Oracle in the LICENSE file that accompanied this code.
2370N/A *
2370N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2370N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2370N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2370N/A * version 2 for more details (a copy is included in the LICENSE file that
2370N/A * accompanied this code).
2370N/A *
2370N/A * You should have received a copy of the GNU General Public License version
2370N/A * 2 along with this work; if not, write to the Free Software Foundation,
2370N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2370N/A *
2685N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2685N/A * or visit www.oracle.com if you need additional information or have any
2685N/A * questions.
2370N/A */
2370N/A
2370N/Apackage sun.java2d.xr;
2370N/A
2370N/Aimport java.awt.*;
2370N/Aimport java.awt.geom.*;
2370N/A
2370N/Aimport sun.java2d.*;
2370N/Aimport sun.java2d.loops.*;
2370N/Aimport sun.java2d.pipe.*;
2370N/A
2370N/A/**
2370N/A * Class used for re-routing transformed blits to the accelerated loops.
2370N/A */
2370N/A
2370N/Apublic class XRDrawImage extends DrawImage {
2370N/A @Override
2370N/A protected void renderImageXform(SunGraphics2D sg, Image img,
2370N/A AffineTransform tx, int interpType, int sx1, int sy1, int sx2,
2370N/A int sy2, Color bgColor) {
2370N/A SurfaceData dstData = sg.surfaceData;
2370N/A SurfaceData srcData = dstData.getSourceSurfaceData(img,
2370N/A SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
2370N/A
2370N/A if (srcData != null && !isBgOperation(srcData, bgColor)) { // TODO: Do we bail out on bgBlits?
2370N/A // && srcData instanceof XRSurfaceData) {
2370N/A SurfaceType srcType = srcData.getSurfaceType();
2370N/A SurfaceType dstType = dstData.getSurfaceType();
2370N/A
2370N/A TransformBlit blit = TransformBlit.getFromCache(srcType,
2370N/A sg.imageComp, dstType);
2370N/A
2370N/A if (blit != null) {
2370N/A blit.Transform(srcData, dstData, sg.composite,
2370N/A sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
2370N/A - sx1, sy2 - sy1);
2370N/A return;
2370N/A }
2370N/A }
2370N/A
2370N/A super.renderImageXform(sg, img, tx, interpType, sx1, sy1, sx2, sy2,
2370N/A bgColor);
2370N/A }
2370N/A}