curEdge.x += curEdge.dx; curEdge = curEdge.next; } /* Performing drawing till the right boundary (for correct * rendering shapes clipped at the right side) */ if (drawing && xl <= rightBnd) { /* Support of the strokeHint was added into the * draw and fill methods of the sun.java2d.pipe.LoopPipe */ hnd.dhnd.drawScanline(xl, rightBnd, y >> MDP_PREC); } } } private static class FillProcessHandler extends ProcessHandler { FillData fd; /* Note: For more easy reading of the code below each java version of * the macros from the ProcessPath.c preceded by the commented * origin call containing verbose names of the parameters */ public void processFixedLine(int x1, int y1, int x2, int y2, int[] pixelInfo, boolean checkBounds, boolean endSubPath) { int outXMin, outXMax, outYMin, outYMax; int res; /* There is no need to round line coordinates to the forward * differencing precision anymore. Such a rounding was used for * preventing the curve go out the endpoint (this sometimes does * not help). The problem was fixed in the forward differencing * loops. */ if (checkBounds) { boolean lastClipped; /* This function is used only for filling shapes, so there is no * check for the type of clipping */ int c[] = new int[]{x1, y1, x2, y2, 0, 0}; outXMin = (int)(dhnd.xMinf * MDP_MULT); outXMax = (int)(dhnd.xMaxf * MDP_MULT); outYMin = (int)(dhnd.yMinf * MDP_MULT); outYMax = (int)(dhnd.yMaxf * MDP_MULT); /* * TESTANDCLIP(outYMin, outYMax, y1, x1, y2, x2, res); */ res = TESTANDCLIP(outYMin, outYMax, c, 1, 0, 3, 2); if (res == CRES_INVISIBLE) return; /* * TESTANDCLIP(outYMin, outYMax, y2, x2, y1, x1, res); */ res = TESTANDCLIP(outYMin, outYMax, c, 3, 2, 1, 0); if (res == CRES_INVISIBLE) return; lastClipped = IS_CLIPPED(res); /* Clamping starting from first vertex of the the processed * segment * * CLIPCLAMP(outXMin, outXMax, x1, y1, x2, y2, x3, y3, res); */ res = CLIPCLAMP(outXMin, outXMax, c, 0, 1, 2, 3, 4, 5); /* Clamping only by left boundary */ if (res == CRES_MIN_CLIPPED) { processFixedLine(c[4], c[5], c[0], c[1], pixelInfo, false, lastClipped); } else if (res == CRES_INVISIBLE) { return; } /* Clamping starting from last vertex of the the processed * segment * * CLIPCLAMP(outXMin, outXMax, x2, y2, x1, y1, x3, y3, res); */ res = CLIPCLAMP(outXMin, outXMax, c, 2, 3, 0, 1, 4, 5); /* Checking if there was a clip by right boundary */ lastClipped = lastClipped || (res == CRES_MAX_CLIPPED); processFixedLine(c[0], c[1], c[2], c[3], pixelInfo, false, lastClipped); /* Clamping only by left boundary */ if (res == CRES_MIN_CLIPPED) { processFixedLine(c[2], c[3], c[4], c[5], pixelInfo, false, lastClipped); } return; } /* Adding first point of the line only in case of empty or just * finished path */ if (fd.isEmpty() || fd.isEnded()) { fd.addPoint(x1, y1, false); } fd.addPoint(x2, y2, false); if (endSubPath) { fd.setEnded(); } } FillProcessHandler(DrawHandler dhnd) { super(dhnd, PH_MODE_FILL_CLIP); this.fd = new FillData(); } public void processEndSubPath() { if (!fd.isEmpty()) { fd.setEnded(); } } }}Lines 2001–2128 of 2128. Previous lines
curEdge.x += curEdge.dx; curEdge = curEdge.next; } /* Performing drawing till the right boundary (for correct * rendering shapes clipped at the right side) */ if (drawing && xl <= rightBnd) { /* Support of the strokeHint was added into the * draw and fill methods of the sun.java2d.pipe.LoopPipe */ hnd.dhnd.drawScanline(xl, rightBnd, y >> MDP_PREC); } } } private static class FillProcessHandler extends ProcessHandler { FillData fd; /* Note: For more easy reading of the code below each java version of * the macros from the ProcessPath.c preceded by the commented * origin call containing verbose names of the parameters */ public void processFixedLine(int x1, int y1, int x2, int y2, int[] pixelInfo, boolean checkBounds, boolean endSubPath) { int outXMin, outXMax, outYMin, outYMax; int res; /* There is no need to round line coordinates to the forward * differencing precision anymore. Such a rounding was used for * preventing the curve go out the endpoint (this sometimes does * not help). The problem was fixed in the forward differencing * loops. */ if (checkBounds) { boolean lastClipped; /* This function is used only for filling shapes, so there is no * check for the type of clipping */ int c[] = new int[]{x1, y1, x2, y2, 0, 0}; outXMin = (int)(dhnd.xMinf * MDP_MULT); outXMax = (int)(dhnd.xMaxf * MDP_MULT); outYMin = (int)(dhnd.yMinf * MDP_MULT); outYMax = (int)(dhnd.yMaxf * MDP_MULT); /* * TESTANDCLIP(outYMin, outYMax, y1, x1, y2, x2, res); */ res = TESTANDCLIP(outYMin, outYMax, c, 1, 0, 3, 2); if (res == CRES_INVISIBLE) return; /* * TESTANDCLIP(outYMin, outYMax, y2, x2, y1, x1, res); */ res = TESTANDCLIP(outYMin, outYMax, c, 3, 2, 1, 0); if (res == CRES_INVISIBLE) return; lastClipped = IS_CLIPPED(res); /* Clamping starting from first vertex of the the processed * segment * * CLIPCLAMP(outXMin, outXMax, x1, y1, x2, y2, x3, y3, res); */ res = CLIPCLAMP(outXMin, outXMax, c, 0, 1, 2, 3, 4, 5); /* Clamping only by left boundary */ if (res == CRES_MIN_CLIPPED) { processFixedLine(c[4], c[5], c[0], c[1], pixelInfo, false, lastClipped); } else if (res == CRES_INVISIBLE) { return; } /* Clamping starting from last vertex of the the processed * segment * * CLIPCLAMP(outXMin, outXMax, x2, y2, x1, y1, x3, y3, res); */ res = CLIPCLAMP(outXMin, outXMax, c, 2, 3, 0, 1, 4, 5); /* Checking if there was a clip by right boundary */ lastClipped = lastClipped || (res == CRES_MAX_CLIPPED); processFixedLine(c[0], c[1], c[2], c[3], pixelInfo, false, lastClipped); /* Clamping only by left boundary */ if (res == CRES_MIN_CLIPPED) { processFixedLine(c[2], c[3], c[4], c[5], pixelInfo, false, lastClipped); } return; } /* Adding first point of the line only in case of empty or just * finished path */ if (fd.isEmpty() || fd.isEnded()) { fd.addPoint(x1, y1, false); } fd.addPoint(x2, y2, false); if (endSubPath) { fd.setEnded(); } } FillProcessHandler(DrawHandler dhnd) { super(dhnd, PH_MODE_FILL_CLIP); this.fd = new FillData(); } public void processEndSubPath() { if (!fd.isEmpty()) { fd.setEnded(); } } } }