p.addPoint(x, y + height);
p.addPoint(x + borderWidth, y + height - borderWidth);
p.addPoint(x + width - borderWidth, y + height - borderWidth);
p.addPoint(x + width - borderWidth, y + borderWidth);
g.setClip(p);
g.clipRect(oldClip.x, oldClip.y, oldClip.width, oldClip.height);
// Bottom border. More than one y coordinate may be needed in case the
// tile border coincides to be inside the bottom border.
int startY = y + height - borderWidth - (height - borderWidth) % imageHeight;
int endY = y + height - height % imageHeight;