if (getClip() != null) {
GeneralPath gp = new GeneralPath();
gp.append(pi, true);
// create the stroked shape
Stroke stroke = getStroke() == null? defaultStroke : getStroke();
Rectangle2D bounds = stroke.createStrokedShape(gp).getBounds();
// clip should intersect the path
// if clip contains the bounds completely, clipping is not needed
drawClipped = getClip().intersects(bounds) && !getClip().contains(bounds);
}