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

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: Rebase. 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 006594a9c0d14006d89babea9ddcc0687fc7b754..13f8debcfba3c0cd8a29e04838a7e5cdc44dc855 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"
@@ -78,6 +79,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->is3d())
+ sourceContext->paintRenderingResultsToCanvas();
+
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