aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-03-08 23:05:30 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-09 16:34:11 +0000
commita883acab4a7686a2c59d0e44024cbe892399dee5 (patch)
tree19a4f0d8b5086c4da9ccca19e918d003f8a639cf /src/gpu
parentf865b05fe50ca2c094b9c60e4405c6094415b4f6 (diff)
ccpr: Fix stale array access after dynamic resize
Bug: skia:7656 Change-Id: I0db2219a1c31e966e1da064011c849b4458ff9c1 Reviewed-on: https://skia-review.googlesource.com/113363 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/ccpr/GrCCPathParser.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gpu/ccpr/GrCCPathParser.cpp b/src/gpu/ccpr/GrCCPathParser.cpp
index fd0b71da29..cb5311f3a1 100644
--- a/src/gpu/ccpr/GrCCPathParser.cpp
+++ b/src/gpu/ccpr/GrCCPathParser.cpp
@@ -262,23 +262,23 @@ void GrCCPathParser::discardParsedPath() {
GrCCPathParser::CoverageCountBatchID GrCCPathParser::closeCurrentBatch() {
SkASSERT(!fInstanceBuffer);
SkASSERT(!fCoverageCountBatches.empty());
+
const auto& lastBatch = fCoverageCountBatches.back();
- const auto& lastScissorSubBatch = fScissorSubBatches[lastBatch.fEndScissorSubBatchIdx - 1];
+ int maxMeshes = 1 + fScissorSubBatches.count() - lastBatch.fEndScissorSubBatchIdx;
+ fMaxMeshesPerDraw = SkTMax(fMaxMeshesPerDraw, maxMeshes);
+ const auto& lastScissorSubBatch = fScissorSubBatches[lastBatch.fEndScissorSubBatchIdx - 1];
PrimitiveTallies batchTotalCounts = fTotalPrimitiveCounts[(int)ScissorMode::kNonScissored] -
lastBatch.fEndNonScissorIndices;
batchTotalCounts += fTotalPrimitiveCounts[(int)ScissorMode::kScissored] -
lastScissorSubBatch.fEndPrimitiveIndices;
+ // This will invalidate lastBatch.
fCoverageCountBatches.push_back() = {
fTotalPrimitiveCounts[(int)ScissorMode::kNonScissored],
fScissorSubBatches.count(),
batchTotalCounts
};
-
- int maxMeshes = 1 + fScissorSubBatches.count() - lastBatch.fEndScissorSubBatchIdx;
- fMaxMeshesPerDraw = SkTMax(fMaxMeshesPerDraw, maxMeshes);
-
return fCoverageCountBatches.count() - 1;
}