SkPath::shrinkToFit() needs to perform copy-on-write

When we shrink a path, we might relocate its underlying arrays.
Doing so would invalidate any outstanding Iterators. The caller must
handle this for its path object, but there may be copies elsewhere,
which have just ref'd the underlying arrays. To keep these copys'
iterators alive, we defensively "copy-on-write", so as to not relocate
their buffers.

Incidentally, update SkContourMeasureIter's constructor to clarify that
it is iterating through its copy of the path, and not the original.

Change-Id: I5c9331ab36ac8e156218532478f6d7105fd97cdc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326438
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
5 files changed