From 46a1338968689284d687c4b999e62b369ec608c3 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 23 Aug 2018 13:53:01 -0400 Subject: [PATCH] Switch GrTextTarget from drawPath to drawShape Change-Id: I96b424c1c9369be4183eeb38729d49fff2ba87f4 Reviewed-on: https://skia-review.googlesource.com/148902 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- src/atlastext/SkAtlasTextTarget.cpp | 4 ++-- src/core/SkClipStack.cpp | 3 --- src/gpu/GrRenderTargetContext.cpp | 9 ++++----- src/gpu/text/GrTextBlob.cpp | 8 +++++--- src/gpu/text/GrTextTarget.h | 5 +++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp index 1fd16c24e6..84853a77ee 100644 --- a/src/atlastext/SkAtlasTextTarget.cpp +++ b/src/atlastext/SkAtlasTextTarget.cpp @@ -98,8 +98,8 @@ public: void addDrawOp(const GrClip&, std::unique_ptr op) override; - void drawPath(const GrClip&, const SkPath&, const SkPaint&, const SkMatrix& viewMatrix, - bool pathIsMutable) override { + void drawShape(const GrClip&, const SkPaint&, const SkMatrix& viewMatrix, + const GrShape&) override { SkDebugf("Path glyph??"); } diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index bf12a1391d..97c0af2b84 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -217,17 +217,14 @@ void SkClipStack::Element::asDeviceSpacePath(SkPath* path) const { switch (fDeviceSpaceType) { case DeviceSpaceType::kEmpty: path->reset(); - path->setIsVolatile(true); break; case DeviceSpaceType::kRect: path->reset(); path->addRect(this->getDeviceSpaceRect()); - path->setIsVolatile(true); break; case DeviceSpaceType::kRRect: path->reset(); path->addRRect(fDeviceSpaceRRect); - path->setIsVolatile(true); break; case DeviceSpaceType::kPath: *path = *fDeviceSpacePath.get(); diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index cd3bd6a6cc..574455c90e 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -68,11 +68,8 @@ public: fRenderTargetContext->addDrawOp(clip, std::move(op)); } - void drawPath(const GrClip& clip, const SkPath& path, const SkPaint& paint, - const SkMatrix& viewMatrix, bool pathIsMutable) override { - // TODO: we are losing the mutability of the path here - GrShape shape(path, paint); - + void drawShape(const GrClip& clip, const SkPaint& paint, + const SkMatrix& viewMatrix, const GrShape& shape) override { GrBlurUtils::drawShapeWithMaskFilter(fRenderTargetContext->fContext, fRenderTargetContext, clip, paint, viewMatrix, shape); } @@ -1285,6 +1282,8 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip, if (complexStyle || GrAA::kYes == aa) { SkPath path; region.getBoundaryPath(&path); + path.setIsVolatile(true); + return this->drawPath(clip, std::move(paint), aa, viewMatrix, path, style); } diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp index bba3328ea8..7a1b3f7e8a 100644 --- a/src/gpu/text/GrTextBlob.cpp +++ b/src/gpu/text/GrTextBlob.cpp @@ -9,6 +9,7 @@ #include "GrBlurUtils.h" #include "GrClip.h" #include "GrContext.h" +#include "GrShape.h" #include "GrStyle.h" #include "GrTextTarget.h" #include "SkColorFilter.h" @@ -303,7 +304,6 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props, pathMatrix.postTranslate(pathGlyph.fX + transX, pathGlyph.fY + transY); const SkPath* path = &pathGlyph.fPath; - bool pathIsMutable = false; SkTLazy tmpPath; GrStyle style(runPaint); @@ -317,10 +317,12 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props, path->transform(pathMatrix, result); result->setIsVolatile(true); path = result; - pathIsMutable = true; } - target->drawPath(clip, *path, runPaint, *ctm, pathIsMutable); + // TODO: we are losing the mutability of the path here + GrShape shape(*path, paint); + + target->drawShape(clip, runPaint, *ctm, shape); } } diff --git a/src/gpu/text/GrTextTarget.h b/src/gpu/text/GrTextTarget.h index 18e45d2ff8..1742f59e1b 100644 --- a/src/gpu/text/GrTextTarget.h +++ b/src/gpu/text/GrTextTarget.h @@ -14,6 +14,7 @@ class GrAtlasTextOp; class GrClip; class GrPaint; +class GrShape; class SkGlyphRunListPainter; class SkMatrix; struct SkIRect; @@ -30,8 +31,8 @@ public: virtual void addDrawOp(const GrClip&, std::unique_ptr op) = 0; - virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&, - const SkMatrix& viewMatrix, bool pathIsMutable) = 0; + virtual void drawShape(const GrClip&, const SkPaint&, + const SkMatrix& viewMatrix, const GrShape&) = 0; virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix, GrPaint*) = 0;