Revert "Revert "Revert "Use GrOvalOpFactory ops to draw non-AA rrects, ovals, and arcs."""
This reverts commit b4e965c103c3140f0072949343befb34bceadc96.
Reason for revert: Thin stroke problems, chrome pixel test, g3 clang-tidy
Original change's description:
> Revert "Revert "Use GrOvalOpFactory ops to draw non-AA rrects, ovals, and arcs.""
>
> This reverts commit befff6580e9dc6b15bc6db3cc3f5fff22185cba8.
>
> Bug: skia:
> Change-Id: Ia108408cd986c03783af5058845790f6b17201f4
> Reviewed-on: https://skia-review.googlesource.com/98703
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com
Change-Id: I785af7efdfc39680052f5721a55ecffbeaf1f0ad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/98785
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 6866ed5..d86bf80 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -99,7 +99,6 @@
//////////////////////////////////////////////////////////////////////////////
GrAAType GrChooseAAType(GrAA aa, GrFSAAType fsaaType, GrAllowMixedSamples allowMixedSamples,
- GrAllowNonAABinaryCoverage allowNonAABinaryCoverage, const GrPaint* paint,
const GrCaps& caps) {
if (GrAA::kNo == aa) {
// On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect
@@ -107,34 +106,6 @@
if (fsaaType == GrFSAAType::kUnifiedMSAA && !caps.multisampleDisableSupport()) {
return GrAAType::kMSAA;
}
- if (GrAllowNonAABinaryCoverage::kYes == allowNonAABinaryCoverage) {
- SkASSERT(paint);
- // If we already have a coverage FP then we won't make anything worse.
- if (paint->numCoverageFragmentProcessors()) {
- return GrAAType::kCoverage;
- }
- // Shader based blending isn't so expensive with these extensions.
- if (caps.shaderCaps()->fbFetchSupport() || caps.textureBarrierSupport()) {
- return GrAAType::kCoverage;
- }
- SkBlendMode mode;
- if (GrXPFactory::AsBlendMode(paint->getXPFactory(), &mode)) {
- // If we have dual source blending then all Porter-Duff modes can use HW blending
- // with coverage.
- if (mode <= SkBlendMode::kLastCoeffMode &&
- caps.shaderCaps()->dualSourceBlendingSupport()) {
- return GrAAType::kCoverage;
- }
- if (SkBlendMode_SupportsCoverageAsAlpha(mode)) {
- return GrAAType::kCoverage;
- }
- // If the mode is "advanced" then either we will already be doing dst copies or we
- // have advanced blending support and it is ok to conflate coverage with alpha.
- if (mode > SkBlendMode::kLastCoeffMode) {
- return GrAAType::kCoverage;
- }
- }
- }
return GrAAType::kNone;
}
switch (fsaaType) {
@@ -944,16 +915,14 @@
AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec stroke = style.strokeRec();
- GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo,
- GrAllowNonAABinaryCoverage::kYes, &paint);
+ GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeCoverageRRectOp(std::move(paint),
- aa,
- viewMatrix,
- rrect,
- stroke,
- shaderCaps);
+ std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeRRectOp(std::move(paint),
+ viewMatrix,
+ rrect,
+ stroke,
+ shaderCaps);
if (op) {
this->addDrawOp(*clip, std::move(op));
return;
@@ -1194,9 +1163,8 @@
auto circleBounds = SkRect::MakeLTRB(cx - avgR, cy - avgR, cx + avgR, cy + avgR);
SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
stroke.setStrokeStyle(outerR - innerR);
- auto op = GrOvalOpFactory::MakeCoverageOvalOp(std::move(paint), aa, viewMatrix,
- circleBounds, stroke,
- this->caps()->shaderCaps());
+ auto op = GrOvalOpFactory::MakeOvalOp(std::move(paint), viewMatrix, circleBounds,
+ stroke, this->caps()->shaderCaps());
if (op) {
this->addDrawOp(clip, std::move(op));
return true;
@@ -1337,12 +1305,11 @@
AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec& stroke = style.strokeRec();
- GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo,
- GrAllowNonAABinaryCoverage::kYes, &paint);
+ GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeCoverageOvalOp(
- std::move(paint), aa, viewMatrix, oval, stroke, shaderCaps);
+ std::unique_ptr<GrDrawOp> op =
+ GrOvalOpFactory::MakeOvalOp(std::move(paint), viewMatrix, oval, stroke, shaderCaps);
if (op) {
this->addDrawOp(clip, std::move(op));
return;
@@ -1369,19 +1336,17 @@
AutoCheckFlush acf(this->drawingManager());
- GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo,
- GrAllowNonAABinaryCoverage::kYes, &paint);
+ GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeCoverageArcOp(std::move(paint),
- aa,
- viewMatrix,
- oval,
- startAngle,
- sweepAngle,
- useCenter,
- style,
- shaderCaps);
+ std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeArcOp(std::move(paint),
+ viewMatrix,
+ oval,
+ startAngle,
+ sweepAngle,
+ useCenter,
+ style,
+ shaderCaps);
if (op) {
this->addDrawOp(clip, std::move(op));
return;