diff options
author | Brian Salomon <bsalomon@google.com> | 2018-05-29 12:47:57 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-30 13:34:38 +0000 |
commit | 594b64c4851c82597b3a2045062efad42039d461 (patch) | |
tree | 6eb5d2afab66a845634431df480141c6cf979c7f /src/gpu/ops/GrTextureOp.cpp | |
parent | 18dbfd05e435bdfbc85d436f0ec29ccbbc450291 (diff) |
Revert "Revert "Make GrTextureOp disable coverage AA when rect falls on integers.""
This reverts commit 36be574e7bd5eb8bb41e2a0a15085e27b340cf4d.
Change-Id: Ifdc06cb617ce5c736f861a715bb6f34791364e57
Reviewed-on: https://skia-review.googlesource.com/130507
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ops/GrTextureOp.cpp')
-rw-r--r-- | src/gpu/ops/GrTextureOp.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index 5724050234..5c0eaf0a80 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -709,15 +709,28 @@ __attribute__((no_sanitize("float-cast-overflow"))) , fFinalized(0) , fAllowSRGBInputs(allowSRGBInputs ? 1 : 0) { SkASSERT(aaType != GrAAType::kMixedSamples); - - const Draw& draw = fDraws.emplace_back(srcRect, 0, GrPerspQuad(dstRect, viewMatrix), - constraint, color); fPerspective = viewMatrix.hasPerspective(); - fDomain = (bool)draw.domain(); - SkRect bounds; - bounds = draw.quad().bounds(); + auto quad = GrPerspQuad(dstRect, viewMatrix); + auto bounds = quad.bounds(); +#ifndef SK_DONT_DROP_UNNECESSARY_AA_IN_TEXTURE_OP + if (GrAAType::kCoverage == this->aaType() && viewMatrix.rectStaysRect()) { + // Disable coverage AA when rect falls on integers in device space. + auto is_int = [](float f) { return f == sk_float_floor(f); }; + if (is_int(bounds.fLeft) && is_int(bounds.fTop) && is_int(bounds.fRight) && + is_int(bounds.fBottom)) { + fAAType = static_cast<unsigned>(GrAAType::kNone); + // We may have had a strict constraint with nearest filter soley due to possible AA + // bloat. In that case it's no longer necessary. + if (constraint == SkCanvas::kStrict_SrcRectConstraint && + filter == GrSamplerState::Filter::kNearest) { + constraint = SkCanvas::kFast_SrcRectConstraint; + } + } + } +#endif + const auto& draw = fDraws.emplace_back(srcRect, 0, quad, constraint, color); this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo); - + fDomain = static_cast<bool>(draw.domain()); fMaxApproxDstPixelArea = RectSizeAsSizeT(bounds); } |