aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-26 10:20:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-26 14:48:12 +0000
commitc1b6066263b1a1dd19f5dedd38e20cf0b142f271 (patch)
tree6f9f903abc1ae9acde5a14c3fda3a97834385e13
parentd4b2adeaa929edd1664754ac6621ec524992ef03 (diff)
Fix instantiation of partially lazy proxies
Change-Id: I941333711966da109583a3a72ab3464363285b84 Reviewed-on: https://skia-review.googlesource.com/137580 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--src/gpu/GrProxyProvider.cpp3
-rw-r--r--src/gpu/GrSurfaceProxy.cpp10
-rw-r--r--src/gpu/GrYUVProvider.cpp3
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<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> 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<GrTextureProxy> 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