aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/private/GrSurfaceProxy.h23
-rw-r--r--src/gpu/GrRenderTargetContext.cpp11
-rw-r--r--src/gpu/ops/GrTextureOp.cpp5
3 files changed, 25 insertions, 14 deletions
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 1c18492cbd..9499edfde3 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -239,6 +239,21 @@ public:
}
int worstCaseWidth() const;
int worstCaseHeight() const;
+ /**
+ * Helper that gets the width and height of the surface as a bounding rectangle.
+ */
+ SkRect getBoundsRect() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return SkRect::MakeIWH(this->width(), this->height());
+ }
+ /**
+ * Helper that gets the worst case width and height of the surface as a bounding rectangle.
+ */
+ SkRect getWorstCaseBoundsRect() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return SkRect::MakeIWH(this->worstCaseWidth(), this->worstCaseHeight());
+ }
+
GrSurfaceOrigin origin() const {
SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
return fOrigin;
@@ -303,14 +318,6 @@ public:
void deInstantiate();
/**
- * Helper that gets the width and height of the surface as a bounding rectangle.
- */
- SkRect getBoundsRect() const {
- SkASSERT(LazyState::kFully != this->lazyInstantiationState());
- return SkRect::MakeIWH(this->width(), this->height());
- }
-
- /**
* @return the texture proxy associated with the surface proxy, may be NULL.
*/
virtual GrTextureProxy* asTextureProxy() { return nullptr; }
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f4db697e41..456d8e4a82 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -776,13 +776,22 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_sp<GrTextureProxy
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,
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 4d0c41d127..5724050234 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -709,11 +709,6 @@ __attribute__((no_sanitize("float-cast-overflow")))
, fFinalized(0)
, fAllowSRGBInputs(allowSRGBInputs ? 1 : 0) {
SkASSERT(aaType != GrAAType::kMixedSamples);
- // No need to use a texture domain with nearest filtering unless there is AA bloating.
- if (constraint == SkCanvas::kStrict_SrcRectConstraint &&
- filter == GrSamplerState::Filter::kNearest && GrAAType::kCoverage != aaType) {
- constraint = SkCanvas::kFast_SrcRectConstraint;
- }
const Draw& draw = fDraws.emplace_back(srcRect, 0, GrPerspQuad(dstRect, viewMatrix),
constraint, color);