From 071457b7fcea3ef34e463c6122ec0376a582e529 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Mon, 16 May 2016 09:50:03 -0700 Subject: Add isUnifiedMultisampled entry point to GrDrawContext GrRenderTargetProxy supports the isUnifiedMultisampled call so GrDrawContext will be able to support it even when GrRenderTargetProxy-backed. This is split out of: https://codereview.chromium.org/1930013002/ ((Mostly) Retract GrRenderTarget from SkGpuDevice) GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1982583002 Review-Url: https://codereview.chromium.org/1982583002 --- include/gpu/GrDrawContext.h | 1 + src/gpu/SkGpuDevice.cpp | 8 ++++---- src/gpu/SkGpuDevice_drawTexture.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 7409da334b..dd03cf5211 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -261,6 +261,7 @@ public: const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } int width() const { return fRenderTarget->width(); } int height() const { return fRenderTarget->height(); } + bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisampled(); } int numColorSamples() const { return fRenderTarget->numColorSamples(); } bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 5206c63ae0..68a8518a52 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -888,7 +888,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw, // The tile code path doesn't currently support AA, so if the paint asked for aa and we could // draw untiled, then we bypass checking for tiling purely for optimization reasons. - bool drawAA = !fRenderTarget->isUnifiedMultisampled() && + bool drawAA = !fDrawContext->isUnifiedMultisampled() && paint.isAntiAlias() && bitmap.width() <= maxTileSize && bitmap.height() <= maxTileSize; @@ -988,7 +988,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, const SkPaint* paint = &origPaint; SkPaint tempPaint; - if (origPaint.isAntiAlias() && !fRenderTarget->isUnifiedMultisampled()) { + if (origPaint.isAntiAlias() && !fDrawContext->isUnifiedMultisampled()) { // Drop antialiasing to avoid seams at tile boundaries. tempPaint = origPaint; tempPaint.setAntiAlias(false); @@ -1264,7 +1264,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, // The tile code path doesn't currently support AA, so if the paint asked for aa and we could // draw untiled, then we bypass checking for tiling purely for optimization reasons. - bool drawAA = !fRenderTarget->isUnifiedMultisampled() && + bool drawAA = !fDrawContext->isUnifiedMultisampled() && paint.isAntiAlias() && bitmap.width() <= maxTileSize && bitmap.height() <= maxTileSize; @@ -1426,7 +1426,7 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc CHECK_SHOULD_DRAW(draw); bool useFallback = paint.getMaskFilter() || paint.isAntiAlias() || - fRenderTarget->isUnifiedMultisampled(); + fDrawContext->isUnifiedMultisampled(); bool doBicubic; GrTextureParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I(), diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp index 156bb7e6bf..5eecf43e83 100644 --- a/src/gpu/SkGpuDevice_drawTexture.cpp +++ b/src/gpu/SkGpuDevice_drawTexture.cpp @@ -186,7 +186,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer, SkMatrix combinedMatrix; combinedMatrix.setConcat(viewMatrix, srcToDstMatrix); if (can_ignore_bilerp_constraint(*producer, clippedSrcRect, combinedMatrix, - fRenderTarget->isUnifiedMultisampled())) { + fDrawContext->isUnifiedMultisampled())) { constraintMode = GrTextureAdjuster::kNo_FilterConstraint; } } -- cgit v1.2.3