g.copyArea(adjustedCopyRect.x - dx, adjustedCopyRect.y - dy, adjustedCopyRect.width, adjustedCopyRect.height, dx, dy);
wasPainted = false;
MultiRectArea affectedArea = new MultiRectArea(visibleBounds);
affectedArea.add(lastPaintedRect);
affectedArea.substract(adjustedCopyRect);
if (!affectedArea.isEmpty()) {
Shape oldClip = g.getClip();
g.setClip(affectedArea);
parent.paint(g);