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

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

Issue 358893002: Use newImageSnapshot() to get an image from a Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Again in StaticBitmapPattern Created 6 years, 3 months 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
« no previous file with comments | « no previous file | Source/platform/blink_platform.gypi » ('j') | Source/platform/graphics/Image.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index dfb5291b3c1aeef8041635d59fb2a343fc7cf807..3f9fd63726d9d5c185275d830d6666f4ceed8038 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -50,6 +50,7 @@
#include "platform/graphics/GraphicsContextStateSaver.h"
#include "platform/graphics/ImageBuffer.h"
#include "platform/graphics/RecordingImageBufferSurface.h"
+#include "platform/graphics/StaticBitmapImage.h"
#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/graphics/gpu/WebGLImageBufferSurface.h"
#include "platform/transforms/AffineTransform.h"
@@ -731,18 +732,17 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod
return nullptr;
}
- if (mode == CopySourceImageIfVolatile) {
- *status = NormalSourceImageStatus;
- return copiedImage();
- }
-
if (m_context && m_context->is3d()) {
m_context->paintRenderingResultsToCanvas();
*status = ExternalSourceImageStatus;
+
+ // can't create SkImage from WebGLImageBufferSurface (contains only SkBitmap)
+ return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
} else {
*status = NormalSourceImageStatus;
}
- return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
+
+ return StaticBitmapImage::create(m_imageBuffer->newImageSnapshot());
}
bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
« no previous file with comments | « no previous file | Source/platform/blink_platform.gypi » ('j') | Source/platform/graphics/Image.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698