Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/loops/FillRect.java
38918 views
/*1* Copyright (c) 1997, 2002, 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*/2425/*26* @author Charlton Innovations, Inc.27*/2829package sun.java2d.loops;3031import sun.java2d.loops.GraphicsPrimitive;32import java.awt.Color;33import java.awt.image.ColorModel;34import java.awt.image.Raster;35import sun.java2d.SunGraphics2D;36import sun.java2d.SurfaceData;3738/**39* FillRect40* 1) draw solid color rectangle onto destination surface41* 2) must accept output area [x, y, dx, dy]42* from within the surface description data for clip rect43*/44public class FillRect extends GraphicsPrimitive45{46public final static String methodSignature = "FillRect(...)".toString();4748public final static int primTypeID = makePrimTypeID();4950public static FillRect locate(SurfaceType srctype,51CompositeType comptype,52SurfaceType dsttype)53{54return (FillRect)55GraphicsPrimitiveMgr.locate(primTypeID,56srctype, comptype, dsttype);57}5859protected FillRect(SurfaceType srctype,60CompositeType comptype,61SurfaceType dsttype)62{63super(methodSignature, primTypeID, srctype, comptype, dsttype);64}6566public FillRect(long pNativePrim,67SurfaceType srctype,68CompositeType comptype,69SurfaceType dsttype)70{71super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);72}7374/**75* All FillRect implementors must have this invoker method76*/77public native void FillRect(SunGraphics2D sg2d, SurfaceData dest,78int x, int y, int w, int h);7980static {81GraphicsPrimitiveMgr.registerGeneral(new FillRect(null, null, null));82}8384public GraphicsPrimitive makePrimitive(SurfaceType srctype,85CompositeType comptype,86SurfaceType dsttype)87{88return new General(srctype, comptype, dsttype);89}9091public static class General extends FillRect {92public MaskFill fillop;9394public General(SurfaceType srctype,95CompositeType comptype,96SurfaceType dsttype)97{98super(srctype, comptype, dsttype);99fillop = MaskFill.locate(srctype, comptype, dsttype);100}101102public void FillRect(SunGraphics2D sg2d, SurfaceData dest,103int x, int y, int w, int h)104{105fillop.MaskFill(sg2d, dest, sg2d.composite, x, y, w, h, null, 0, 0);106}107}108109public GraphicsPrimitive traceWrap() {110return new TraceFillRect(this);111}112113private static class TraceFillRect extends FillRect {114FillRect target;115116public TraceFillRect(FillRect target) {117super(target.getSourceType(),118target.getCompositeType(),119target.getDestType());120this.target = target;121}122123public GraphicsPrimitive traceWrap() {124return this;125}126127public void FillRect(SunGraphics2D sg2d, SurfaceData dest,128int x, int y, int w, int h)129{130tracePrimitive(target);131target.FillRect(sg2d, dest, x, y, w, h);132}133}134}135136137