buf.putFloat((float) dy2); buf.putFloat((float) lw1); buf.putFloat((float) lw2); } finally { rq.unlock(); } } } public void draw(SunGraphics2D sg2d, Shape s) { if (sg2d.strokeState == sg2d.STROKE_THIN) { if (s instanceof Polygon) { if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) { Polygon p = (Polygon)s; drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); return; } } Path2D.Float p2df; int transx, transy; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transx = sg2d.transX; transy = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transx = 0; transy = 0; } drawPath(sg2d, p2df, transx, transy); } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) { ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s); try { fillSpans(sg2d, si, 0, 0); } finally { si.dispose(); } } else { fill(sg2d, sg2d.stroke.createStrokedShape(s)); } } public void fill(SunGraphics2D sg2d, Shape s) { int transx, transy; if (sg2d.strokeState == sg2d.STROKE_THIN) { // Here we are able to use fillPath() for // high-quality fills. Path2D.Float p2df; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transx = sg2d.transX; transy = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transx = 0; transy = 0; } fillPath(sg2d, p2df, transx, transy); return; } AffineTransform at; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { // Transform (translation) will be done by FillSpans (we could // delegate to fillPolygon() here, but most hardware accelerated // libraries cannot handle non-convex polygons, so we will use // the FillSpans approach by default) at = null; transx = sg2d.transX; transy = sg2d.transY; } else { // Transform will be done by the PathIterator at = sg2d.transform; transx = transy = 0; } ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d); try { // Subtract transx/y from the SSI clip to match the // (potentially untranslated) geometry fed to it Region clip = sg2d.getCompClip(); ssi.setOutputAreaXYXY(clip.getLoX() - transx, clip.getLoY() - transy, clip.getHiX() - transx, clip.getHiY() - transy); ssi.appendPath(s.getPathIterator(at)); fillSpans(sg2d, ssi, transx, transy); } finally { ssi.dispose(); } }}Lines 501–601 of 601. Previous lines
buf.putFloat((float) dy2); buf.putFloat((float) lw1); buf.putFloat((float) lw2); } finally { rq.unlock(); } } } public void draw(SunGraphics2D sg2d, Shape s) { if (sg2d.strokeState == sg2d.STROKE_THIN) { if (s instanceof Polygon) { if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) { Polygon p = (Polygon)s; drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); return; } } Path2D.Float p2df; int transx, transy; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transx = sg2d.transX; transy = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transx = 0; transy = 0; } drawPath(sg2d, p2df, transx, transy); } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) { ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s); try { fillSpans(sg2d, si, 0, 0); } finally { si.dispose(); } } else { fill(sg2d, sg2d.stroke.createStrokedShape(s)); } } public void fill(SunGraphics2D sg2d, Shape s) { int transx, transy; if (sg2d.strokeState == sg2d.STROKE_THIN) { // Here we are able to use fillPath() for // high-quality fills. Path2D.Float p2df; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transx = sg2d.transX; transy = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transx = 0; transy = 0; } fillPath(sg2d, p2df, transx, transy); return; } AffineTransform at; if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { // Transform (translation) will be done by FillSpans (we could // delegate to fillPolygon() here, but most hardware accelerated // libraries cannot handle non-convex polygons, so we will use // the FillSpans approach by default) at = null; transx = sg2d.transX; transy = sg2d.transY; } else { // Transform will be done by the PathIterator at = sg2d.transform; transx = transy = 0; } ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d); try { // Subtract transx/y from the SSI clip to match the // (potentially untranslated) geometry fed to it Region clip = sg2d.getCompClip(); ssi.setOutputAreaXYXY(clip.getLoX() - transx, clip.getLoY() - transy, clip.getHiX() - transx, clip.getHiY() - transy); ssi.appendPath(s.getPathIterator(at)); fillSpans(sg2d, ssi, transx, transy); } finally { ssi.dispose(); } } }