diff options
Diffstat (limited to 'src/gpu/ccpr/GrCCPerFlushResources.cpp')
-rw-r--r-- | src/gpu/ccpr/GrCCPerFlushResources.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp index 3f02ac75f6..a80d789f3f 100644 --- a/src/gpu/ccpr/GrCCPerFlushResources.cpp +++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp @@ -14,13 +14,14 @@ using PathInstance = GrCCPathProcessor::Instance; GrCCPerFlushResources::GrCCPerFlushResources(GrOnFlushResourceProvider* onFlushRP, - int numPathDraws, int numClipPaths, - const GrCCPathParser::PathStats& pathStats) - : fPathParser(sk_make_sp<GrCCPathParser>(numPathDraws + numClipPaths, pathStats)) + const GrCCPerFlushResourceSpecs& specs) + : fPathParser(sk_make_sp<GrCCPathParser>(specs.fNumRenderedPaths + specs.fNumClipPaths, + specs.fParsingPathStats)) + , fAtlasSpecs(specs.fAtlasSpecs) , fIndexBuffer(GrCCPathProcessor::FindIndexBuffer(onFlushRP)) , fVertexBuffer(GrCCPathProcessor::FindVertexBuffer(onFlushRP)) , fInstanceBuffer(onFlushRP->makeBuffer(kVertex_GrBufferType, - numPathDraws * sizeof(PathInstance))) { + specs.fNumRenderedPaths * sizeof(PathInstance))) { if (!fIndexBuffer) { SkDebugf("WARNING: failed to allocate CCPR index buffer. No paths will be drawn.\n"); return; @@ -35,34 +36,31 @@ GrCCPerFlushResources::GrCCPerFlushResources(GrOnFlushResourceProvider* onFlushR } fPathInstanceData = static_cast<PathInstance*>(fInstanceBuffer->map()); SkASSERT(fPathInstanceData); - SkDEBUGCODE(fPathInstanceBufferCount = numPathDraws); + SkDEBUGCODE(fPathInstanceBufferCount = specs.fNumRenderedPaths); } -GrCCAtlas* GrCCPerFlushResources::renderPathInAtlas(const GrCaps& caps, const SkIRect& clipIBounds, - const SkMatrix& m, const SkPath& path, - SkRect* devBounds, SkRect* devBounds45, - int16_t* atlasOffsetX, int16_t* atlasOffsetY) { +GrCCAtlas* GrCCPerFlushResources::renderPathInAtlas(const SkIRect& clipIBounds, const SkMatrix& m, + const SkPath& path, SkRect* devBounds, + SkRect* devBounds45, int16_t* atlasOffsetX, + int16_t* atlasOffsetY) { SkASSERT(this->isMapped()); SkIRect devIBounds; fPathParser->parsePath(m, path, devBounds, devBounds45); devBounds->roundOut(&devIBounds); - return this->placeParsedPathInAtlas(caps, clipIBounds, devIBounds, atlasOffsetX, atlasOffsetY); + return this->placeParsedPathInAtlas(clipIBounds, devIBounds, atlasOffsetX, atlasOffsetY); } -GrCCAtlas* GrCCPerFlushResources::renderDeviceSpacePathInAtlas(const GrCaps& caps, - const SkIRect& clipIBounds, +GrCCAtlas* GrCCPerFlushResources::renderDeviceSpacePathInAtlas(const SkIRect& clipIBounds, const SkPath& devPath, const SkIRect& devPathIBounds, int16_t* atlasOffsetX, int16_t* atlasOffsetY) { SkASSERT(this->isMapped()); fPathParser->parseDeviceSpacePath(devPath); - return this->placeParsedPathInAtlas(caps, clipIBounds, devPathIBounds, atlasOffsetX, - atlasOffsetY); + return this->placeParsedPathInAtlas(clipIBounds, devPathIBounds, atlasOffsetX, atlasOffsetY); } -GrCCAtlas* GrCCPerFlushResources::placeParsedPathInAtlas(const GrCaps& caps, - const SkIRect& clipIBounds, +GrCCAtlas* GrCCPerFlushResources::placeParsedPathInAtlas(const SkIRect& clipIBounds, const SkIRect& pathIBounds, int16_t* atlasOffsetX, int16_t* atlasOffsetY) { @@ -87,7 +85,7 @@ GrCCAtlas* GrCCPerFlushResources::placeParsedPathInAtlas(const GrCaps& caps, auto coverageCountBatchID = fPathParser->closeCurrentBatch(); fAtlases.back().setCoverageCountBatchID(coverageCountBatchID); } - fAtlases.emplace_back(caps, SkTMax(w, h)); + fAtlases.emplace_back(fAtlasSpecs); SkAssertResult(fAtlases.back().addRect(w, h, &atlasLocation)); } |