Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: src/gpu/batches/GrStencilAndCoverPathRenderer.cpp

Issue 2342873002: Fix key computation for GrPaths (Closed)
Patch Set: more MSVS warnings Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPath.cpp ('k') | tests/GpuDrawPathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 4f2c6b35b6b4a5a5fa002184a35b9594977878ae..69a3142f21d32c901837c27a8a184c232495f238 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -51,20 +51,28 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
}
}
-static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const SkPath& skPath,
- const GrStyle& style) {
+static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape& shape) {
GrUniqueKey key;
bool isVolatile;
- GrPath::ComputeKey(skPath, style, &key, &isVolatile);
- SkAutoTUnref<GrPath> path(
- static_cast<GrPath*>(resourceProvider->findAndRefResourceByUniqueKey(key)));
+ GrPath::ComputeKey(shape, &key, &isVolatile);
+ sk_sp<GrPath> path;
+ if (!isVolatile) {
+ path.reset(
+ static_cast<GrPath*>(resourceProvider->findAndRefResourceByUniqueKey(key)));
+ }
if (!path) {
- path.reset(resourceProvider->createPath(skPath, style));
+ SkPath skPath;
+ shape.asPath(&skPath);
+ path.reset(resourceProvider->createPath(skPath, shape.style()));
if (!isVolatile) {
- resourceProvider->assignUniqueKeyToResource(key, path);
+ resourceProvider->assignUniqueKeyToResource(key, path.get());
}
} else {
- SkASSERT(path->isEqualTo(skPath, style));
+#ifdef SK_DEBUG
+ SkPath skPath;
+ shape.asPath(&skPath);
+ SkASSERT(path->isEqualTo(skPath, shape.style()));
+#endif
}
return path.release();
}
@@ -73,10 +81,8 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onStencilPath");
SkASSERT(!args.fIsAA || args.fDrawContext->isStencilBufferMultisampled());
- SkPath path;
- args.fShape->asPath(&path);
- SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, GrStyle::SimpleFill()));
+ SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fIsAA, *args.fViewMatrix, p);
}
@@ -91,7 +97,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
- SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, args.fShape->style()));
+ SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
if (path.isInverseFillType()) {
SkMatrix invert = SkMatrix::I();
« no previous file with comments | « src/gpu/GrPath.cpp ('k') | tests/GpuDrawPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698