aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-08-30 10:27:49 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-07 12:55:31 +0000
commitff9d6d3bc288c58cf0ba28a6f53ccd77717ae899 (patch)
treeaaef4f241a5a1a3c6a526061dc0f92fec1ee4cb1
parent643627e2424e217bb0127f3985c7ad6b2d3940f7 (diff)
Add rect clip optimization to GrRenderTargetContext::drawTextureAffine
Bug: skia: Change-Id: Ibca6bdf9dc72a2b1579a5eb4c22d30e32b964f83 Reviewed-on: https://skia-review.googlesource.com/40803 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/gpu/GrRenderTargetContext.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 14fa6fb2ef..9d8f69fbbc 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -791,9 +791,17 @@ void GrRenderTargetContext::drawTextureAffine(const GrClip& clip, sk_sp<GrTextur
if (filter != GrSamplerParams::kNone_FilterMode && !must_filter(srcRect, dstRect, viewMatrix)) {
filter = GrSamplerParams::kNone_FilterMode;
}
+ SkRect clippedDstRect = dstRect;
+ SkRect clippedSrcRect = srcRect;
+ if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &clippedDstRect,
+ &clippedSrcRect)) {
+ return;
+ }
+
bool allowSRGB = SkToBool(this->getColorSpace());
- this->addDrawOp(clip, GrTextureOp::Make(std::move(proxy), filter, color, srcRect, dstRect,
- viewMatrix, std::move(colorSpaceXform), allowSRGB));
+ this->addDrawOp(clip, GrTextureOp::Make(std::move(proxy), filter, color, clippedSrcRect,
+ clippedDstRect, viewMatrix, std::move(colorSpaceXform),
+ allowSRGB));
}
void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,