Path: blob/master/src/java.desktop/share/classes/sun/java2d/loops/FillSpans.java
41159 views
/*1* Copyright (c) 1998, 2021, 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 Jim Graham27* @author Charlton Innovations, Inc.28*/2930package sun.java2d.loops;3132import sun.java2d.SunGraphics2D;33import sun.java2d.SurfaceData;34import sun.java2d.pipe.SpanIterator;3536/**37* FillSpans38* 1) draw solid color onto destination surface39* 2) rectangular areas to fill come from SpanIterator40*/41public class FillSpans extends GraphicsPrimitive42{43public static final String methodSignature = "FillSpans(...)".toString();4445public static final int primTypeID = makePrimTypeID();4647public static FillSpans locate(SurfaceType srctype,48CompositeType comptype,49SurfaceType dsttype)50{51return (FillSpans)52GraphicsPrimitiveMgr.locate(primTypeID,53srctype, comptype, dsttype);54}5556protected FillSpans(SurfaceType srctype,57CompositeType comptype,58SurfaceType dsttype)59{60super(methodSignature, primTypeID, srctype, comptype, dsttype);61}6263public FillSpans(long pNativePrim,64SurfaceType srctype,65CompositeType comptype,66SurfaceType dsttype)67{68super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);69}7071private native void FillSpans(SunGraphics2D sg2d, SurfaceData dest,72int pixel, long pIterator, SpanIterator si);7374/**75* All FillSpan implementors must have this invoker method76*/77public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,78SpanIterator si)79{80FillSpans(sg2d, dest, sg2d.pixel, si.getNativeIterator(), si);81}8283public GraphicsPrimitive traceWrap() {84return new TraceFillSpans(this);85}8687private static class TraceFillSpans extends FillSpans {88FillSpans target;8990public TraceFillSpans(FillSpans target) {91super(target.getSourceType(),92target.getCompositeType(),93target.getDestType());94this.target = target;95}9697public GraphicsPrimitive traceWrap() {98return this;99}100101public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,102SpanIterator si)103{104tracePrimitive(target);105target.FillSpans(sg2d, dest, si);106}107}108}109110111