diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-05-22 16:17:48 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-23 13:27:41 +0000 |
commit | f104fec6d745540019556823f849535fe8872653 (patch) | |
tree | 49a7fb44c37f7e8b333f259714d14a2f5eefa3e3 /src/gpu/ccpr | |
parent | 3087c1f382f1cd547598dc75f47ccbc8fe1e6e0f (diff) |
Delete GrDrawOp::wasRecorded
Bug: skia:7988
Change-Id: I8d12beec835767f22302a1e167fcef46ee5e5ffc
Reviewed-on: https://skia-review.googlesource.com/129555
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r-- | src/gpu/ccpr/GrCCDrawPathsOp.cpp | 9 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCCDrawPathsOp.h | 2 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp | 20 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.h | 6 |
4 files changed, 21 insertions, 16 deletions
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp index 80304857d0..96c1134536 100644 --- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp +++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp @@ -81,10 +81,11 @@ bool GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, const GrCaps& caps) { return true; } -void GrCCDrawPathsOp::wasRecorded(GrRenderTargetOpList* opList) { +void GrCCDrawPathsOp::wasRecorded(GrCCRTPendingPaths* owningRTPendingPaths) { + SkASSERT(1 == fNumDraws); SkASSERT(!fOwningRTPendingPaths); - fOwningRTPendingPaths = fCCPR->lookupRTPendingPaths(opList); - fOwningRTPendingPaths->fDrawOps.addToTail(this); + owningRTPendingPaths->fDrawOps.addToTail(this); + fOwningRTPendingPaths = owningRTPendingPaths; } int GrCCDrawPathsOp::countPaths(GrCCPathParser::PathStats* stats) const { @@ -134,6 +135,8 @@ void GrCCDrawPathsOp::setupResources(GrCCPerFlushResources* resources, } void GrCCDrawPathsOp::onExecute(GrOpFlushState* flushState) { + SkASSERT(fOwningRTPendingPaths); + const GrCCPerFlushResources* resources = fCCPR->getPerFlushResources(); if (!resources) { return; // Setup failed. diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.h b/src/gpu/ccpr/GrCCDrawPathsOp.h index 35981723cb..b523442393 100644 --- a/src/gpu/ccpr/GrCCDrawPathsOp.h +++ b/src/gpu/ccpr/GrCCDrawPathsOp.h @@ -35,13 +35,13 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, GrPixelConfigIsClamped) override; - void wasRecorded(GrRenderTargetOpList*) override; bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override; void visitProxies(const VisitProxyFunc& func) const override { fProcessors.visitProxies(func); } void onPrepare(GrOpFlushState*) override {} + void wasRecorded(GrCCRTPendingPaths* owningRTPendingPaths); int countPaths(GrCCPathParser::PathStats*) const; void setupResources(GrCCPerFlushResources*, GrOnFlushResourceProvider*); SkDEBUGCODE(int numSkippedInstances_debugOnly() const { return fNumSkippedInstances; }) diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index 35ac86c542..0c1b493471 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -112,19 +112,25 @@ bool GrCoverageCountingPathRenderer::onDrawPath(const DrawPathArgs& args) { SkPath croppedPath; path.transform(*args.fViewMatrix, &croppedPath); crop_path(croppedPath, clipIBounds, &croppedPath); - auto op = skstd::make_unique<GrCCDrawPathsOp>(this, std::move(args.fPaint), clipIBounds, - SkMatrix::I(), croppedPath, - croppedPath.getBounds()); - rtc->addDrawOp(*args.fClip, std::move(op)); + this->adoptAndRecordOp(new GrCCDrawPathsOp(this, std::move(args.fPaint), clipIBounds, + SkMatrix::I(), croppedPath, + croppedPath.getBounds()), args); return true; } - auto op = skstd::make_unique<GrCCDrawPathsOp>(this, std::move(args.fPaint), clipIBounds, - *args.fViewMatrix, path, devBounds); - rtc->addDrawOp(*args.fClip, std::move(op)); + this->adoptAndRecordOp(new GrCCDrawPathsOp(this, std::move(args.fPaint), clipIBounds, + *args.fViewMatrix, path, devBounds), args); return true; } +void GrCoverageCountingPathRenderer::adoptAndRecordOp(GrCCDrawPathsOp* op, + const DrawPathArgs& args) { + GrRenderTargetContext* rtc = args.fRenderTargetContext; + if (uint32_t opListID = rtc->addDrawOp(*args.fClip, std::unique_ptr<GrDrawOp>(op))) { + op->wasRecorded(&fRTPendingPathsMap[opListID]); + } +} + std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipProcessor( GrProxyProvider* proxyProvider, uint32_t opListID, const SkPath& deviceSpacePath, const SkIRect& accessRect, diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h index 93f767fce2..ca52fedada 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h @@ -78,10 +78,7 @@ public: private: GrCoverageCountingPathRenderer(bool drawCachablePaths); - GrCCRTPendingPaths* lookupRTPendingPaths(GrRenderTargetOpList* opList) { - SkASSERT(!fFlushing); - return &fRTPendingPathsMap[opList->uniqueID()]; - } + void adoptAndRecordOp(GrCCDrawPathsOp*, const DrawPathArgs&); const GrCCPerFlushResources* getPerFlushResources() const { SkASSERT(fFlushing); @@ -96,7 +93,6 @@ private: const bool fDrawCachablePaths; - friend void GrCCDrawPathsOp::wasRecorded(GrRenderTargetOpList*); // For lookupRTPendingPaths. friend void GrCCDrawPathsOp::onExecute(GrOpFlushState*); // For getPerFlushResources. }; |