fix setDimension for offscreen canvas