Switch GrTextTarget from drawPath to drawShape

Change-Id: I96b424c1c9369be4183eeb38729d49fff2ba87f4
Reviewed-on: https://skia-review.googlesource.com/148902
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2018-08-23 13:53:01 -04:00 committed by Skia Commit-Bot
parent a522d66eff
commit 46a1338968
5 changed files with 14 additions and 15 deletions

View File

@ -98,8 +98,8 @@ public:
void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> 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??");
}

View File

@ -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();

View File

@ -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);
}

View File

@ -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<SkPath> 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);
}
}

View File

@ -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<GrAtlasTextOp> 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;