Optimize drawLine to minimize redraws