diff options
author | 2018-04-19 09:18:33 -0400 | |
---|---|---|
committer | 2018-04-19 13:57:44 +0000 | |
commit | cc9856cdd51fa9530496d8080cf84997838314a9 (patch) | |
tree | c2e9dbf018106839edd2153e7dc0b4af4ffca3a3 /src | |
parent | e7fd7ff0eca868c35eccb7a870fbc7bc05aa9176 (diff) |
clean up setReserve() rule-bending
These routines call setReserve(N), write M<N items into the reserved
memory, and then setCount(M) afterwards. That happens to function with
SkTDArray's current implementation, but really breaks the spirit of what
setReserve() means.
This CL switches those setReserve() calls to setCount().
Calling setCount(N), writing M<N items, then setCount(M) should have the
exact same effect, and be completely within the rules.
Already reviewed here: https://skia-review.googlesource.com/c/skia/+/115982
Change-Id: I462479488055cf1c99de2bc6dbc1707dbe24db7e
Reviewed-on: https://skia-review.googlesource.com/122301
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/ops/GrAAConvexTessellator.cpp | 4 | ||||
-rwxr-xr-x | src/utils/SkShadowTessellator.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gpu/ops/GrAAConvexTessellator.cpp b/src/gpu/ops/GrAAConvexTessellator.cpp index f72142eda8..05fe2eaf7e 100644 --- a/src/gpu/ops/GrAAConvexTessellator.cpp +++ b/src/gpu/ops/GrAAConvexTessellator.cpp @@ -934,7 +934,7 @@ void GrAAConvexTessellator::lineTo(const SkMatrix& m, SkPoint p, CurveState curv void GrAAConvexTessellator::quadTo(const SkPoint pts[3]) { int maxCount = GrPathUtils::quadraticPointCount(pts, kQuadTolerance); - fPointBuffer.setReserve(maxCount); + fPointBuffer.setCount(maxCount); SkPoint* target = fPointBuffer.begin(); int count = GrPathUtils::generateQuadraticPoints(pts[0], pts[1], pts[2], kQuadTolerance, &target, maxCount); @@ -953,7 +953,7 @@ void GrAAConvexTessellator::quadTo(const SkMatrix& m, SkPoint pts[3]) { void GrAAConvexTessellator::cubicTo(const SkMatrix& m, SkPoint pts[4]) { m.mapPoints(pts, 4); int maxCount = GrPathUtils::cubicPointCount(pts, kCubicTolerance); - fPointBuffer.setReserve(maxCount); + fPointBuffer.setCount(maxCount); SkPoint* target = fPointBuffer.begin(); int count = GrPathUtils::generateCubicPoints(pts[0], pts[1], pts[2], pts[3], kCubicTolerance, &target, maxCount); diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp index 5d6a4cc15d..98c47a6f2d 100755 --- a/src/utils/SkShadowTessellator.cpp +++ b/src/utils/SkShadowTessellator.cpp @@ -188,7 +188,7 @@ void SkBaseShadowTessellator::handleQuad(const SkPoint pts[3]) { } // TODO: Pull PathUtils out of Ganesh? int maxCount = GrPathUtils::quadraticPointCount(pts, kQuadTolerance); - fPointBuffer.setReserve(maxCount); + fPointBuffer.setCount(maxCount); SkPoint* target = fPointBuffer.begin(); int count = GrPathUtils::generateQuadraticPoints(pts[0], pts[1], pts[2], kQuadTolerance, &target, maxCount); @@ -213,7 +213,7 @@ void SkBaseShadowTessellator::handleCubic(const SkMatrix& m, SkPoint pts[4]) { #if SK_SUPPORT_GPU // TODO: Pull PathUtils out of Ganesh? int maxCount = GrPathUtils::cubicPointCount(pts, kCubicTolerance); - fPointBuffer.setReserve(maxCount); + fPointBuffer.setCount(maxCount); SkPoint* target = fPointBuffer.begin(); int count = GrPathUtils::generateCubicPoints(pts[0], pts[1], pts[2], pts[3], kCubicTolerance, &target, maxCount); |