3261N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 3172N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3172N/A * This code is free software; you can redistribute it and/or modify it 3172N/A * under the terms of the GNU General Public License version 2 only, as 3172N/A * published by the Free Software Foundation. Oracle designates this 3172N/A * particular file as subject to the "Classpath" exception as provided 3172N/A * by Oracle in the LICENSE file that accompanied this code. 3172N/A * This code is distributed in the hope that it will be useful, but WITHOUT 3172N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3172N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3172N/A * version 2 for more details (a copy is included in the LICENSE file that 3172N/A * You should have received a copy of the GNU General Public License version 3172N/A * 2 along with this work; if not, write to the Free Software Foundation, 3172N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3172N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3172N/A * Class: sun_java2d_loops_DrawParallelogram 3172N/A * Method: DrawParallelogram 3172N/A * Sort parallelogram by y values, ensure that each delta vector 3172N/A * has a non-negative y delta. 3172N/A // dx,dy for line width in the "1" and "2" directions. 3172N/A // calculate origin of the outer parallelogram 3172N/A // Only need to generate 4 quads if the interior still 3172N/A // has a hole in it (i.e. if the line width ratios were 3172N/A // If the line widths are both less than a pixel wide 3172N/A // then we can use a drawline function instead for even 3172N/A // To simplify the edge management below we presort the 3172N/A // inner and outer edges so that they are globally sorted 3172N/A // from left to right. If you scan across the array of 3172N/A // edges for a given Y range then the edges you encounter 3172N/A // will be sorted in X as well. 3172N/A // If AB are left top and bottom edges of outer parallelogram, 3172N/A // and CD are the right pair of edges, and abcd are the 3172N/A // corresponding inner parallelogram edges then we want them 3172N/A // sorted as ABabcdCD to ensure this horizontal ordering. 3172N/A // Conceptually it is like 2 pairs of nested parentheses. 3172N/A // The line width ratios were large enough to consume 3172N/A // the entire hole in the middle of the parallelogram 3172N/A // so we can just issue one large quad for the outer 3172N/A // The outer parallelogram always goes in the first two 3172N/A // and last two entries in the array so we either have 3172N/A // ABabcdCD ordering for 8 edges or ABCD ordering for 4 3172N/A // edges. See comment above where we store the inner 3172N/A // parallelogram for a more complete description. 3172N/A // Maintaining a sorted edge list is probably overkill for 3172N/A // 4 or 8 edges. The indices chosen above for storing the 3172N/A // inner and outer left and right edges already guarantee 3172N/A // left to right ordering so we just need to scan for edges 3172N/A // that overlap the current Y range (and also determine the 3172N/A // maximum Y value for which the range is valid). 3172N/A // This edge is still in play, have we reached it yet? 3172N/A // This edge is not active (yet) 3172N/A // Stop before we get to the top of it 3172N/A // This edge is active, store it 3172N/A // And stop when we get to the bottom of it 3172N/A "ODD NUMBER OF PGRAM EDGES (%d)!!",