< prev index next >

src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java

Print this page
rev 48927 : Xrender: make aa tile mask handling a responsibility of the backend implementation
rev 48932 : XRender: Update+introduce copyright statements + comments + unused import removal
   1 /*
   2  * Copyright (c) 2010, 2013, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  65             int srcy, int dstx, int dsty, int w, int h, int maskoff,
  66             int maskscan, int masklen, byte[] mask);
  67 
  68     public void MaskBlit(SurfaceData src, SurfaceData dst, Composite comp,
  69             Region clip, int srcx, int srcy, int dstx, int dsty, int width,
  70             int height, byte[] mask, int maskoff, int maskscan) {
  71         if (width <= 0 || height <= 0) {
  72             return;
  73         }
  74 
  75         try {
  76             SunToolkit.awtLock();
  77 
  78             XRSurfaceData x11sd = (XRSurfaceData) src;
  79             x11sd.validateAsSource(null, XRUtils.RepeatNone, XRUtils.FAST);
  80 
  81             XRCompositeManager maskBuffer = x11sd.maskBuffer;
  82             XRSurfaceData x11dst = (XRSurfaceData) dst;
  83             x11dst.validateAsDestination(null, clip);
  84 
  85             int maskPict = maskBuffer.getMaskBuffer().
  86                          uploadMask(width, height, maskscan, maskoff, mask);
  87             maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(),
  88                                   srcx, srcy, 0, 0, dstx, dsty, width, height);
  89             maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);
  90         } finally {
  91             SunToolkit.awtUnlock();
  92         }
  93     }
  94 }
   1 /*
   2  * Copyright (c) 2010, 2018, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  65             int srcy, int dstx, int dsty, int w, int h, int maskoff,
  66             int maskscan, int masklen, byte[] mask);
  67 
  68     public void MaskBlit(SurfaceData src, SurfaceData dst, Composite comp,
  69             Region clip, int srcx, int srcy, int dstx, int dsty, int width,
  70             int height, byte[] mask, int maskoff, int maskscan) {
  71         if (width <= 0 || height <= 0) {
  72             return;
  73         }
  74 
  75         try {
  76             SunToolkit.awtLock();
  77 
  78             XRSurfaceData x11sd = (XRSurfaceData) src;
  79             x11sd.validateAsSource(null, XRUtils.RepeatNone, XRUtils.FAST);
  80 
  81             XRCompositeManager maskBuffer = x11sd.maskBuffer;
  82             XRSurfaceData x11dst = (XRSurfaceData) dst;
  83             x11dst.validateAsDestination(null, clip);
  84             
  85             maskBuffer.XRMaskedComposite(XRUtils.None, x11sd.picture, srcx, srcy, dstx, dsty, width, height, maskscan, maskoff, mask);




  86         } finally {
  87             SunToolkit.awtUnlock();
  88         }
  89     }
  90 }
< prev index next >