diff options
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp | 10 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.h | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index 877c8727b0..86a436568f 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -37,13 +37,17 @@ bool GrCoverageCountingPathRenderer::IsSupported(const GrCaps& caps) { } sk_sp<GrCoverageCountingPathRenderer> -GrCoverageCountingPathRenderer::CreateIfSupported(const GrCaps& caps) { - return sk_sp<GrCoverageCountingPathRenderer>(IsSupported(caps) ? - new GrCoverageCountingPathRenderer : nullptr); +GrCoverageCountingPathRenderer::CreateIfSupported(const GrCaps& caps, bool drawCachablePaths) { + auto ccpr = IsSupported(caps) ? new GrCoverageCountingPathRenderer(drawCachablePaths) : nullptr; + return sk_sp<GrCoverageCountingPathRenderer>(ccpr); } GrPathRenderer::CanDrawPath GrCoverageCountingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { + if (args.fShape->hasUnstyledKey() && !fDrawCachablePaths) { + return CanDrawPath::kNo; + } + if (!args.fShape->style().isSimpleFill() || args.fShape->inverseFilled() || args.fViewMatrix->hasPerspective() || diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h index 6025581da8..035898dc27 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h @@ -32,7 +32,8 @@ class GrCoverageCountingPathRenderer public: static bool IsSupported(const GrCaps&); - static sk_sp<GrCoverageCountingPathRenderer> CreateIfSupported(const GrCaps&); + static sk_sp<GrCoverageCountingPathRenderer> CreateIfSupported(const GrCaps&, + bool drawCachablePaths); // GrPathRenderer overrides. StencilSupport onGetStencilSupport(const GrShape&) const override { @@ -121,7 +122,8 @@ public: }; private: - GrCoverageCountingPathRenderer() = default; + GrCoverageCountingPathRenderer(bool drawCachablePaths) + : fDrawCachablePaths(drawCachablePaths) {} void setupPerFlushResources(GrOnFlushResourceProvider*, const uint32_t* opListIDs, int numOpListIDs, SkTArray<sk_sp<GrRenderTargetContext>>* results); @@ -143,6 +145,8 @@ private: GrSTAllocator<4, GrCCPRAtlas> fPerFlushAtlases; bool fPerFlushResourcesAreValid; SkDEBUGCODE(bool fFlushing = false;) + + const bool fDrawCachablePaths; }; #endif |