optimizing row and column header drawing