Don't copy when we can copy+and+transform at once

Change-Id: Ic4f77d91cc8c4f9d475c632932855f71505b9ff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359837
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-01-26 16:14:52 -05:00
parent 6742d13cbe
commit b64c26d56b

View File

@ -162,18 +162,18 @@ void SkPathRef::CreateTransformedCopy(sk_sp<SkPathRef>* dst,
}
if (dst->get() != &src) {
(*dst)->fPoints = src.fPoints;
(*dst)->fVerbs = src.fVerbs;
(*dst)->fConicWeights = src.fConicWeights;
(*dst)->callGenIDChangeListeners();
(*dst)->fGenerationID = 0; // mark as dirty
// don't copy, just allocate the points
(*dst)->fPoints.setCount(src.fPoints.count());
}
matrix.mapPoints((*dst)->fPoints.begin(), src.fPoints.begin(), src.fPoints.count());
// Need to check this here in case (&src == dst)
bool canXformBounds = !src.fBoundsIsDirty && matrix.rectStaysRect() && src.countPoints() > 1;
matrix.mapPoints((*dst)->fPoints.begin(), src.fPoints.begin(), src.fPoints.count());
/*
* Here we optimize the bounds computation, by noting if the bounds are
* already known, and if so, we just transform those as well and mark