src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 30948 jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java@0a0972d3b58d
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8131
diff changeset
     2
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3008
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3008
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3008
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3008
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3008
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d.pisces;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    28
import java.util.Arrays;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * An object used to cache pre-rendered complex paths.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
8131
e2932d8114cb 7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents: 7668
diff changeset
    33
final class PiscesCache {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    35
    final int bboxX0, bboxY0, bboxX1, bboxY1;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    36
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    37
    // rowAARLE[i] holds the encoding of the pixel row with y = bboxY0+i.
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    38
    // The format of each of the inner arrays is: rowAARLE[i][0,1] = (x0, n)
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    39
    // where x0 is the first x in row i with nonzero alpha, and n is the
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    40
    // number of RLE entries in this row. rowAARLE[i][j,j+1] for j>1 is
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    41
    // (val,runlen)
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    42
    final int[][] rowAARLE;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    44
    // RLE encodings are added in increasing y rows and then in increasing
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    45
    // x inside those rows. Therefore, at any one time there is a well
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    46
    // defined position (x,y) where a run length is about to be added (or
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    47
    // the row terminated). x0,y0 is this (x,y)-(bboxX0,bboxY0). They
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    48
    // are used to get indices into the current tile.
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    49
    private int x0 = Integer.MIN_VALUE, y0 = Integer.MIN_VALUE;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    50
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    51
    // touchedTile[i][j] is the sum of all the alphas in the tile with
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    52
    // y=i*TILE_SIZE+bboxY0 and x=j*TILE_SIZE+bboxX0.
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    53
    private final int[][] touchedTile;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    55
    static final int TILE_SIZE_LG = 5;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    56
    static final int TILE_SIZE = 1 << TILE_SIZE_LG; // 32
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    57
    private static final int INIT_ROW_SIZE = 8; // enough for 3 run lengths
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    59
    PiscesCache(int minx, int miny, int maxx, int maxy) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    60
        assert maxy >= miny && maxx >= minx;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    61
        bboxX0 = minx;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    62
        bboxY0 = miny;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    63
        bboxX1 = maxx + 1;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    64
        bboxY1 = maxy + 1;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    65
        // we could just leave the inner arrays as null and allocate them
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    66
        // lazily (which would be beneficial for shapes with gaps), but we
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    67
        // assume there won't be too many of those so we allocate everything
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    68
        // up front (which is better for other cases)
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    69
        rowAARLE = new int[bboxY1 - bboxY0 + 1][INIT_ROW_SIZE];
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    70
        x0 = 0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    71
        y0 = -1; // -1 makes the first assert in startRow succeed
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    72
        // the ceiling of (maxy - miny + 1) / TILE_SIZE;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    73
        int nyTiles = (maxy - miny + TILE_SIZE) >> TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    74
        int nxTiles = (maxx - minx + TILE_SIZE) >> TILE_SIZE_LG;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    76
        touchedTile = new int[nyTiles][nxTiles];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    79
    void addRLERun(int val, int runLen) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    80
        if (runLen > 0) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    81
            addTupleToRow(y0, val, runLen);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    82
            if (val != 0) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    83
                // the x and y of the current row, minus bboxX0, bboxY0
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    84
                int tx = x0 >> TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    85
                int ty = y0 >> TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    86
                int tx1 = (x0 + runLen - 1) >> TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    87
                // while we forbid rows from starting before bboxx0, our users
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    88
                // can still store rows that go beyond bboxx1 (although this
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    89
                // shouldn't happen), so it's a good idea to check that i
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    90
                // is not going out of bounds in touchedTile[ty]
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    91
                if (tx1 >= touchedTile[ty].length) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    92
                    tx1 = touchedTile[ty].length - 1;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    93
                }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    94
                if (tx <= tx1) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    95
                    int nextTileXCoord = (tx + 1) << TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    96
                    if (nextTileXCoord > x0+runLen) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    97
                        touchedTile[ty][tx] += val * runLen;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    98
                    } else {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
    99
                        touchedTile[ty][tx] += val * (nextTileXCoord - x0);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   100
                    }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   101
                    tx++;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   102
                }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   103
                // don't go all the way to tx1 - we need to handle the last
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   104
                // tile as a special case (just like we did with the first
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   105
                for (; tx < tx1; tx++) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   106
