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

vangelis at chromium.org vangelis at chromium.org
Wed Dec 22 13:37:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bebb2216b90706b31bd2da67b43291db64de0637
Author: vangelis at chromium.org <vangelis at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 21 19:48:49 2010 +0000

    2010-09-21  Vangelis Kokkevis  <vangelis at chromium.org>
    
            Reviewed by James Robinson.
    
            [chromium] Cleaned up LayerRendererChromium::prepareToDrawLayers
            logic to avoid unnecessary copy operations if the existing root layer
            contents aren't useful for scrolling. Also removed call to updateLayersRecursive()
            as the composited layer update is actually happening in the drawLayers() method.
            https://bugs.webkit.org/show_bug.cgi?id=46199
    
    
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::prepareToDrawLayers):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67977 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 53a4533..acdddcb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-21  Vangelis Kokkevis  <vangelis at chromium.org>
+
+        Reviewed by James Robinson.
+
+        [chromium] Cleaned up LayerRendererChromium::prepareToDrawLayers
+        logic to avoid unnecessary copy operations if the existing root layer
+        contents aren't useful for scrolling. Also removed call to updateLayersRecursive()
+        as the composited layer update is actually happening in the drawLayers() method.
+        https://bugs.webkit.org/show_bug.cgi?id=46199
+
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::prepareToDrawLayers):
+
 2010-09-21  Daniel Cheng  <dcheng at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index fdf1e0f..6a20887 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -159,8 +159,10 @@ void LayerRendererChromium::useShader(unsigned programId)
     }
 }
 
-// Updates the contents of the root layer texture that fall inside the updateRect
-// and re-composits all sublayers.
+// This method must be called before any other updates are made to the
+// root layer texture. It resizes the root layer texture and scrolls its
+// contents as needed. It also sets up common GL state used by the rest
+// of the layer drawing code.
 void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, const IntRect& contentRect, 
                                                 const IntPoint& scrollPosition)
 {
@@ -172,6 +174,8 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
     makeContextCurrent();
 
     GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId));
+    
+    bool skipScroll = false;
 
     // If the size of the visible area has changed then allocate a new texture
     // to store the contents of the root layer and adjust the projection matrix
@@ -184,6 +188,10 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
 
         m_projectionMatrix = orthoMatrix(0, visibleRectWidth, visibleRectHeight, 0, -1000, 1000);
         GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0));
+
+        // The root layer texture was just resized so its contents are not
+        // useful for scrolling.
+        skipScroll = true;
     }
 
     // The GL viewport covers the entire visible area, including the scrollbars.
@@ -198,12 +206,20 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
     GLC(m_context, m_context->depthFunc(GraphicsContext3D::LEQUAL));
     GLC(m_context, m_context->clearStencil(0));
 
-    if (m_scrollPosition == IntPoint(-1, -1))
+    if (m_scrollPosition == IntPoint(-1, -1)) {
         m_scrollPosition = scrollPosition;
+        skipScroll = true;
+    }
 
     IntPoint scrollDelta = toPoint(scrollPosition - m_scrollPosition);
+
+    // Scrolling larger than the contentRect size does not preserve any of the pixels, so there is
+    // no need to copy framebuffer pixels back into the texture.
+    if (abs(scrollDelta.y()) > contentRect.height() || abs(scrollDelta.x()) > contentRect.width())
+        skipScroll = true;
+
     // Scroll the backbuffer
-    if (scrollDelta.x() || scrollDelta.y()) {
+    if (!skipScroll && (scrollDelta.x() || scrollDelta.y())) {
         // Scrolling works as follows: We render a quad with the current root layer contents
         // translated by the amount the page has scrolled since the last update and then read the
         // pixels of the content area (visible area excluding the scroll bars) back into the
@@ -221,23 +237,9 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
                                         m_scrollShaderMatrixLocation, -1);
 
         GLC(m_context, m_context->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height()));
-        m_scrollPosition = scrollPosition;
-    } else if (abs(scrollDelta.y()) > contentRect.height() || abs(scrollDelta.x()) > contentRect.width()) {
-        // Scrolling larger than the contentRect size does not preserve any of the pixels, so there is
-        // no need to copy framebuffer pixels back into the texture.
-        m_scrollPosition = scrollPosition;
     }
 
-    // Translate all the composited layers by the scroll position.
-    TransformationMatrix matrix;
-    matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0);
-
-    // Traverse the layer tree and update the layer transforms.
-    float opacity = 1;
-    const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers();
-    size_t i;
-    for (i = 0; i < sublayers.size(); i++)
-        updateLayersRecursive(sublayers[i].get(), matrix, opacity);
+    m_scrollPosition = scrollPosition;
 }
 
 void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list