use extent to make sure canvas is expanded if necessary