Cache pages at the start of drawing, not the end.
Merge pull request #4932 from nnethercote/cache-pages-earlier

Cache pages at the start of drawing, not the end.