if ((y & SUBPIXEL_MASK_Y) == SUBPIXEL_MASK_Y) { emitRow(alpha, y >> SUBPIXEL_LG_POSITIONS_Y, pix_minX, pix_maxX); pix_minX = Integer.MAX_VALUE; pix_maxX = Integer.MIN_VALUE; } } // Emit final row if (pix_maxX >= pix_minX) { emitRow(alpha, y >> SUBPIXEL_LG_POSITIONS_Y, pix_minX, pix_maxX); } } public void endRendering() { int spminX = Math.max((int)Math.ceil(edgeMinX), boundsMinX); int spmaxX = Math.min((int)Math.ceil(edgeMaxX), boundsMaxX); int spminY = Math.max((int)Math.ceil(edgeMinY), boundsMinY); int spmaxY = Math.min((int)Math.ceil(edgeMaxY), boundsMaxY); int pminX = spminX >> SUBPIXEL_LG_POSITIONS_X; int pmaxX = (spmaxX + SUBPIXEL_MASK_X) >> SUBPIXEL_LG_POSITIONS_X; int pminY = spminY >> SUBPIXEL_LG_POSITIONS_Y; int pmaxY = (spmaxY + SUBPIXEL_MASK_Y) >> SUBPIXEL_LG_POSITIONS_Y; if (pminX > pmaxX || pminY > pmaxY) { this.cache = new PiscesCache(boundsMinX >> SUBPIXEL_LG_POSITIONS_X, boundsMinY >> SUBPIXEL_LG_POSITIONS_Y, boundsMaxX >> SUBPIXEL_LG_POSITIONS_X, boundsMaxY >> SUBPIXEL_LG_POSITIONS_Y); return; } this.cache = new PiscesCache(pminX, pminY, pmaxX, pmaxY); _endRendering(pminX, pmaxX, spminY, spmaxY); } public PiscesCache getCache() { if (cache == null) { throw new InternalError("cache not yet initialized"); } return cache; } private void emitRow(int[] alphaRow, int pix_y, int pix_from, int pix_to) { // Copy rowAA data into the cache if one is present if (cache != null) { if (pix_to >= pix_from) { cache.startRow(pix_y, pix_from); // Perform run-length encoding and store results in the cache int from = pix_from - cache.bboxX0; int to = pix_to - cache.bboxX0; int runLen = 1; int startVal = alphaRow[from]; for (int i = from + 1; i <= to; i++) { int nextVal = startVal + alphaRow[i]; if (nextVal == startVal) { runLen++; } else { cache.addRLERun(startVal, runLen); runLen = 1; startVal = nextVal; } } cache.addRLERun(startVal, runLen); } } java.util.Arrays.fill(alphaRow, 0); }}Lines 501–571 of 571. Previous lines
if ((y & SUBPIXEL_MASK_Y) == SUBPIXEL_MASK_Y) { emitRow(alpha, y >> SUBPIXEL_LG_POSITIONS_Y, pix_minX, pix_maxX); pix_minX = Integer.MAX_VALUE; pix_maxX = Integer.MIN_VALUE; } } // Emit final row if (pix_maxX >= pix_minX) { emitRow(alpha, y >> SUBPIXEL_LG_POSITIONS_Y, pix_minX, pix_maxX); } } public void endRendering() { int spminX = Math.max((int)Math.ceil(edgeMinX), boundsMinX); int spmaxX = Math.min((int)Math.ceil(edgeMaxX), boundsMaxX); int spminY = Math.max((int)Math.ceil(edgeMinY), boundsMinY); int spmaxY = Math.min((int)Math.ceil(edgeMaxY), boundsMaxY); int pminX = spminX >> SUBPIXEL_LG_POSITIONS_X; int pmaxX = (spmaxX + SUBPIXEL_MASK_X) >> SUBPIXEL_LG_POSITIONS_X; int pminY = spminY >> SUBPIXEL_LG_POSITIONS_Y; int pmaxY = (spmaxY + SUBPIXEL_MASK_Y) >> SUBPIXEL_LG_POSITIONS_Y; if (pminX > pmaxX || pminY > pmaxY) { this.cache = new PiscesCache(boundsMinX >> SUBPIXEL_LG_POSITIONS_X, boundsMinY >> SUBPIXEL_LG_POSITIONS_Y, boundsMaxX >> SUBPIXEL_LG_POSITIONS_X, boundsMaxY >> SUBPIXEL_LG_POSITIONS_Y); return; } this.cache = new PiscesCache(pminX, pminY, pmaxX, pmaxY); _endRendering(pminX, pmaxX, spminY, spmaxY); } public PiscesCache getCache() { if (cache == null) { throw new InternalError("cache not yet initialized"); } return cache; } private void emitRow(int[] alphaRow, int pix_y, int pix_from, int pix_to) { // Copy rowAA data into the cache if one is present if (cache != null) { if (pix_to >= pix_from) { cache.startRow(pix_y, pix_from); // Perform run-length encoding and store results in the cache int from = pix_from - cache.bboxX0; int to = pix_to - cache.bboxX0; int runLen = 1; int startVal = alphaRow[from]; for (int i = from + 1; i <= to; i++) { int nextVal = startVal + alphaRow[i]; if (nextVal == startVal) { runLen++; } else { cache.addRLERun(startVal, runLen); runLen = 1; startVal = nextVal; } } cache.addRLERun(startVal, runLen); } } java.util.Arrays.fill(alphaRow, 0); } }