Chromium Code Reviews| Index: src/gpu/batches/GrTessellatingPathRenderer.cpp |
| diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp |
| index e697f78d7218e2a6d36f8c06f3b0fce3ce1c69be..acd906feb5ee5503c5eb43b7c260c69dd33f5588 100644 |
| --- a/src/gpu/batches/GrTessellatingPathRenderer.cpp |
| +++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp |
| @@ -106,10 +106,12 @@ bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons |
| // This path renderer can draw all fill styles, all stroke styles except hairlines, but does |
| // not do antialiasing. It can do convex and concave paths, but we'll leave the convex ones to |
| // simpler algorithms. Similary, we skip the non-hairlines that can be treated as hairline. |
| - // An arbitrary path effect could produce a hairline result so we pass on those. |
| + // An arbitrary path effect could produce a hairline result so we pass on those. We also skip |
| + // volatile paths since they are not cacheable. |
| return !IsStrokeHairlineOrEquivalent(*args.fStyle, *args.fViewMatrix, nullptr) && |
| !args.fStyle->strokeRec().isHairlineStyle() && |
| - !args.fStyle->hasNonDashPathEffect() && !args.fAntiAlias && !args.fPath->isConvex(); |
| + !args.fStyle->hasNonDashPathEffect() && !args.fAntiAlias && !args.fPath->isConvex() && |
| + !args.fPath->isVolatile(); |
|
Stephen White
2016/05/18 13:45:49
Could you put this ahead of the other tests? (Vari
bsalomon
2016/05/18 13:53:43
Because it is a fast check, right? I reordered the
|
| } |
| class TessellatingPathBatch : public GrVertexBatch { |
| @@ -160,25 +162,25 @@ private: |
| int clipBoundsCnt = |
| fPath.isInverseFillType() ? sizeof(fClipBounds) / sizeof(uint32_t) : 0; |
| int styleDataCnt = GrStyle::KeySize(fStyle, GrStyle::Apply::kPathEffectAndStrokeRec); |
| - if (styleDataCnt >= 0) { |
| - GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsCnt + styleDataCnt); |
| - builder[0] = fPath.getGenerationID(); |
| - builder[1] = fPath.getFillType(); |
| - // For inverse fills, the tessellation is dependent on clip bounds. |
| - if (fPath.isInverseFillType()) { |
| - memcpy(&builder[2], &fClipBounds, sizeof(fClipBounds)); |
| - } |
| - if (styleDataCnt) { |
| - GrStyle::WriteKey(&builder[2 + clipBoundsCnt], fStyle, |
| - GrStyle::Apply::kPathEffectAndStrokeRec, styleScale); |
| - } |
| - builder.finish(); |
| - SkAutoTUnref<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key)); |
| - int actualCount; |
| - if (cache_match(cachedVertexBuffer.get(), tol, &actualCount)) { |
| - this->drawVertices(target, gp, cachedVertexBuffer.get(), 0, actualCount); |
| - return; |
| - } |
| + // We should have excluded anything we wouldn't know how to cache. |
| + SkASSERT(styleDataCnt >= 0); |
| + GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsCnt + styleDataCnt); |
| + builder[0] = fPath.getGenerationID(); |
| + builder[1] = fPath.getFillType(); |
| + // For inverse fills, the tessellation is dependent on clip bounds. |
| + if (fPath.isInverseFillType()) { |
| + memcpy(&builder[2], &fClipBounds, sizeof(fClipBounds)); |
| + } |
| + if (styleDataCnt) { |
| + GrStyle::WriteKey(&builder[2 + clipBoundsCnt], fStyle, |
| + GrStyle::Apply::kPathEffectAndStrokeRec, styleScale); |
| + } |
| + builder.finish(); |
| + SkAutoTUnref<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key)); |
| + int actualCount; |
| + if (cache_match(cachedVertexBuffer.get(), tol, &actualCount)) { |
| + this->drawVertices(target, gp, cachedVertexBuffer.get(), 0, actualCount); |
| + return; |
| } |
| SkPath path; |