Chromium Code Reviews| Index: Source/core/html/HTMLCanvasElement.cpp |
| diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
| index 05e2a22819dca4e956262e159244bbb40eaf5844..e6cafc4689bd5d60fc14aca75efc3a4c280667e9 100644 |
| --- a/Source/core/html/HTMLCanvasElement.cpp |
| +++ b/Source/core/html/HTMLCanvasElement.cpp |
| @@ -706,9 +706,14 @@ 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); |
| + // The concept of BackBuffer is valid on only WebGL. |
| + if (m_context->is2d()) |
|
aandrey
2014/12/08 20:36:46
Seems like this code has no effect (unless a conte
dshwang
2014/12/08 20:46:25
That's right. It has no effect, because CanvasRend
|
| + sourceBuffer = FrontBuffer; |
| + |
| + bool needToUpdate = !m_copiedImage; |
| + if (m_context->is3d()) |
| + needToUpdate |= m_context->paintRenderingResultsToCanvas(sourceBuffer); |
|
dshwang
2014/12/08 20:17:08
That's good question! After re-thinking, vector is
|
| + if (needToUpdate && buffer()) { |
| m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); |
| updateExternallyAllocatedMemory(); |
| } |