Title: [114344] trunk/Source/WebCore
Revision
114344
Author
commit-qu...@webkit.org
Date
2012-04-16 22:36:46 -0700 (Mon, 16 Apr 2012)

Log Message

[chromium] Move paintRenderedResultsToCanvas code into DrawingBuffer
https://bugs.webkit.org/show_bug.cgi?id=84066

Patch by James Robinson <jam...@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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114343 => 114344)


--- trunk/Source/WebCore/ChangeLog	2012-04-17 05:28:33 UTC (rev 114343)
+++ trunk/Source/WebCore/ChangeLog	2012-04-17 05:36:46 UTC (rev 114344)
@@ -1,3 +1,20 @@
+2012-04-16  James Robinson  <jam...@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  <dan...@chromium.org>
 
         [chromium] Expose compositor filters to Aura through WebLayer

Modified: trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp (114343 => 114344)


--- trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp	2012-04-17 05:28:33 UTC (rev 114343)
+++ trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp	2012-04-17 05:36:46 UTC (rev 114344)
@@ -169,8 +169,26 @@
 #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
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (114343 => 114344)


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2012-04-17 05:28:33 UTC (rev 114343)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2012-04-17 05:36:46 UTC (rev 114344)
@@ -98,31 +98,6 @@
     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);

Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h (114343 => 114344)


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2012-04-17 05:28:33 UTC (rev 114343)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2012-04-17 05:36:46 UTC (rev 114344)
@@ -53,7 +53,6 @@
     virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
     virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
     virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
-    bool paintRenderedResultsToCanvas(ImageBuffer*);
 
     GraphicsContext3D* context() const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to