Index: Source/core/html/HTMLCanvasElement.cpp |
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
index 3f9fd63726d9d5c185275d830d6666f4ceed8038..e49d7dbe402094ed32006e20203bd845d75dcc7c 100644 |
--- a/Source/core/html/HTMLCanvasElement.cpp |
+++ b/Source/core/html/HTMLCanvasElement.cpp |
@@ -738,11 +738,19 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod |
// can't create SkImage from WebGLImageBufferSurface (contains only SkBitmap) |
return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); |
- } else { |
+ } |
+ |
+ RefPtr<SkImage> image = m_imageBuffer->newImageSnapshot(); |
+ if (image) { |
*status = NormalSourceImageStatus; |
+ |
+ return StaticBitmapImage::create(image.release()); |
} |
- return StaticBitmapImage::create(m_imageBuffer->newImageSnapshot()); |
+ |
+ *status = InvalidSourceImageStatus; |
+ |
+ return nullptr; |
} |
bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const |