Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 766333003: canvas: fix bugs on HTMLCanvasElement::copiedImage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: drop vector Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698