Index: Source/core/html/HTMLCanvasElement.cpp |
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
index c973b76cc16dc14a910240b61cf98b8e403e03e8..8a2362ddd68498a68a043214f86143564d8cb626 100644 |
--- a/Source/core/html/HTMLCanvasElement.cpp |
+++ b/Source/core/html/HTMLCanvasElement.cpp |
@@ -737,9 +737,11 @@ PassRefPtr<Image> HTMLCanvasElement::copiedImage(SourceDrawingBuffer sourceBuffe |
if (!m_context) |
return createTransparentImage(size()); |
- if (!m_copiedImage && buffer()) { |
- if (m_context && m_context->is3d()) |
- m_context->paintRenderingResultsToCanvas(sourceBuffer); |
+ bool needToUpdate = !m_copiedImage; |
+ // The concept of SourceDrawingBuffer is valid on only WebGL. |
+ if (m_context->is3d()) |
+ needToUpdate |= m_context->paintRenderingResultsToCanvas(sourceBuffer); |
+ if (needToUpdate && buffer()) { |
m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); |
updateExternallyAllocatedMemory(); |
} |