ccpr: Cleanup on-flush path stats
Adds a wrapper struct to limit the number of free variables. Fixes a
bug where we preallocated draw instances for clip paths. Counts conic
weights and preallocates their buffer as well.
Bug: skia:
Change-Id: I72779c9017322a0dc64461c8cb927f975406b9af
Reviewed-on: https://skia-review.googlesource.com/126844
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCPathParser.cpp b/src/gpu/ccpr/GrCCPathParser.cpp
index 1629a19..b29bec7 100644
--- a/src/gpu/ccpr/GrCCPathParser.cpp
+++ b/src/gpu/ccpr/GrCCPathParser.cpp
@@ -21,13 +21,13 @@
using TriPointInstance = GrCCCoverageProcessor::TriPointInstance;
using QuadPointInstance = GrCCCoverageProcessor::QuadPointInstance;
-GrCCPathParser::GrCCPathParser(int maxTotalPaths, int maxPathPoints, int numSkPoints,
- int numSkVerbs)
- : fLocalDevPtsBuffer(maxPathPoints + 1) // Overallocate by one point to accomodate for
- // overflow with Sk4f. (See parsePath.)
- , fGeometry(numSkPoints, numSkVerbs)
- , fPathsInfo(maxTotalPaths)
- , fScissorSubBatches(maxTotalPaths)
+GrCCPathParser::GrCCPathParser(int numPaths, const PathStats& pathStats)
+ // Overallocate by one point to accomodate for overflow with Sk4f. (See parsePath.)
+ : fLocalDevPtsBuffer(pathStats.fMaxPointsPerPath + 1)
+ , fGeometry(pathStats.fNumTotalSkPoints, pathStats.fNumTotalSkVerbs,
+ pathStats.fNumTotalConicWeights)
+ , fPathsInfo(numPaths)
+ , fScissorSubBatches(numPaths)
, fTotalPrimitiveCounts{PrimitiveTallies(), PrimitiveTallies()} {
// Batches decide what to draw by looking where the previous one ended. Define initial batches
// that "end" at the beginning of the data. These will not be drawn, but will only be be read by