Reland "Remove GrAAType from GrFillRRectOp"

This is a reland of 43e73df990

Original change's description:
> Remove GrAAType from GrFillRRectOp
>
> Replaces it with GrAA. This op always uses analytic coverage,
> regardless of MSAA state.
>
> Bug: skia:11396
> Change-Id: I75174a00bdb3b1f62319de5970aac7f1bbae8e10
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383418
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:11396
Change-Id: I2589a8f81a43f05329b91b6a136bebf723a5dd03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384298
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2021-03-12 12:09:12 -07:00 committed by Skia Commit-Bot
parent 7854da39b3
commit 4f447342ce
3 changed files with 13 additions and 14 deletions

View File

@ -974,7 +974,8 @@ void GrSurfaceDrawContext::drawRRect(const GrClip* origClip,
}
if (!op && style.isSimpleFill()) {
assert_alive(paint);
op = GrFillRRectOp::Make(fContext, std::move(paint), viewMatrix, rrect, aaType);
op = GrFillRRectOp::Make(fContext, std::move(paint), viewMatrix, rrect,
GrAA(aaType != GrAAType::kNone));
}
if (!op && GrAAType::kCoverage == aaType) {
assert_alive(paint);
@ -1280,7 +1281,7 @@ void GrSurfaceDrawContext::drawOval(const GrClip* clip,
// ovals the exact same way we do round rects.
assert_alive(paint);
op = GrFillRRectOp::Make(fContext, std::move(paint), viewMatrix, SkRRect::MakeOval(oval),
aaType);
GrAA(aaType != GrAAType::kNone));
}
if (!op && GrAAType::kCoverage == aaType) {
assert_alive(paint);

View File

@ -35,7 +35,7 @@ public:
GrPaint&&,
const SkMatrix& viewMatrix,
const SkRRect&,
GrAAType);
GrAA);
const char* name() const final { return "GrFillRRectOp"; }
@ -142,7 +142,7 @@ GrOp::Owner FillRRectOp::Make(GrRecordingContext* ctx,
GrPaint&& paint,
const SkMatrix& viewMatrix,
const SkRRect& rrect,
GrAAType aaType) {
GrAA aa) {
using Helper = GrSimpleMeshDrawOpHelper;
const GrCaps* caps = ctx->priv().caps();
@ -163,7 +163,7 @@ GrOp::Owner FillRRectOp::Make(GrRecordingContext* ctx,
// coverage mode. We use them as long as the approximation will be accurate enough.
flags |= ProcessorFlags::kUseHWDerivatives;
}
if (aaType == GrAAType::kNone) {
if (aa == GrAA::kNo) {
flags |= ProcessorFlags::kFakeNonAA;
}
@ -204,7 +204,8 @@ FillRRectOp::FillRRectOp(GrProcessorSet* processorSet,
ProcessorFlags::kMSAAEnabled)) {
// FillRRectOp::Make fails if there is perspective.
SkASSERT(!totalShapeMatrix.hasPerspective());
this->setBounds(devBounds, GrOp::HasAABloat::kYes, GrOp::IsHairline::kNo);
this->setBounds(devBounds, GrOp::HasAABloat(!(processorFlags & ProcessorFlags::kFakeNonAA)),
GrOp::IsHairline::kNo);
// Write the matrix attribs.
const SkMatrix& m = totalShapeMatrix;
@ -765,8 +766,8 @@ GrOp::Owner GrFillRRectOp::Make(GrRecordingContext* ctx,
GrPaint&& paint,
const SkMatrix& viewMatrix,
const SkRRect& rrect,
GrAAType aaType) {
return FillRRectOp::Make(ctx, std::move(paint), viewMatrix, rrect, aaType);
GrAA aa) {
return FillRRectOp::Make(ctx, std::move(paint), viewMatrix, rrect, aa);
}
#if GR_TEST_UTILS
@ -775,10 +776,7 @@ GrOp::Owner GrFillRRectOp::Make(GrRecordingContext* ctx,
GR_DRAW_OP_TEST_DEFINE(FillRRectOp) {
SkMatrix viewMatrix = GrTest::TestMatrix(random);
GrAAType aaType = GrAAType::kNone;
if (random->nextBool()) {
aaType = (numSamples > 1) ? GrAAType::kMSAA : GrAAType::kCoverage;
}
GrAA aa = GrAA(random->nextBool());
SkRect rect = GrTest::TestRect(random);
float w = rect.width();
@ -792,7 +790,7 @@ GR_DRAW_OP_TEST_DEFINE(FillRRectOp) {
std::move(paint),
viewMatrix,
rrect,
aaType);
aa);
}
#endif

View File

@ -23,7 +23,7 @@ namespace GrFillRRectOp {
GrPaint&&,
const SkMatrix& viewMatrix,
const SkRRect&,
GrAAType);
GrAA);
} // namespace GrFillRRectOp
#endif