if (getCursor() != rCursor) {
setCursor(rCursor);
}
updateBuffer(w, h);
Renderer renderer = null;
if (bufferNeedsRendering) {
renderer = rendererFactory.createRenderer(buffer);
((DynamicRenderer)renderer).setRepaintHandler(this);
renderer.setTransform(transform);
}
if (renderer != null && gvtRoot != null &&
renderer.getTree() != gvtRoot) {
renderer.setTree(gvtRoot);
bufferNeedsRendering = true;
}
if (bufferNeedsRendering) {
Graphics2D g2d = (Graphics2D)g;
if (panTransform != null) {
int tx = (int)panTransform.getTranslateX();
int ty = (int)panTransform.getTranslateY();
paintPanRegions(g2d, tx, ty, w, h);
g2d.transform(panTransform);
panTransform = null;
g2d.drawImage(buffer, null, 0, 0);
} else {
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setClip(0, 0, w, h);
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, w, h);
}
clearBuffer(w, h);
renderer.setTransform(transform);
repaintAOI(renderer, size, buffer);
bufferNeedsRendering = false; // repaint is already queued
return;
} else { // buffer is current, just transform and draw it