diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 304a4cd6d0..fe4c2b95cf 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -1041,7 +1041,10 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx, } } GrTexture* texture = image->getTexture(); - SkASSERT(texture); + if (!texture) { + // In context-loss cases, we may not have a texture. + return false; + } // If the image's context doesn't match the provided context, fail. if (texture->getContext() != ctx) { @@ -1063,7 +1066,9 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx, } texture = image->getTexture(); - SkASSERT(texture); + if (!texture) { + return false; + } // Flush to ensure that the copy is completed before we return the texture. ctx->contextPriv().prepareSurfaceForExternalIO(as_IB(image)->peekProxy()); |