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>
This commit is contained in:
parent
f865b05fe5
commit
a883acab4a
@ -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];
|
||||
|
||||
const auto& lastBatch = fCoverageCountBatches.back();
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user