code freeze before lockCanvas(dirty rect)