122
123 void init(int minx, int miny, int maxx, int maxy)
124 {
125 // assert maxy >= miny && maxx >= minx;
126 bboxX0 = minx;
127 bboxY0 = miny;
128 bboxX1 = maxx;
129 bboxY1 = maxy;
130
131 final int width = (maxx - minx);
132
133 if (FORCE_NO_RLE) {
134 useRLE = false;
135 } else if (FORCE_RLE) {
136 useRLE = true;
137 } else {
138 // heuristics: use both bbox area and complexity
139 // ie number of primitives:
140
141 // fast check min and max width (maxx < 23bits):
142 if (width <= RLE_MIN_WIDTH || width >= RLE_MAX_WIDTH) {
143 useRLE = false;
144 } else {
145 useRLE = true;
146 }
147 }
148
149 // the ceiling of (maxy - miny + 1) / TILE_SIZE;
150 final int nxTiles = (width + TILE_W) >> TILE_W_LG;
151
152 if (nxTiles > INITIAL_ARRAY) {
153 if (DO_STATS) {
154 rdrStats.stat_array_marlincache_touchedTile.add(nxTiles);
155 }
156 touchedTile = touchedTile_ref.getArray(nxTiles);
157 }
158 }
159
160 /**
161 * Disposes this cache:
162 * clean up before reusing this instance
163 */
164 void dispose() {
165 // Reset touchedTile if needed:
166 resetTileLine(0);
|
122
123 void init(int minx, int miny, int maxx, int maxy)
124 {
125 // assert maxy >= miny && maxx >= minx;
126 bboxX0 = minx;
127 bboxY0 = miny;
128 bboxX1 = maxx;
129 bboxY1 = maxy;
130
131 final int width = (maxx - minx);
132
133 if (FORCE_NO_RLE) {
134 useRLE = false;
135 } else if (FORCE_RLE) {
136 useRLE = true;
137 } else {
138 // heuristics: use both bbox area and complexity
139 // ie number of primitives:
140
141 // fast check min and max width (maxx < 23bits):
142 useRLE = (width > RLE_MIN_WIDTH && width < RLE_MAX_WIDTH);
143 }
144
145 // the ceiling of (maxy - miny + 1) / TILE_SIZE;
146 final int nxTiles = (width + TILE_W) >> TILE_W_LG;
147
148 if (nxTiles > INITIAL_ARRAY) {
149 if (DO_STATS) {
150 rdrStats.stat_array_marlincache_touchedTile.add(nxTiles);
151 }
152 touchedTile = touchedTile_ref.getArray(nxTiles);
153 }
154 }
155
156 /**
157 * Disposes this cache:
158 * clean up before reusing this instance
159 */
160 void dispose() {
161 // Reset touchedTile if needed:
162 resetTileLine(0);
|