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

Unified Diff: Source/core/page/ImageBitmap.cpp

Issue 22408008: Allow creation of ImageBitmaps from WebGL canvases. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unnecessary lines in the test. Created 7 years, 4 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 | « LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/ImageBitmap.cpp
diff --git a/Source/core/page/ImageBitmap.cpp b/Source/core/page/ImageBitmap.cpp
index 2f83dd31d15ef34c1697d544f39b783227b699fb..f748a3a08008e1a5e6fb23d889dbc74f9ad6438b 100644
--- a/Source/core/page/ImageBitmap.cpp
+++ b/Source/core/page/ImageBitmap.cpp
@@ -9,6 +9,7 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLVideoElement.h"
#include "core/html/ImageData.h"
+#include "core/html/canvas/CanvasRenderingContext.h"
#include "core/platform/graphics/BitmapImage.h"
#include "core/platform/graphics/GraphicsContext.h"
#include "wtf/RefPtr.h"
@@ -71,6 +72,10 @@ ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvasSize));
IntRect dstRect(IntPoint(), srcRect.size());
+ CanvasRenderingContext* sourceContext = canvas->renderingContext();
+ if (!sourceContext || !sourceContext->isAccelerated() || !sourceContext->is2d())
Justin Novosad 2013/08/19 20:20:51 Do we really need to call makeRenderingResultsAvai
+ canvas->makeRenderingResultsAvailable();
+
m_buffer = ImageBuffer::create(canvasSize);
m_buffer->context()->drawImageBuffer(canvas->buffer(), dstRect, srcRect);
m_bitmap = m_buffer->copyImage(DontCopyBackingStore);
« no previous file with comments | « LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698