https://bugs.webkit.org/show_bug.cgi?id=84066
Patch by James Robinson <jamesr@chromium.org> on 2012-04-16
Reviewed by Adrienne Walker.
WebGLLayerChromium used to be responsible for the readback path for software painting WebGL canvases (for
printing, etc), but this path no longer has any compositor interaction. This moves the code into
DrawingBufferChromium which is responsible for managing the front / back buffers for WebGL.
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
* platform/graphics/chromium/WebGLLayerChromium.cpp:
* platform/graphics/chromium/WebGLLayerChromium.h:
(WebGLLayerChromium):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114344
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-16 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move paintRenderedResultsToCanvas code into DrawingBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=84066
+
+ Reviewed by Adrienne Walker.
+
+ WebGLLayerChromium used to be responsible for the readback path for software painting WebGL canvases (for
+ printing, etc), but this path no longer has any compositor interaction. This moves the code into
+ DrawingBufferChromium which is responsible for managing the front / back buffers for WebGL.
+
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
+ * platform/graphics/chromium/WebGLLayerChromium.cpp:
+ * platform/graphics/chromium/WebGLLayerChromium.h:
+ (WebGLLayerChromium):
+
2012-04-16 Dana Jansens <danakj@chromium.org>
[chromium] Expose compositor filters to Aura through WebLayer
#if USE(ACCELERATED_COMPOSITING)
void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
{
- if (m_platformLayer)
- m_platformLayer->paintRenderedResultsToCanvas(context->canvas()->buffer());
+ if (!m_context->makeContextCurrent() || m_context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR)
+ return;
+
+ IntSize framebufferSize = m_context->getInternalFramebufferSize();
+
+ // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding).
+ // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value
+ // rather than querying it off of the context.
+ GC3Dint previousFramebuffer = 0;
+ m_context->getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &previousFramebuffer);
+
+ Platform3DObject framebuffer = m_context->createFramebuffer();
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, framebuffer);
+ m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, frontColorBuffer(), 0);
+
+ Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
+ extensions->paintFramebufferToCanvas(framebuffer, framebufferSize.width(), framebufferSize.height(), !m_context->getContextAttributes().premultipliedAlpha, context->canvas()->buffer());
+ m_context->deleteFramebuffer(framebuffer);
+
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuffer);
}
#endif
textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
}
-bool WebGLLayerChromium::paintRenderedResultsToCanvas(ImageBuffer* imageBuffer)
-{
- if (!m_drawingBuffer || !drawsContent())
- return false;
-
- IntSize framebufferSize = context()->getInternalFramebufferSize();
-
- // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding).
- // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value
- // rather than querying it off of the context.
- GC3Dint previousFramebuffer = 0;
- context()->getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &previousFramebuffer);
-
- Platform3DObject framebuffer = context()->createFramebuffer();
- context()->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, framebuffer);
- context()->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_textureId, 0);
-
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context()->getExtensions());
- extensions->paintFramebufferToCanvas(framebuffer, framebufferSize.width(), framebufferSize.height(), !context()->getContextAttributes().premultipliedAlpha, imageBuffer);
- context()->deleteFramebuffer(framebuffer);
-
- context()->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuffer);
- return true;
-}
-
void WebGLLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
{
LayerChromium::setNeedsDisplayRect(dirtyRect);
virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
- bool paintRenderedResultsToCanvas(ImageBuffer*);
GraphicsContext3D* context() const;