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

Unified Diff: Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp

Issue 7664004: Merge 92908 - Readback composited webgl results for printing (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 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
Index: Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (revision 93076)
+++ Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (working copy)
@@ -97,6 +97,25 @@
}
}
+bool WebGLLayerChromium::paintRenderedResultsToCanvas(ImageBuffer* imageBuffer)
+{
+ if (m_textureUpdated || !layerRenderer() || !drawsContent())
+ return false;
+
+ IntSize framebufferSize = m_context->getInternalFramebufferSize();
+ ASSERT(layerRendererContext());
+
+ // This would ideally be done in the webgl context, but that isn't possible yet.
+ Platform3DObject framebuffer = layerRendererContext()->createFramebuffer();
+ layerRendererContext()->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, framebuffer);
+ layerRendererContext()->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_textureId, 0);
+
+ Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(layerRendererContext()->getExtensions());
+ extensions->paintFramebufferToCanvas(framebuffer, framebufferSize.width(), framebufferSize.height(), !m_context->getContextAttributes().premultipliedAlpha, imageBuffer);
+ layerRendererContext()->deleteFramebuffer(framebuffer);
+ return true;
+}
+
void WebGLLayerChromium::setTextureUpdated()
{
m_textureUpdated = true;

Powered by Google App Engine
This is Rietveld 408576698