calcbuffer must be called prior to repaint