Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/java2d/xr/XRMaskBlit.java
32288 views
/*1* Copyright (c) 2010, 2013, 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.xr;2627import static sun.java2d.loops.CompositeType.SrcNoEa;28import static sun.java2d.loops.CompositeType.SrcOver;2930import java.awt.Composite;3132import sun.awt.*;33import sun.java2d.*;34import sun.java2d.loops.*;35import sun.java2d.pipe.Region;3637/**38* For XRender there is no "blit", everything is just a fill with Repeat or Not.39* So basically this just quite the same as MaskFill.40*41* @author Clemens Eisserer42*/43public class XRMaskBlit extends MaskBlit {44static void register() {45GraphicsPrimitive[] primitives = {46new XRMaskBlit(XRSurfaceData.IntArgbPreX11, SrcOver,47XRSurfaceData.IntArgbPreX11),48new XRMaskBlit(XRSurfaceData.IntRgbX11, SrcOver,49XRSurfaceData.IntRgbX11),50new XRMaskBlit(XRSurfaceData.IntArgbPreX11, SrcNoEa,51XRSurfaceData.IntRgbX11),52new XRMaskBlit(XRSurfaceData.IntRgbX11, SrcNoEa,53XRSurfaceData.IntArgbPreX11)54};55GraphicsPrimitiveMgr.register(primitives);56}5758public XRMaskBlit(SurfaceType srcType, CompositeType compType,59SurfaceType dstType) {60super(srcType, CompositeType.AnyAlpha, dstType);61}6263protected native void maskBlit(long srcXsdo, long dstxsdo, int srcx,64int srcy, int dstx, int dsty, int w, int h, int maskoff,65int maskscan, int masklen, byte[] mask);6667public void MaskBlit(SurfaceData src, SurfaceData dst, Composite comp,68Region clip, int srcx, int srcy, int dstx, int dsty, int width,69int height, byte[] mask, int maskoff, int maskscan) {70if (width <= 0 || height <= 0) {71return;72}7374try {75SunToolkit.awtLock();7677XRSurfaceData x11sd = (XRSurfaceData) src;78x11sd.validateAsSource(null, XRUtils.RepeatNone, XRUtils.FAST);7980XRCompositeManager maskBuffer = x11sd.maskBuffer;81XRSurfaceData x11dst = (XRSurfaceData) dst;82x11dst.validateAsDestination(null, clip);8384int maskPict = maskBuffer.getMaskBuffer().85uploadMask(width, height, maskscan, maskoff, mask);86maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(),87srcx, srcy, 0, 0, dstx, dsty, width, height);88maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);89} finally {90SunToolkit.awtUnlock();91}92}93}949596