Revert "Don't simplify strokes that could have been tessellated"

This reverts commit 3f95357c4c.

Reason for revert: I believe this is blocking the Chrome roll

Original change's description:
> Don't simplify strokes that could have been tessellated
>
> Bug: chromium:1172543
> Change-Id: I3be0d822ca0a338118059c7aa37b2fd7822869b8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: Id574d974617423b44d1767d7a478ce39bea810fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1172543
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366717
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2021-02-05 13:21:59 +00:00 committed by Skia Commit-Bot
parent 2c6d8d970a
commit 03555e92a1

View File

@ -1787,6 +1787,19 @@ void GrSurfaceDrawContext::drawShapeUsingPathRenderer(const GrClip* clip,
return;
}
// Always simplify the stroke for now. In the future we will give the tessellator a chance to
// claim strokes before trying to simplify them.
shape.simplifyStroke();
if (attemptDrawSimple || shape.simplified()) {
// Usually we enter drawShapeUsingPathRenderer() because the shape+style was too
// complex for dedicated draw ops. However, if GrStyledShape was able to reduce something
// we ought to try again instead of going right to path rendering.
if (this->drawSimpleShape(clip, &paint, aa, viewMatrix, shape)) {
return;
}
}
SkIRect clipConservativeBounds = get_clip_bounds(this, clip);
GrAAType aaType = this->chooseAAType(aa);
@ -1800,43 +1813,17 @@ void GrSurfaceDrawContext::drawShapeUsingPathRenderer(const GrClip* clip,
canDrawArgs.fClipConservativeBounds = &clipConservativeBounds;
canDrawArgs.fTargetIsWrappedVkSecondaryCB = this->wrapsVkSecondaryCB();
canDrawArgs.fHasUserStencilSettings = false;
GrPathRenderer* pr;
static constexpr GrPathRendererChain::DrawType kType = GrPathRendererChain::DrawType::kColor;
if (shape.isEmpty() && !shape.inverseFilled()) {
return;
}
canDrawArgs.fAAType = aaType;
constexpr static bool kDisallowSWPathRenderer = false;
constexpr static bool kAllowSWPathRenderer = true;
using DrawType = GrPathRendererChain::DrawType;
GrPathRenderer* pr = nullptr;
if (!shape.style().strokeRec().isFillStyle() && !shape.isEmpty()) {
// Give path renderers with dedicated stroke handling (e.g., tessellation) a chance to claim
// this stroke before we attempt to simplify it.
pr = this->drawingManager()->getPathRenderer(canDrawArgs, kDisallowSWPathRenderer,
DrawType::kColor);
}
if (!pr) {
// The shape isn't a stroke that can be drawn directly. Simplify if possible.
shape.simplifyStroke();
if (shape.isEmpty() && !shape.inverseFilled()) {
return;
}
if (attemptDrawSimple || shape.simplified()) {
// Usually we enter drawShapeUsingPathRenderer() because the shape+style was too complex
// for dedicated draw ops. However, if GrStyledShape was able to reduce something we
// ought to try again instead of going right to path rendering.
if (this->drawSimpleShape(clip, &paint, aa, viewMatrix, shape)) {
return;
}
}
// Try a 1st time without applying any of the style to the geometry (and barring sw)
pr = this->drawingManager()->getPathRenderer(canDrawArgs, kDisallowSWPathRenderer,
DrawType::kColor);
}
// Try a 1st time without applying any of the style to the geometry (and barring sw)
pr = this->drawingManager()->getPathRenderer(canDrawArgs, false, kType);
SkScalar styleScale = GrStyle::MatrixToScaleFactor(viewMatrix);
if (!pr && shape.style().pathEffect()) {
@ -1845,8 +1832,7 @@ void GrSurfaceDrawContext::drawShapeUsingPathRenderer(const GrClip* clip,
if (shape.isEmpty()) {
return;
}
pr = this->drawingManager()->getPathRenderer(canDrawArgs, kDisallowSWPathRenderer,
DrawType::kColor);
pr = this->drawingManager()->getPathRenderer(canDrawArgs, false, kType);
}
if (!pr) {
if (shape.style().applies()) {
@ -1855,8 +1841,7 @@ void GrSurfaceDrawContext::drawShapeUsingPathRenderer(const GrClip* clip,
return;
}
// This time, allow SW renderer
pr = this->drawingManager()->getPathRenderer(canDrawArgs, kAllowSWPathRenderer,
DrawType::kColor);
pr = this->drawingManager()->getPathRenderer(canDrawArgs, true, kType);
} else {
pr = this->drawingManager()->getSoftwarePathRenderer();
#if GR_PATH_RENDERER_SPEW