Fix IsFunctionallyExact

Bug: 849034
Change-Id: Icfef534433495e5ad5ab1f3abad05957a0e70a31
Reviewed-on: https://skia-review.googlesource.com/134333
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2018-06-12 15:18:00 -04:00 committed by Skia Commit-Bot
parent fdcfb8b7c2
commit db3b979ba1
2 changed files with 10 additions and 1 deletions

View File

@ -461,6 +461,7 @@ public:
0 == subset->fLeft && 0 == subset->fTop && 0 == subset->fLeft && 0 == subset->fTop &&
fTextureProxy->width() == subset->width() && fTextureProxy->width() == subset->width() &&
fTextureProxy->height() == subset->height()) { fTextureProxy->height() == subset->height()) {
fTextureProxy->priv().exactify();
// The existing GrTexture is already tight so reuse it in the SkImage // The existing GrTexture is already tight so reuse it in the SkImage
return wrap_proxy_in_image(fContext, fTextureProxy, fAlphaType, fColorSpace); return wrap_proxy_in_image(fContext, fTextureProxy, fAlphaType, fColorSpace);
} }

View File

@ -625,7 +625,15 @@ sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallb
} }
bool GrProxyProvider::IsFunctionallyExact(GrSurfaceProxy* proxy) { bool GrProxyProvider::IsFunctionallyExact(GrSurfaceProxy* proxy) {
return proxy->priv().isExact() || (SkIsPow2(proxy->width()) && SkIsPow2(proxy->height())); const bool isInstantiated = proxy->priv().isInstantiated();
// A proxy is functionally exact if:
// it is exact (obvs)
// when it is instantiated it will be exact (i.e., power of two dimensions)
// it is already instantiated and the proxy covers the entire backing surface
return proxy->priv().isExact() ||
(!isInstantiated && SkIsPow2(proxy->width()) && SkIsPow2(proxy->height())) ||
(isInstantiated && proxy->worstCaseWidth() == proxy->width() &&
proxy->worstCaseHeight() == proxy->height());
} }
void GrProxyProvider::processInvalidProxyUniqueKey(const GrUniqueKey& key) { void GrProxyProvider::processInvalidProxyUniqueKey(const GrUniqueKey& key) {