Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/loops/FillSpans.java
38918 views
/*1* Copyright (c) 1998, 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 Jim Graham27* @author Charlton Innovations, Inc.28*/2930package sun.java2d.loops;3132import sun.java2d.loops.GraphicsPrimitive;33import sun.java2d.pipe.SpanIterator;34import java.awt.Color;35import java.awt.image.ColorModel;36import java.awt.image.Raster;37import sun.java2d.SunGraphics2D;38import sun.java2d.SurfaceData;3940/**41* FillSpans42* 1) draw solid color onto destination surface43* 2) rectangular areas to fill come from SpanIterator44*/45public class FillSpans extends GraphicsPrimitive46{47public final static String methodSignature = "FillSpans(...)".toString();4849public final static int primTypeID = makePrimTypeID();5051public static FillSpans locate(SurfaceType srctype,52CompositeType comptype,53SurfaceType dsttype)54{55return (FillSpans)56GraphicsPrimitiveMgr.locate(primTypeID,57srctype, comptype, dsttype);58}5960protected FillSpans(SurfaceType srctype,61CompositeType comptype,62SurfaceType dsttype)63{64super(methodSignature, primTypeID, srctype, comptype, dsttype);65}6667public FillSpans(long pNativePrim,68SurfaceType srctype,69CompositeType comptype,70SurfaceType dsttype)71{72super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);73}7475private native void FillSpans(SunGraphics2D sg2d, SurfaceData dest,76int pixel, long pIterator, SpanIterator si);7778/**79* All FillSpan implementors must have this invoker method80*/81public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,82SpanIterator si)83{84FillSpans(sg2d, dest, sg2d.pixel, si.getNativeIterator(), si);85}8687public GraphicsPrimitive makePrimitive(SurfaceType srctype,88CompositeType comptype,89SurfaceType dsttype)90{91// REMIND: iterate with a FillRect primitive?92throw new InternalError("FillSpans not implemented for "+93srctype+" with "+comptype);94}9596public GraphicsPrimitive traceWrap() {97return new TraceFillSpans(this);98}99100private static class TraceFillSpans extends FillSpans {101FillSpans target;102103public TraceFillSpans(FillSpans target) {104super(target.getSourceType(),105target.getCompositeType(),106target.getDestType());107this.target = target;108}109110public GraphicsPrimitive traceWrap() {111return this;112}113114public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,115SpanIterator si)116{117tracePrimitive(target);118target.FillSpans(sg2d, dest, si);119}120}121}122123124