From b5ef1f9b13e36a427dd6350986d41db208b2df1b Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Thu, 11 Jan 2018 11:46:21 -0500 Subject: Make GrTextureOp capable of edge antialiasing. Bug: skia: Change-Id: I0088bdbb6a76811611fa4628656bf9513c5bf04a Reviewed-on: https://skia-review.googlesource.com/91105 Reviewed-by: Brian Osman Commit-Queue: Brian Salomon --- src/gpu/SkGpuDevice_drawTexture.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/gpu/SkGpuDevice_drawTexture.cpp') diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp index bedd292a58..f8e5f74311 100644 --- a/src/gpu/SkGpuDevice_drawTexture.cpp +++ b/src/gpu/SkGpuDevice_drawTexture.cpp @@ -94,14 +94,13 @@ static bool can_ignore_bilerp_constraint(const GrTextureProducer& producer, static bool can_use_draw_texture_affine(const SkPaint& paint, const SkMatrix& ctm, SkCanvas::SrcRectConstraint constraint) { return (!paint.getColorFilter() && !paint.getShader() && !paint.getMaskFilter() && - !paint.getImageFilter() && !paint.isAntiAlias() && - paint.getFilterQuality() < kMedium_SkFilterQuality && + !paint.getImageFilter() && paint.getFilterQuality() < kMedium_SkFilterQuality && paint.getBlendMode() == SkBlendMode::kSrcOver && !ctm.hasPerspective() && SkCanvas::kFast_SrcRectConstraint == constraint); } static void draw_texture_affine(const SkPaint& paint, const SkMatrix& ctm, const SkRect* src, - const SkRect* dst, sk_sp proxy, + const SkRect* dst, GrAA aa, sk_sp proxy, SkColorSpace* colorSpace, const GrClip& clip, GrRenderTargetContext* rtc) { SkASSERT(!(SkToBool(src) && !SkToBool(dst))); @@ -131,7 +130,7 @@ static void draw_texture_affine(const SkPaint& paint, const SkMatrix& ctm, const GrColor color = GrPixelConfigIsAlphaOnly(proxy->config()) ? SkColorToPremulGrColor(paint.getColor()) : SkColorAlphaToGrColor(paint.getColor()); - rtc->drawTextureAffine(clip, std::move(proxy), filter, color, srcRect, dstRect, ctm, + rtc->drawTextureAffine(clip, std::move(proxy), filter, color, srcRect, dstRect, aa, ctm, std::move(csxf)); } @@ -143,8 +142,8 @@ void SkGpuDevice::drawPinnedTextureProxy(sk_sp proxy, uint32_t p SkCanvas::SrcRectConstraint constraint, const SkMatrix& viewMatrix, const SkPaint& paint) { if (can_use_draw_texture_affine(paint, this->ctm(), constraint)) { - draw_texture_affine(paint, viewMatrix, srcRect, dstRect, std::move(proxy), colorSpace, - this->clip(), fRenderTargetContext.get()); + draw_texture_affine(paint, viewMatrix, srcRect, dstRect, GrAA(paint.isAntiAlias()), + std::move(proxy), colorSpace, this->clip(), fRenderTargetContext.get()); return; } GrTextureAdjuster adjuster(this->context(), std::move(proxy), alphaType, pinnedUniqueID, @@ -166,8 +165,8 @@ void SkGpuDevice::drawTextureMaker(GrTextureMaker* maker, int imageW, int imageH if (!proxy) { return; } - draw_texture_affine(paint, viewMatrix, srcRect, dstRect, std::move(proxy), cs.get(), - this->clip(), fRenderTargetContext.get()); + draw_texture_affine(paint, viewMatrix, srcRect, dstRect, GrAA(paint.isAntiAlias()), + std::move(proxy), cs.get(), this->clip(), fRenderTargetContext.get()); return; } this->drawTextureProducer(maker, srcRect, dstRect, constraint, viewMatrix, paint); -- cgit v1.2.3