diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index 1d1a557383..0ec5459127 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -256,6 +256,10 @@ public: sk_sp tex(sk_ref_sp(GrRefCachedBitmapTexture( context, fBitmap, GrSamplerParams::ClampNoFilter(), nullptr))); sk_sp sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex)); + if (!sProxy) { + return nullptr; + } + return sk_ref_sp(sProxy->asTextureProxy()); } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index aeab9d10c3..b5586b4de8 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -591,6 +591,9 @@ sk_sp GrContextPriv::makeWrappedRenderTargetContext( ASSERT_SINGLE_OWNER_PRIV sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(rt))); + if (!proxy) { + return nullptr; + } return this->drawingManager()->makeRenderTargetContext(std::move(proxy), std::move(colorSpace), @@ -614,6 +617,9 @@ sk_sp GrContextPriv::makeWrappedSurfaceContext(sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(surface))); + if (!proxy) { + return nullptr; + } return this->makeWrappedSurfaceContext(std::move(proxy), nullptr); } @@ -624,6 +630,9 @@ sk_sp GrContextPriv::makeDeferredSurfaceContext(const GrSurfac sk_sp proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc, fit, isDstBudgeted); + if (!proxy) { + return nullptr; + } return this->makeWrappedSurfaceContext(std::move(proxy), nullptr); } @@ -639,6 +648,9 @@ sk_sp GrContextPriv::makeBackendSurfaceContext(const GrBackend } sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(surface))); + if (!proxy) { + return nullptr; + } return this->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace)); } @@ -657,6 +669,9 @@ sk_sp GrContextPriv::makeBackendTextureRenderTargetContex } sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(surface))); + if (!proxy) { + return nullptr; + } return this->drawingManager()->makeRenderTargetContext(std::move(proxy), std::move(colorSpace), props); @@ -674,6 +689,9 @@ sk_sp GrContextPriv::makeBackendRenderTargetRenderTargetC } sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(rt))); + if (!proxy) { + return nullptr; + } return this->drawingManager()->makeRenderTargetContext(std::move(proxy), std::move(colorSpace), @@ -693,6 +711,9 @@ sk_sp GrContextPriv::makeBackendTextureAsRenderTargetRend } sk_sp proxy(GrSurfaceProxy::MakeWrapped(std::move(surface))); + if (!proxy) { + return nullptr; + } return this->drawingManager()->makeRenderTargetContext(std::move(proxy), std::move(colorSpace), diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index 58e78c1d3a..95cadd86df 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -119,6 +119,9 @@ void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) { * @param filename Full path to desired file */ static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* filename) { + if (!sProxy) { + return false; + } SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType);