Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/loops/DrawPath.java
38918 views
/*1* Copyright (c) 2005, 2006, 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*/2425package sun.java2d.loops;2627import sun.java2d.loops.GraphicsPrimitive;28import sun.java2d.SunGraphics2D;29import sun.java2d.SurfaceData;30import java.awt.geom.Path2D;3132/**33* DrawPath34* 1. draw single-width line path onto destination surface35* 2. must accept output area [x, y, dx, dy]36* from within the surface description data for clip rect37*/38public class DrawPath extends GraphicsPrimitive {3940public final static String methodSignature =41"DrawPath(...)".toString();4243public final static int primTypeID = makePrimTypeID();4445public static DrawPath locate(SurfaceType srctype,46CompositeType comptype,47SurfaceType dsttype)48{49return (DrawPath)50GraphicsPrimitiveMgr.locate(primTypeID,51srctype, comptype, dsttype);52}5354protected DrawPath(SurfaceType srctype,55CompositeType comptype,56SurfaceType dsttype)57{58super(methodSignature, primTypeID,59srctype, comptype, dsttype);60}6162public DrawPath(long pNativePrim,63SurfaceType srctype,64CompositeType comptype,65SurfaceType dsttype)66{67super(pNativePrim, methodSignature, primTypeID,68srctype, comptype, dsttype);69}707172/**73* All DrawPath implementors must have this invoker method74*/75public native void DrawPath(SunGraphics2D sg2d, SurfaceData sData,76int transX, int transY,77Path2D.Float p2df);7879public GraphicsPrimitive makePrimitive(SurfaceType srctype,80CompositeType comptype,81SurfaceType dsttype)82{83throw new InternalError("DrawPath not implemented for "+84srctype+" with "+comptype);85}8687public GraphicsPrimitive traceWrap() {88return new TraceDrawPath(this);89}9091private static class TraceDrawPath extends DrawPath {92DrawPath target;9394public TraceDrawPath(DrawPath target) {95super(target.getSourceType(),96target.getCompositeType(),97target.getDestType());98this.target = target;99}100101public GraphicsPrimitive traceWrap() {102return this;103}104105public void DrawPath(SunGraphics2D sg2d, SurfaceData sData,106int transX, int transY,107Path2D.Float p2df)108{109tracePrimitive(target);110target.DrawPath(sg2d, sData, transX, transY, p2df);111}112}113}114115116