protected void paintCell(ILayerCell cell, GC gc,
IConfigRegistry configRegistry) {
ILayer layer = cell.getLayer();
int columnPosition = cell.getColumnPosition();
int rowPosition = cell.getRowPosition();
ICellPainter cellPainter = layer.getCellPainter(columnPosition,
rowPosition, cell, configRegistry);
Rectangle adjustedCellBounds = layer
.getLayerPainter()
.adjustCellBounds(columnPosition, rowPosition, cell.getBounds());
if (cellPainter != null) {
Rectangle originalClipping = gc.getClipping();
int startX = getStartXOfColumnPosition(columnPosition);
int startY = getStartYOfRowPosition(rowPosition);
int endX = getStartXOfColumnPosition(cell.getOriginColumnPosition()
+ cell.getColumnSpan());
int endY = getStartYOfRowPosition(cell.getOriginRowPosition()
+ cell.getRowSpan());
Rectangle cellClipBounds = originalClipping
.intersection(new Rectangle(startX, startY, endX - startX,
endY - startY));
gc.setClipping(cellClipBounds.intersection(adjustedCellBounds));
cellPainter.paintCell(cell, gc, adjustedCellBounds, configRegistry);
gc.setClipping(originalClipping);
}
}