int topX = getWidth();
int topY = getHeight();
int bottomX = 0;
int bottomY = 0;
for (int iter = 0; iter < size; iter++) {
Animation ani = paintQueueTemp[iter];
paintQueueTemp[iter] = null;
wrapper.translate(-wrapper.getTranslateX(), -wrapper.getTranslateY());
wrapper.setClip(0, 0, getWidth(), getHeight());
if (ani instanceof Component) {
Component cmp = (Component) ani;
System.out.println(cmp.getUIID() + " <- imprimido");
Rectangle dirty = cmp.getDirtyRegion();
//Rectangle dirty = new Rectangle(0, 0, cmp.getPreferredSize()) ;
if (dirty != null) {
System.out.println(cmp.getUIID() + " <- sujo");
wrapper.setClip(dirty.getX(), dirty.getY(), dirty.getSize().getWidth(), dirty.getSize().getHeight());
cmp.setDirtyRegion(null);
}
cmp.paintComponent(wrapper);
int cmpAbsX = cmp.getAbsoluteX() + cmp.getScrollX();
topX = Math.min(cmpAbsX, topX);
bottomX = Math.max(cmpAbsX + cmp.getWidth(), bottomX);
int cmpAbsY = cmp.getAbsoluteY() + cmp.getScrollY();
topY = Math.min(cmpAbsY, topY);
bottomY = Math.max(cmpAbsY + cmp.getHeight(), bottomY);
} else {
bottomX = getWidth();
bottomY = getHeight();
topX = 0;
topY = 0;
ani.paint(wrapper);
}
}
// disable flush graphics bug when media is playing to prevent the
// double buffer