[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 18:46:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3c25411f02f5277e63986470a6c3af29f9c5bd72
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 17 18:56:27 2010 +0000

    2010-12-17  W. James MacLean  <wjmaclean at chromium.org>
    
            Reviewed by James Robinson.
    
            [chromium] Add support to compositor to composite to offscreen texture.
            https://bugs.webkit.org/show_bug.cgi?id=50833
    
            A patch to extend compositor to be able to composite into an offscreen texture instead
            of just directly to the display buffer. Builds on RenderSurfaceChromium support.
    
            External behaviour not changed, so no tests.
    
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::LayerRendererChromium):
            (WebCore::LayerRendererChromium::prepareToDrawLayers):
            (WebCore::LayerRendererChromium::drawLayers):
            (WebCore::LayerRendererChromium::setCompositeOffscreen):
            (WebCore::LayerRendererChromium::useRenderSurface):
            (WebCore::LayerRendererChromium::setScissorToRect):
            * platform/graphics/chromium/LayerRendererChromium.h:
            (WebCore::LayerRendererChromium::isCompositingOffscreen):
            (WebCore::LayerRendererChromium::getOffscreenLayerTexture):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74278 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a35458b..3bdfe9f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-17  W. James MacLean  <wjmaclean at chromium.org>
+
+        Reviewed by James Robinson.
+
+        [chromium] Add support to compositor to composite to offscreen texture.
+        https://bugs.webkit.org/show_bug.cgi?id=50833
+
+        A patch to extend compositor to be able to composite into an offscreen texture instead
+        of just directly to the display buffer. Builds on RenderSurfaceChromium support.
+
+        External behaviour not changed, so no tests.
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::LayerRendererChromium):
+        (WebCore::LayerRendererChromium::prepareToDrawLayers):
+        (WebCore::LayerRendererChromium::drawLayers):
+        (WebCore::LayerRendererChromium::setCompositeOffscreen):
+        (WebCore::LayerRendererChromium::useRenderSurface):
+        (WebCore::LayerRendererChromium::setScissorToRect):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        (WebCore::LayerRendererChromium::isCompositingOffscreen):
+        (WebCore::LayerRendererChromium::getOffscreenLayerTexture):
+
 2010-12-17  Ariya Hidayat  <ariya at sencha.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 6d5f642..35d6b11 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -108,6 +108,7 @@ LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> conte
     , m_currentShader(0)
     , m_currentRenderSurface(0)
     , m_offscreenFramebufferId(0)
+    , m_compositeOffscreen(false)
     , m_context(context)
     , m_defaultRenderSurface(0)
 {
@@ -202,6 +203,10 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
 
         GLC(m_context.get(), m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0));
 
+        if (!m_rootLayer->m_renderSurface)
+            m_rootLayer->createRenderSurface();
+        m_rootLayer->m_renderSurface->m_contentRect = IntRect(0, 0, m_rootLayerTextureWidth, m_rootLayerTextureHeight);
+
         // Reset the current render surface to force an update of the viewport and
         // projection matrix next time useRenderSurface is called.
         m_currentRenderSurface = 0;
@@ -293,11 +298,9 @@ void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect
 void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect& contentRect)
 {
     ASSERT(m_hardwareCompositing);
+    ASSERT(m_rootLayer->m_renderSurface);
 
     m_defaultRenderSurface = m_rootLayer->m_renderSurface.get();
-    if (!m_defaultRenderSurface)
-        m_defaultRenderSurface = m_rootLayer->createRenderSurface();
-    m_defaultRenderSurface->m_contentRect = IntRect(0, 0, m_rootLayerTextureWidth, m_rootLayerTextureHeight);
 
     useRenderSurface(m_defaultRenderSurface);
 
@@ -662,6 +665,22 @@ void LayerRendererChromium::updateLayersRecursive(LayerChromium* layer, const Tr
         std::stable_sort(&descendants.at(thisLayerIndex), descendants.end(), compareLayerZ);
 }
 
+void LayerRendererChromium::setCompositeOffscreen(bool compositeOffscreen)
+{
+    m_compositeOffscreen = compositeOffscreen;
+
+    if (!m_rootLayer) {
+        m_compositeOffscreen = false;
+        return;
+    }
+
+    if (m_compositeOffscreen) {
+        // Need to explicitly set a LayerRendererChromium for the layer with the offscreen texture,
+        // or else the call to prepareContentsTexture() in useRenderSurface() will fail.
+        m_rootLayer->setLayerRenderer(this);
+    }
+}
+
 bool LayerRendererChromium::useRenderSurface(RenderSurfaceChromium* renderSurface)
 {
     if (m_currentRenderSurface == renderSurface)
@@ -669,7 +688,7 @@ bool LayerRendererChromium::useRenderSurface(RenderSurfaceChromium* renderSurfac
 
     m_currentRenderSurface = renderSurface;
 
-    if (renderSurface == m_defaultRenderSurface) {
+    if (renderSurface == m_defaultRenderSurface && !m_compositeOffscreen) {
         GLC(m_context.get(), m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
         setDrawViewportRect(renderSurface->m_contentRect, true);
         return true;
@@ -737,8 +756,9 @@ void LayerRendererChromium::setScissorToRect(const IntRect& scissorRect)
     int scissorX = scissorRect.x() - m_currentRenderSurface->m_contentRect.x();
     // When rendering to the default render surface we're rendering upside down so the top
     // of the GL scissor is the bottom of our layer.
+    // But, if rendering to offscreen texture, we reverse our sense of 'upside down'.
     int scissorY;
-    if (m_currentRenderSurface == m_defaultRenderSurface)
+    if (m_currentRenderSurface == m_defaultRenderSurface && !m_compositeOffscreen)
         scissorY = m_currentRenderSurface->m_contentRect.height() - (scissorRect.bottom() - m_currentRenderSurface->m_contentRect.y());
     else
         scissorY = scissorRect.y() - m_currentRenderSurface->m_contentRect.y();
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index c0e610a..8af589f 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -88,6 +88,11 @@ public:
 
     bool hardwareCompositing() const { return m_hardwareCompositing; }
 
+    void setCompositeOffscreen(bool);
+    bool isCompositingOffscreen() { return m_compositeOffscreen; }
+    LayerTexture* getOffscreenLayerTexture() { return m_compositeOffscreen ? m_rootLayer->m_renderSurface->m_contentsTexture.get() : 0; }
+    void copyOffscreenTextureToDisplay();
+
     void setRootLayerCanvasSize(const IntSize&);
 
     GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); }
@@ -154,6 +159,7 @@ private:
     RenderSurfaceChromium* m_currentRenderSurface;
 
     unsigned m_offscreenFramebufferId;
+    bool m_compositeOffscreen;
 
 #if PLATFORM(SKIA)
     OwnPtr<skia::PlatformCanvas> m_rootLayerCanvas;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list