From c1b6066263b1a1dd19f5dedd38e20cf0b142f271 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Tue, 26 Jun 2018 10:20:08 -0400 Subject: Fix instantiation of partially lazy proxies Change-Id: I941333711966da109583a3a72ab3464363285b84 Reviewed-on: https://skia-review.googlesource.com/137580 Reviewed-by: Greg Daniel Commit-Queue: Robert Phillips --- src/gpu/GrProxyProvider.cpp | 3 +++ src/gpu/GrSurfaceProxy.cpp | 10 ++++++++-- src/gpu/GrYUVProvider.cpp | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 5814c7627a..e259e34e28 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -267,6 +267,9 @@ sk_sp GrProxyProvider::createTextureProxy(sk_sp srcImag return nullptr; } } + + SkASSERT(proxy->width() == desc.fWidth); + SkASSERT(proxy->height() == desc.fHeight); return proxy; } diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index fe8641a04f..81ad5840ed 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -400,8 +400,14 @@ bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide return false; } - fProxy->fWidth = surface->width(); - fProxy->fHeight = surface->height(); + if (fProxy->fWidth <= 0 || fProxy->fHeight <= 0) { + // This was a fully lazy proxy. We need to fill in the width & height. For partially + // lazy proxies we must preserve the original width & height since that indicates + // the content area. + SkASSERT(fProxy->fWidth <= 0 && fProxy->fHeight <= 0); + fProxy->fWidth = surface->width(); + fProxy->fHeight = surface->height(); + } bool needsStencil = fProxy->asRenderTargetProxy() ? fProxy->asRenderTargetProxy()->needsStencil() diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index f235684f88..82e031c450 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -106,6 +106,9 @@ sk_sp GrYUVProvider::refAsTextureProxy(GrContext* ctx, const GrS auto proxyProvider = ctx->contextPriv().proxyProvider(); yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, fit); + + SkASSERT(yuvTextureProxies[i]->width() == yuvInfo.fSizeInfo.fSizes[i].fWidth); + SkASSERT(yuvTextureProxies[i]->height() == yuvInfo.fSizeInfo.fSizes[i].fHeight); } // TODO: investigate preallocating mip maps here -- cgit v1.2.3