| Index: src/gpu/GrTessellatingPathRenderer.cpp
|
| diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
|
| index 282efe251666a46ac42b04424e58c76d46c3b447..5defe2942deed7601465ca563ca4d5a52ad4ec68 100644
|
| --- a/src/gpu/GrTessellatingPathRenderer.cpp
|
| +++ b/src/gpu/GrTessellatingPathRenderer.cpp
|
| @@ -1394,9 +1394,12 @@ public:
|
|
|
| static GrBatch* Create(const GrColor& color,
|
| const SkPath& path,
|
| + const GrStrokeInfo* stroke,
|
| const SkMatrix& viewMatrix,
|
| - SkRect clipBounds) {
|
| - return SkNEW_ARGS(TessellatingPathBatch, (color, path, viewMatrix, clipBounds));
|
| + SkRect clipBounds,
|
| + const SkPath* origSrcPath,
|
| + const GrStrokeInfo* origStrokeInfo) {
|
| + return SkNEW_ARGS(TessellatingPathBatch, (color, path, stroke, viewMatrix, clipBounds, origSrcPath, origStrokeInfo));
|
| }
|
|
|
| const char* name() const override { return "TessellatingPathBatch"; }
|
| @@ -1485,15 +1488,13 @@ public:
|
| LOG("actual count: %d\n", actualCount);
|
| SkASSERT(actualCount <= count);
|
|
|
| - if (!fPath.isVolatile()) {
|
| - TessInfo info;
|
| - info.fTolerance = isLinear ? 0 : tol;
|
| - info.fCount = actualCount;
|
| - SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
|
| - key->setCustomData(data.get());
|
| - resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get());
|
| - SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key)));
|
| - }
|
| + TessInfo info;
|
| + info.fTolerance = isLinear ? 0 : tol;
|
| + info.fCount = actualCount;
|
| + SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
|
| + key->setCustomData(data.get());
|
| + resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get());
|
| + SkPathPriv::AddGenIDChangeListener(fPathForKey, SkNEW(PathInvalidator(*key)));
|
| return actualCount;
|
| }
|
|
|
| @@ -1503,13 +1504,15 @@ public:
|
| GrUniqueKey key;
|
| int clipBoundsSize32 =
|
| fPath.isInverseFillType() ? sizeof(fClipBounds) / sizeof(uint32_t) : 0;
|
| - GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsSize32);
|
| - builder[0] = fPath.getGenerationID();
|
| - builder[1] = fPath.getFillType();
|
| + int strokeDataSize32 = fOrigStroke.computeUniqueKeyFragmentData32Cnt();
|
| + GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsSize32 + strokeDataSize32);
|
| + builder[0] = fPathForKey.getGenerationID();
|
| + builder[1] = fPathForKey.getFillType();
|
| // For inverse fills, the tessellation is dependent on clip bounds.
|
| if (fPath.isInverseFillType()) {
|
| memcpy(&builder[2], &fClipBounds, sizeof(fClipBounds));
|
| }
|
| + fOrigStroke.asUniqueKeyFragment(&builder[2 + clipBoundsSize32]);
|
| builder.finish();
|
| GrResourceProvider* rp = batchTarget->resourceProvider();
|
| SkAutoTUnref<GrVertexBuffer> vertexBuffer(rp->findAndRefTByUniqueKey<GrVertexBuffer>(key));
|
| @@ -1561,12 +1564,18 @@ public:
|
| private:
|
| TessellatingPathBatch(const GrColor& color,
|
| const SkPath& path,
|
| + const GrStrokeInfo* stroke,
|
| const SkMatrix& viewMatrix,
|
| - const SkRect& clipBounds)
|
| + const SkRect& clipBounds,
|
| + const SkPath* origSrcPath,
|
| + const GrStrokeInfo* origStrokeInfo)
|
| : fColor(color)
|
| , fPath(path)
|
| + , fStroke(*stroke)
|
| , fViewMatrix(viewMatrix)
|
| - , fClipBounds(clipBounds) {
|
| + , fClipBounds(clipBounds)
|
| + , fPathForKey(origSrcPath ? *origSrcPath : fPath)
|
| + , fOrigStroke(origStrokeInfo ? *origStrokeInfo : *stroke) {
|
| this->initClassID<TessellatingPathBatch>();
|
|
|
| fBounds = path.getBounds();
|
| @@ -1575,9 +1584,12 @@ private:
|
|
|
| GrColor fColor;
|
| SkPath fPath;
|
| + GrStrokeInfo fStroke;
|
| SkMatrix fViewMatrix;
|
| SkRect fClipBounds; // in source space
|
| GrPipelineInfo fPipelineInfo;
|
| + SkPath fPathForKey;
|
| + GrStrokeInfo fOrigStroke;
|
| };
|
|
|
| bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| @@ -1596,7 +1608,7 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| }
|
| vmi.mapRect(&clipBounds);
|
| SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fPath,
|
| - *args.fViewMatrix, clipBounds));
|
| + args.fStroke, *args.fViewMatrix, clipBounds, args.fOrigSrcPath, args.fOrigStrokeInfo));
|
| args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
|
|
| return true;
|
| @@ -1610,6 +1622,7 @@ BATCH_TEST_DEFINE(TesselatingPathBatch) {
|
| GrColor color = GrRandomColor(random);
|
| SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
|
| SkPath path = GrTest::TestPath(random);
|
| + GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle);
|
| SkRect clipBounds = GrTest::TestRect(random);
|
| SkMatrix vmi;
|
| bool result = viewMatrix.invert(&vmi);
|
| @@ -1617,7 +1630,7 @@ BATCH_TEST_DEFINE(TesselatingPathBatch) {
|
| SkFAIL("Cannot invert matrix\n");
|
| }
|
| vmi.mapRect(&clipBounds);
|
| - return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds);
|
| + return TessellatingPathBatch::Create(color, path, &stroke, viewMatrix, clipBounds, nullptr, nullptr);
|
| }
|
|
|
| #endif
|
|
|