//                    try {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   107
                    touchedTile[ty][tx] += (val << TILE_SIZE_LG);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   108
//                    } catch (RuntimeException e) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   109
//                        System.out.println("x0, y0: " + x0 + ", " + y0);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   110
//                        System.out.printf("tx, ty, tx1: %d, %d, %d %n", tx, ty, tx1);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   111
//                        System.out.printf("bboxX/Y0/1: %d, %d, %d, %d %n",
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   112
//                                bboxX0, bboxY0, bboxX1, bboxY1);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   113
//                        throw e;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   114
//                    }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   115
                }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   116
                // they will be equal unless x0>>TILE_SIZE_LG == tx1
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   117
                if (tx == tx1) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   118
                    int lastXCoord = Math.min(x0 + runLen, (tx + 1) << TILE_SIZE_LG);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   119
                    int txXCoord = tx << TILE_SIZE_LG;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   120
                    touchedTile[ty][tx] += val * (lastXCoord - txXCoord);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   121
                }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   122
            }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   123
            x0 += runLen;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   127
    void startRow(int y, int x) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   128
        // rows are supposed to be added by increasing y.
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   129
        assert y - bboxY0 > y0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   130
        assert y <= bboxY1; // perhaps this should be < instead of <=
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   131
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   132
        y0 = y - bboxY0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   133
        // this should be a new, uninitialized row.
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   134
        assert rowAARLE[y0][1] == 0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   135
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   136
        x0 = x - bboxX0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   137
        assert x0 >= 0 : "Input must not be to the left of bbox bounds";
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   138
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   139
        // the way addTupleToRow is implemented it would work for this but it's
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   140
        // not a good idea to use it because it is meant for adding
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   141
        // RLE tuples, not the first tuple (which is special).
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   142
        rowAARLE[y0][0] = x;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   143
        rowAARLE[y0][1] = 2;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   146
    int alphaSumInTile(int x, int y) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   147
        x -= bboxX0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   148
        y -= bboxY0;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   149
        return touchedTile[y>>TILE_SIZE_LG][x>>TILE_SIZE_LG];
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   150
    }
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   151
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   152
    int minTouched(int rowidx) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   153
        return rowAARLE[rowidx][0];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   156
    int rowLength(int rowidx) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   157
        return rowAARLE[rowidx][1];
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   158
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   160
    private void addTupleToRow(int row, int a, int b) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   161
        int end = rowAARLE[row][1];
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   162
        rowAARLE[row] = Helpers.widenArray(rowAARLE[row], end, 2);
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   163
        rowAARLE[row][end++] = a;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   164
        rowAARLE[row][end++] = b;
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   165
        rowAARLE[row][1] = end;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
29509
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   168
    void getBBox(int bbox[]) {
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   169
        // Since we add +1 to bboxX1,bboxY1 so when PTG asks for bbox,
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   170
        // we will give after -1
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   171
        bbox[0] = bboxX0;
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   172
        bbox[1] = bboxY0;
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   173
        bbox[2] = bboxX1 - 1;
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   174
        bbox[3] = bboxY1 - 1;
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   175
    }
e3b07effb6e3 8048782: OpenJDK: PiscesCache : xmax/ymax rounding up can cause RasterFormatException
serb
parents: 25859
diff changeset
   176
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   177
    @Override
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   178
    public String toString() {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   179
        String ret = "bbox = ["+
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   180
                      bboxX0+", "+bboxY0+" => "+
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   181
                      bboxX1+", "+bboxY1+"]\n";
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   182
        for (int[] row : rowAARLE) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   183
            if (row != null) {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   184
                ret += ("minTouchedX=" + row[0] +
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   185
                        "\tRLE Entries: " + Arrays.toString(
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   186
                                Arrays.copyOfRange(row, 2, row[1])) + "\n");
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   187
            } else {
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   188
                ret += "[]\n";
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   189
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        }
6997
3642614e2282 6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents: 5506
diff changeset
   191
        return ret;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
}