Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/loops/DrawPolygons.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 sun.java2d.SunGraphics2D;33import sun.java2d.SurfaceData;3435/**36* DrawPolygons37* 1) draw single-width line polygons onto destination surface38* 2) must accept output area [x, y, dx, dy]39* from within the surface description data for clip rect40*/41public class DrawPolygons extends GraphicsPrimitive42{43public final static String methodSignature = "DrawPolygons(...)".toString();4445public final static int primTypeID = makePrimTypeID();4647public static DrawPolygons locate(SurfaceType srctype,48CompositeType comptype,49SurfaceType dsttype)50{51return (DrawPolygons)52GraphicsPrimitiveMgr.locate(primTypeID,53srctype, comptype, dsttype);54}5556protected DrawPolygons(SurfaceType srctype,57CompositeType comptype,58SurfaceType dsttype)59{60super(methodSignature, primTypeID, srctype, comptype, dsttype);61}6263public DrawPolygons(long pNativePrim,64SurfaceType srctype,65CompositeType comptype,66SurfaceType dsttype)67{68super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);69}7071/**72* All DrawPolygon implementors must have this invoker method73*/74public native void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData,75int xPoints[], int yPoints[],76int nPoints[], int numPolys,77int transX, int transY,78boolean close);7980public GraphicsPrimitive makePrimitive(SurfaceType srctype,81CompositeType comptype,82SurfaceType dsttype)83{84// REMIND: use FillSpans or converter object?85throw new InternalError("DrawPolygons not implemented for "+86srctype+" with "+comptype);87}8889public GraphicsPrimitive traceWrap() {90return new TraceDrawPolygons(this);91}9293private static class TraceDrawPolygons extends DrawPolygons {94DrawPolygons target;9596public TraceDrawPolygons(DrawPolygons target) {97super(target.getSourceType(),98target.getCompositeType(),99target.getDestType());100this.target = target;101}102103public GraphicsPrimitive traceWrap() {104return this;105}106107public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData,108int xPoints[], int yPoints[],109int nPoints[], int numPolys,110int transX, int transY,111boolean close)112{113tracePrimitive(target);114target.DrawPolygons(sg2d, sData,115xPoints, yPoints, nPoints, numPolys,116transX, transY, close);117}118}119}120121122