if (cBlockView == null || cBlockView.isDisposed())
return;
Table table = getTable();
//Compute bounds ...
Rectangle bounds = getBoundsForCanvas();
//In case item isn't displayed bounds is null
if (bounds == null || image == null || image.isDisposed()) {
return;
}
Rectangle canvasBounds = cBlockView.getBounds();
//debugOut("Block:"+canvasBounds+";cell:"+bounds,false);
if (canvasBounds.x != bounds.x || canvasBounds.y != bounds.y) {
//cBlockView.moveAbove(null);
cBlockView.setLocation(bounds.x, bounds.y);
canvasBounds = cBlockView.getBounds();
//debugOut("doPaint(clipping): move cBlockView to " + bounds.x + "x" + bounds.y, false);
}
if (bounds.width != canvasBounds.width ||
bounds.height != canvasBounds.height) {
cBlockView.setSize(bounds.width, bounds.height);
canvasBounds = cBlockView.getBounds();
}
//debugOut("doPaint()" + ((gc == null) ? "GC NULL" : String.valueOf(gc.getClipping())) +
// "ta="+table.getClientArea()+";bounds="+bounds, false);
if (orientation == SWT.FILL) {
Rectangle imageBounds = image.getBounds();
if (imageBounds.width != bounds.width ||
imageBounds.height != bounds.height) {
// Enable this for semi-fast visual update with some flicker
cBlockView.setSize(bounds.width, bounds.height);
GC gc = new GC(cBlockView);
if (gc == null) {
return;
}
gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height,
0, 0, bounds.width, bounds.height);
gc.dispose();
/*
// _OR_ enable refresh() for slower visual update with lots of flicker
//refresh();
// OR, disable both and image will be updated on next graphic bar update
// TODO: make config option to choose
*/
invalidate();
return;
}
}
if (clipping == null) {
clipping = new Rectangle(0, 0, bounds.width, bounds.height);
}
Rectangle tableBounds = table.getClientArea();
if (tableBounds.y < table.getHeaderHeight()) {
tableBounds.y = table.getHeaderHeight();
}
//debugOut("doPaint() tableBounds="+tableBounds+";canvasBounds="+canvasBounds+";clipping="+clipping, false);
tableBounds.x -= canvasBounds.x;