From 4f447342cef65329ddf3097675c8855e3956a96a Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Fri, 12 Mar 2021 12:09:12 -0700 Subject: [PATCH] Reland "Remove GrAAType from GrFillRRectOp" This is a reland of 43e73df990cfb7edf7df9639689dabc44b4fadad 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 > Reviewed-by: Robert Phillips Bug: skia:11396 Change-Id: I2589a8f81a43f05329b91b6a136bebf723a5dd03 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384298 Reviewed-by: Robert Phillips Commit-Queue: Chris Dalton --- src/gpu/GrSurfaceDrawContext.cpp | 5 +++-- src/gpu/ops/GrFillRRectOp.cpp | 20 +++++++++----------- src/gpu/ops/GrFillRRectOp.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp index 08fa179ef7..97c4146243 100644 --- a/src/gpu/GrSurfaceDrawContext.cpp +++ b/src/gpu/GrSurfaceDrawContext.cpp @@ -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); diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp index 59da7f19cd..ac5598793e 100644 --- a/src/gpu/ops/GrFillRRectOp.cpp +++ b/src/gpu/ops/GrFillRRectOp.cpp @@ -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 diff --git a/src/gpu/ops/GrFillRRectOp.h b/src/gpu/ops/GrFillRRectOp.h index c544c80fc8..63211354d9 100644 --- a/src/gpu/ops/GrFillRRectOp.h +++ b/src/gpu/ops/GrFillRRectOp.h @@ -23,7 +23,7 @@ namespace GrFillRRectOp { GrPaint&&, const SkMatrix& viewMatrix, const SkRRect&, - GrAAType); + GrAA); } // namespace GrFillRRectOp #endif