Make stencilRect() in GrRTCPriv more flexible.
All GrFillRectOps in core code go through a GrRTC call.
Also adds a utility constructor for non-AA rects since this simplifies clears
and tests/GMs that called GrFillRectOp directly. This helps preserve
readability without forcing them to go through the full rect drawing pipeline.
Change-Id: I6694c1aded3b89d773a897c483f7f2a51b06e6e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215089
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
index b7f78c5..36995b8 100644
--- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
@@ -16,7 +16,6 @@
#include "src/gpu/GrStencilClip.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/ops/GrDrawPathOp.h"
-#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/ops/GrStencilAndCoverPathRenderer.h"
#include "src/gpu/ops/GrStencilPathOp.h"
@@ -157,18 +156,13 @@
// We have to suppress enabling MSAA for mixed samples or we will get seams due to
// coverage modulation along the edge where two triangles making up the rect meet.
- GrAAType coverAAType = GrAAType::kNone;
+ GrAA doStencilMSAA = GrAA::kNo;
if (AATypeFlags::kMSAA & args.fAATypeFlags) {
SkASSERT(!(AATypeFlags::kMixedSampledStencilThenCover & args.fAATypeFlags));
- coverAAType = GrAAType::kMSAA;
+ doStencilMSAA = GrAA::kYes;
}
- // This is a non-coverage aa rect operation
- SkASSERT(coverAAType == GrAAType::kNone || coverAAType == GrAAType::kMSAA);
- std::unique_ptr<GrDrawOp> op = GrFillRectOp::MakeWithLocalMatrix(
- args.fContext, std::move(args.fPaint), coverAAType, coverMatrix, localMatrix,
- coverBounds, &kInvertedCoverPass);
-
- args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
+ args.fRenderTargetContext->priv().stencilRect(*args.fClip, &kInvertedCoverPass,
+ std::move(args.fPaint), doStencilMSAA, coverMatrix, coverBounds, &localMatrix);
}
} else {
std::unique_ptr<GrDrawOp> op = GrDrawPathOp::Make(