3261N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An object used to cache pre-rendered complex paths. 0N/A * @see PiscesRenderer#render 0N/A // rowAARLE[i] holds the encoding of the pixel row with y = bboxY0+i. 0N/A // The format of each of the inner arrays is: rowAARLE[i][0,1] = (x0, n) 0N/A // where x0 is the first x in row i with nonzero alpha, and n is the 0N/A // number of RLE entries in this row. rowAARLE[i][j,j+1] for j>1 is 0N/A // RLE encodings are added in increasing y rows and then in increasing 0N/A // x inside those rows. Therefore, at any one time there is a well 0N/A // defined position (x,y) where a run length is about to be added (or 0N/A // the row terminated). x0,y0 is this (x,y)-(bboxX0,bboxY0). They 0N/A // are used to get indices into the current tile. 0N/A // touchedTile[i][j] is the sum of all the alphas in the tile with 0N/A // y=i*TILE_SIZE+bboxY0 and x=j*TILE_SIZE+bboxX0. 0N/A // we could just leave the inner arrays as null and allocate them 0N/A // lazily (which would be beneficial for shapes with gaps), but we 0N/A // assume there won't be too many of those so we allocate everything 0N/A // up front (which is better for other cases) 0N/A y0 = -
1;
// -1 makes the first assert in startRow succeed 0N/A // the ceiling of (maxy - miny + 1) / TILE_SIZE; 524N/A // the x and y of the current row, minus bboxX0, bboxY0 0N/A // while we forbid rows from starting before bboxx0, our users 0N/A // can still store rows that go beyond bboxx1 (although this 0N/A // shouldn't happen), so it's a good idea to check that i 0N/A // is not going out of bounds in touchedTile[ty] 524N/A // don't go all the way to tx1 - we need to handle the last 0N/A // tile as a special case (just like we did with the first // } catch (RuntimeException e) { // System.out.println("x0, y0: " + x0 + ", " + y0); // System.out.printf("tx, ty, tx1: %d, %d, %d %n", tx, ty, tx1); // System.out.printf("bboxX/Y0/1: %d, %d, %d, %d %n", // bboxX0, bboxY0, bboxX1, bboxY1); // they will be equal unless x0>>TILE_SIZE_LG == tx1 // rows are supposed to be added by increasing y. assert y <=
bboxY1;
// perhaps this should be < instead of <= // this should be a new, uninitialized row. assert x0 >=
0 :
"Input must not be to the left of bbox bounds";
// the way addTupleToRow is implemented it would work for this but it's // not a good idea to use it because it is meant for adding // RLE tuples, not the first tuple (which is special). ret += (
"minTouchedX=" +
row[
0] +