aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice_drawTexture.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-05-23 16:39:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-24 17:42:38 +0000
commita0047bcff704a9121a6d82a6f97d6124463a2e54 (patch)
treeb8c6b0e17a17ec95b779482609490b82fb4c8a35 /src/gpu/SkGpuDevice_drawTexture.cpp
parent6ddbafcc898d1f487f147c651a3b6519b7210802 (diff)
Add support for SkCanvas::kStrict_SrcRectConstraint to GrTextureOp.
Change-Id: I8faa2838b3110b8080ac48bbe223240e3fb22998 Reviewed-on: https://skia-review.googlesource.com/129762 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/SkGpuDevice_drawTexture.cpp')
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 70c89b5776..96472814c5 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -87,20 +87,19 @@ static bool can_ignore_bilerp_constraint(const GrTextureProducer& producer,
}
/**
- * Checks whether the paint, matrix, and constraint are compatible with using
- * GrRenderTargetContext::drawTexture. It is more efficient than the GrTextureProducer
- * general case.
+ * Checks whether the paint is compatible with using GrRenderTargetContext::drawTexture. It is more
+ * efficient than the GrTextureProducer general case.
*/
-static bool can_use_draw_texture(const SkPaint& paint, GrAA aa, const SkMatrix& ctm,
- SkCanvas::SrcRectConstraint constraint) {
+static bool can_use_draw_texture(const SkPaint& paint) {
return (!paint.getColorFilter() && !paint.getShader() && !paint.getMaskFilter() &&
!paint.getImageFilter() && paint.getFilterQuality() < kMedium_SkFilterQuality &&
- paint.getBlendMode() == SkBlendMode::kSrcOver &&
- SkCanvas::kFast_SrcRectConstraint == constraint);
+ paint.getBlendMode() == SkBlendMode::kSrcOver);
}
static void draw_texture(const SkPaint& paint, const SkMatrix& ctm, const SkRect* src,
- const SkRect* dst, GrAA aa, sk_sp<GrTextureProxy> proxy,
+ const SkRect* dst, GrAA aa, SkCanvas::SrcRectConstraint constraint,
+ sk_sp<GrTextureProxy> proxy,
+
SkColorSpace* colorSpace, const GrClip& clip, GrRenderTargetContext* rtc) {
SkASSERT(!(SkToBool(src) && !SkToBool(dst)));
SkRect srcRect = src ? *src : SkRect::MakeWH(proxy->width(), proxy->height());
@@ -129,7 +128,7 @@ static void draw_texture(const SkPaint& paint, const SkMatrix& ctm, const SkRect
GrColor color = GrPixelConfigIsAlphaOnly(proxy->config())
? SkColorToPremulGrColor(paint.getColor())
: SkColorAlphaToGrColor(paint.getColor());
- rtc->drawTexture(clip, std::move(proxy), filter, color, srcRect, dstRect, aa, ctm,
+ rtc->drawTexture(clip, std::move(proxy), filter, color, srcRect, dstRect, aa, constraint, ctm,
std::move(csxf));
}
@@ -141,9 +140,9 @@ void SkGpuDevice::drawPinnedTextureProxy(sk_sp<GrTextureProxy> proxy, uint32_t p
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix, const SkPaint& paint) {
GrAA aa = GrAA(paint.isAntiAlias());
- if (can_use_draw_texture(paint, aa, this->ctm(), constraint)) {
- draw_texture(paint, viewMatrix, srcRect, dstRect, aa, std::move(proxy), colorSpace,
- this->clip(), fRenderTargetContext.get());
+ if (can_use_draw_texture(paint)) {
+ draw_texture(paint, viewMatrix, srcRect, dstRect, aa, constraint, std::move(proxy),
+ colorSpace, this->clip(), fRenderTargetContext.get());
return;
}
GrTextureAdjuster adjuster(this->context(), std::move(proxy), alphaType, pinnedUniqueID,
@@ -156,7 +155,7 @@ void SkGpuDevice::drawTextureMaker(GrTextureMaker* maker, int imageW, int imageH
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix, const SkPaint& paint) {
GrAA aa = GrAA(paint.isAntiAlias());
- if (can_use_draw_texture(paint, aa, viewMatrix, constraint)) {
+ if (can_use_draw_texture(paint)) {
sk_sp<SkColorSpace> cs;
// We've done enough checks above to allow us to pass ClampNearest() and not check for
// scaling adjustments.
@@ -166,8 +165,8 @@ void SkGpuDevice::drawTextureMaker(GrTextureMaker* maker, int imageW, int imageH
if (!proxy) {
return;
}
- draw_texture(paint, viewMatrix, srcRect, dstRect, aa, std::move(proxy), cs.get(),
- this->clip(), fRenderTargetContext.get());
+ draw_texture(paint, viewMatrix, srcRect, dstRect, aa, constraint, std::move(proxy),
+ cs.get(), this->clip(), fRenderTargetContext.get());
return;
}
this->drawTextureProducer(maker, srcRect, dstRect, constraint, viewMatrix, paint);