Broaden checking of GrSurfaceProxy::MakeDeferred's return value
We now expect MakeDeferred to baulk if the ultimate texture/rendertarget will not be instantiable. Added checks for MakeWrapped too since, technically, it too can baulk. BUG=676753 Change-Id: I3e052ebf98303fc46124272082c10f303d89da27 Reviewed-on: https://skia-review.googlesource.com/7830 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
6520a69e64
commit
77b3f32936
@ -256,6 +256,10 @@ public:
|
|||||||
sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture(
|
sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture(
|
||||||
context, fBitmap, GrSamplerParams::ClampNoFilter(), nullptr)));
|
context, fBitmap, GrSamplerParams::ClampNoFilter(), nullptr)));
|
||||||
sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
|
sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
|
if (!sProxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return sk_ref_sp(sProxy->asTextureProxy());
|
return sk_ref_sp(sProxy->asTextureProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,6 +591,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeWrappedRenderTargetContext(
|
|||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
||||||
std::move(colorSpace),
|
std::move(colorSpace),
|
||||||
@ -614,6 +617,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(sk_sp<GrSurface
|
|||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
|
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
|
||||||
}
|
}
|
||||||
@ -624,6 +630,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac
|
|||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc,
|
sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc,
|
||||||
fit, isDstBudgeted);
|
fit, isDstBudgeted);
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
|
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
|
||||||
}
|
}
|
||||||
@ -639,6 +648,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeBackendSurfaceContext(const GrBackend
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace));
|
return this->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace));
|
||||||
}
|
}
|
||||||
@ -657,6 +669,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
||||||
std::move(colorSpace), props);
|
std::move(colorSpace), props);
|
||||||
@ -674,6 +689,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
||||||
std::move(colorSpace),
|
std::move(colorSpace),
|
||||||
@ -693,6 +711,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
|
if (!proxy) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
|
||||||
std::move(colorSpace),
|
std::move(colorSpace),
|
||||||
|
@ -119,6 +119,9 @@ void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
|
|||||||
* @param filename Full path to desired file
|
* @param filename Full path to desired file
|
||||||
*/
|
*/
|
||||||
static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* filename) {
|
static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* filename) {
|
||||||
|
if (!sProxy) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(),
|
SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(),
|
||||||
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
|
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
|
||||||
|
Loading…
Reference in New Issue
Block a user