Reland "Turn off domain in GrTextureOp when src rect contains entire proxy"
This is a reland of 869433fa113d1573d5d91fcafdca413b247ce1b0
Original change's description:
> Turn off domain in GrTextureOp when src rect contains entire proxy
>
> Move check for turning off domain when nearest/no-aa to GrRenderTargetContext.
>
> Change-Id: I3c071b5f73fb3134218453204f30c3020c9dad9a
> Reviewed-on: https://skia-review.googlesource.com/130143
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I29a21e26de8a246a74bd40fd0cda044f8f18327e
Reviewed-on: https://skia-review.googlesource.com/130307
Reviewed-by: Stephen White <senorblanco@chromium.org>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f4db697..456d8e4 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -776,13 +776,22 @@
if (filter != GrSamplerState::Filter::kNearest && !must_filter(srcRect, dstRect, viewMatrix)) {
filter = GrSamplerState::Filter::kNearest;
}
+ GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
+ if (constraint == SkCanvas::kStrict_SrcRectConstraint) {
+ // No need to use a texture domain with nearest filtering unless there is AA bloating.
+ // Also, no need if the srcRect contains the entire texture.
+ if (filter == GrSamplerState::Filter::kNearest && aaType != GrAAType::kCoverage) {
+ constraint = SkCanvas::kFast_SrcRectConstraint;
+ } else if (srcRect.contains(proxy->getWorstCaseBoundsRect())) {
+ constraint = SkCanvas::kFast_SrcRectConstraint;
+ }
+ }
SkRect clippedDstRect = dstRect;
SkRect clippedSrcRect = srcRect;
if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &clippedDstRect,
&clippedSrcRect)) {
return;
}
- GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
bool allowSRGB = SkToBool(this->colorSpaceInfo().colorSpace());
this->addDrawOp(clip, GrTextureOp::Make(std::move(proxy), filter, color, clippedSrcRect,
clippedDstRect, aaType, constraint, viewMatrix,