smart implementation of boundingRect of line