297 boolean isFill); |
297 boolean isFill); |
298 |
298 |
299 private void doPath(SunGraphics2D sg2d, Shape s, boolean isFill) { |
299 private void doPath(SunGraphics2D sg2d, Shape s, boolean isFill) { |
300 Path2D.Float p2df; |
300 Path2D.Float p2df; |
301 int transx, transy; |
301 int transx, transy; |
302 if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { |
302 if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { |
303 if (s instanceof Path2D.Float) { |
303 if (s instanceof Path2D.Float) { |
304 p2df = (Path2D.Float)s; |
304 p2df = (Path2D.Float)s; |
305 } else { |
305 } else { |
306 p2df = new Path2D.Float(s); |
306 p2df = new Path2D.Float(s); |
307 } |
307 } |
321 SunToolkit.awtUnlock(); |
321 SunToolkit.awtUnlock(); |
322 } |
322 } |
323 } |
323 } |
324 |
324 |
325 public void draw(SunGraphics2D sg2d, Shape s) { |
325 public void draw(SunGraphics2D sg2d, Shape s) { |
326 if (sg2d.strokeState == sg2d.STROKE_THIN) { |
326 if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { |
327 // Delegate to drawPolygon() if possible... |
327 // Delegate to drawPolygon() if possible... |
328 if (s instanceof Polygon && |
328 if (s instanceof Polygon && |
329 sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) |
329 sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) |
330 { |
330 { |
331 Polygon p = (Polygon) s; |
331 Polygon p = (Polygon) s; |
332 drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); |
332 drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); |
333 return; |
333 return; |
334 } |
334 } |
335 |
335 |
336 // Otherwise we will use drawPath() for |
336 // Otherwise we will use drawPath() for |
337 // high-quality thin paths. |
337 // high-quality thin paths. |
338 doPath(sg2d, s, false); |
338 doPath(sg2d, s, false); |
339 } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) { |
339 } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) { |
340 // REMIND: X11 can handle uniform scaled wide lines |
340 // REMIND: X11 can handle uniform scaled wide lines |
341 // and dashed lines itself if we set the appropriate |
341 // and dashed lines itself if we set the appropriate |
342 // XGC attributes (TBD). |
342 // XGC attributes (TBD). |
343 ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s); |
343 ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s); |
344 try { |
344 try { |
358 fill(sg2d, sg2d.stroke.createStrokedShape(s)); |
358 fill(sg2d, sg2d.stroke.createStrokedShape(s)); |
359 } |
359 } |
360 } |
360 } |
361 |
361 |
362 public void fill(SunGraphics2D sg2d, Shape s) { |
362 public void fill(SunGraphics2D sg2d, Shape s) { |
363 if (sg2d.strokeState == sg2d.STROKE_THIN) { |
363 if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { |
364 // Delegate to fillPolygon() if possible... |
364 // Delegate to fillPolygon() if possible... |
365 if (s instanceof Polygon && |
365 if (s instanceof Polygon && |
366 sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) |
366 sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) |
367 { |
367 { |
368 Polygon p = (Polygon) s; |
368 Polygon p = (Polygon) s; |
369 fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); |
369 fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); |
370 return; |
370 return; |
371 } |
371 } |