diff options
Diffstat (limited to 'src/gpu/GrTextureProducer.cpp')
-rw-r--r-- | src/gpu/GrTextureProducer.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp index 59962c55b1..8499b8abe5 100644 --- a/src/gpu/GrTextureProducer.cpp +++ b/src/gpu/GrTextureProducer.cpp @@ -11,6 +11,7 @@ #include "GrRenderTargetContext.h" #include "GrTextureProxy.h" #include "SkGr.h" +#include "SkMipMap.h" #include "SkRectPriv.h" #include "effects/GrBicubicEffect.h" #include "effects/GrSimpleTextureEffect.h" @@ -226,8 +227,14 @@ sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxyForParams( SkDEBUGCODE(bool expectNoScale = (sampler.filter() != GrSamplerState::Filter::kMipMap && !sampler.isRepeated())); SkASSERT(scaleAdjust || expectNoScale); + + int mipCount = SkMipMap::ComputeLevelCount(this->width(), this->height()); + bool willBeMipped = GrSamplerState::Filter::kMipMap == sampler.filter() && mipCount && + fContext->contextPriv().caps()->mipMapSupport(); + auto result = - this->onRefTextureProxyForParams(sampler, dstColorSpace, proxyColorSpace, scaleAdjust); + this->onRefTextureProxyForParams(sampler, dstColorSpace, proxyColorSpace, willBeMipped, + scaleAdjust); // Check that the "no scaling expected" case always returns a proxy of the same size as the // producer. @@ -243,8 +250,14 @@ sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxy(GrMipMapped willNeedMip GrMipMapped::kNo == willNeedMips ? GrSamplerState::Filter::kNearest : GrSamplerState::Filter::kMipMap; GrSamplerState sampler(GrSamplerState::WrapMode::kClamp, filter); + + int mipCount = SkMipMap::ComputeLevelCount(this->width(), this->height()); + bool willBeMipped = GrSamplerState::Filter::kMipMap == sampler.filter() && mipCount && + fContext->contextPriv().caps()->mipMapSupport(); + auto result = - this->onRefTextureProxyForParams(sampler, dstColorSpace, proxyColorSpace, nullptr); + this->onRefTextureProxyForParams(sampler, dstColorSpace, proxyColorSpace, + willBeMipped, nullptr); // Check that no scaling occured and we returned a proxy of the same size as the producer. SkASSERT(!result || (result->width() == this->width() && result->height() == this->height())); |