Changeset 148651 in webkit


Ignore:
Timestamp:
Apr 17, 2013 5:04:49 PM (11 years ago)
Author:
Simon Fraser
Message:

Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion
https://bugs.webkit.org/show_bug.cgi?id=114775

Reviewed by Tim Horton.

GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() is intended to answer the question
"if your visible rect is changed to X, would any tiles be created or destroyed?".

However, for compositing layer tiled layers, we do some predictive visible rect expansion based on how
the visible rect is changing when we actually commit visible rect changes. recursiveVisibleRectChangeRequiresFlush()
was not doing that, causing it to give confusing answers, so fix it to do so.

Both now call adjustTiledLayerVisibleRect(), and it's cleaner to make this a static function.

A somewhat unrelated change is to take the layer bounds origin into account
in GraphicsLayerCA::computeVisibleRect(). Desktop WebKit never sets this, but it's used
on other platforms for composited scrolling, so needs to be taken into account
when computing visible rects.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
(WebCore::GraphicsLayerCA::computeVisibleRect):
(WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
(WebCore::GraphicsLayerCA::updateVisibleRect):

  • platform/graphics/ca/GraphicsLayerCA.h:

(GraphicsLayerCA):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148648 r148651  
     12013-04-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion
     4        https://bugs.webkit.org/show_bug.cgi?id=114775
     5
     6        Reviewed by Tim Horton.
     7
     8        GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() is intended to answer the question
     9        "if your visible rect is changed to X, would any tiles be created or destroyed?".
     10       
     11        However, for compositing layer tiled layers, we do some predictive visible rect expansion based on how
     12        the visible rect is changing when we actually commit visible rect changes. recursiveVisibleRectChangeRequiresFlush()
     13        was not doing that, causing it to give confusing answers, so fix it to do so.
     14       
     15        Both now call adjustTiledLayerVisibleRect(), and it's cleaner to make this a static function.
     16       
     17        A somewhat unrelated change is to take the layer bounds origin into account
     18        in GraphicsLayerCA::computeVisibleRect(). Desktop WebKit never sets this, but it's used
     19        on other platforms for composited scrolling, so needs to be taken into account
     20        when computing visible rects.
     21
     22        * platform/graphics/ca/GraphicsLayerCA.cpp:
     23        (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
     24        (WebCore::GraphicsLayerCA::computeVisibleRect):
     25        (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
     26        (WebCore::GraphicsLayerCA::updateVisibleRect):
     27        * platform/graphics/ca/GraphicsLayerCA.h:
     28        (GraphicsLayerCA):
     29
    1302013-04-17  Oliver Hunt  <oliver@apple.com>
    231
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r147797 r148651  
    914914    // This may be called at times when layout has not been updated, so we want to avoid calling out to the client
    915915    // for animating transforms.
    916     FloatRect visibleRect = computeVisibleRect(localState, 0);
    917     if (visibleRect != m_visibleRect) {
     916    FloatRect newVisibleRect = computeVisibleRect(localState, 0);
     917    if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
     918        newVisibleRect = adjustTiledLayerVisibleRect(tiledBacking(), m_visibleRect, newVisibleRect, m_sizeAtLastVisibleRectUpdate, m_size);
     919
     920    if (newVisibleRect != m_visibleRect) {
    918921        if (TiledBacking* tiledBacking = this->tiledBacking()) {
    919             if (tiledBacking->tilesWouldChangeForVisibleRect(visibleRect))
     922            if (tiledBacking->tilesWouldChangeForVisibleRect(newVisibleRect))
    920923                return true;
    921924        }
     
    995998    bool mapWasClamped;
    996999    FloatRect clipRectForChildren = state.mappedQuad(&mapWasClamped).boundingBox();
    997     FloatRect clipRectForSelf(0, 0, m_size.width(), m_size.height());
     1000    FloatPoint boundsOrigin = m_boundsOrigin;
     1001    clipRectForChildren.move(boundsOrigin.x(), boundsOrigin.y());
     1002   
     1003    FloatRect clipRectForSelf(boundsOrigin, m_size);
    9981004    if (!applyWasClamped && !mapWasClamped)
    9991005        clipRectForSelf.intersect(clipRectForChildren);
     
    15931599}
    15941600
    1595 FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatSize& oldSize) const
     1601FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize)
    15961602{
    15971603    // If the old visible rect is empty, we have no information about how the visible area is changing
    15981604    // (maybe the layer was just created), so don't attempt to expand. Also don't attempt to expand
    15991605    // if the size changed.
    1600     if (oldVisibleRect.isEmpty() || m_size != oldSize)
    1601         return m_visibleRect;
     1606    if (oldVisibleRect.isEmpty() || newSize != oldSize)
     1607        return newVisibleRect;
    16021608
    16031609    const float paddingMultiplier = 2;
    16041610
    1605     float leftEdgeDelta = paddingMultiplier * (m_visibleRect.x() - oldVisibleRect.x());
    1606     float rightEdgeDelta = paddingMultiplier * (m_visibleRect.maxX() - oldVisibleRect.maxX());
    1607 
    1608     float topEdgeDelta = paddingMultiplier * (m_visibleRect.y() - oldVisibleRect.y());
    1609     float bottomEdgeDelta = paddingMultiplier * (m_visibleRect.maxY() - oldVisibleRect.maxY());
     1611    float leftEdgeDelta = paddingMultiplier * (newVisibleRect.x() - oldVisibleRect.x());
     1612    float rightEdgeDelta = paddingMultiplier * (newVisibleRect.maxX() - oldVisibleRect.maxX());
     1613
     1614    float topEdgeDelta = paddingMultiplier * (newVisibleRect.y() - oldVisibleRect.y());
     1615    float bottomEdgeDelta = paddingMultiplier * (newVisibleRect.maxY() - oldVisibleRect.maxY());
    16101616   
    16111617    FloatRect existingTileBackingRect = tiledBacking->visibleRect();
    1612     FloatRect expandedRect = m_visibleRect;
     1618    FloatRect expandedRect = newVisibleRect;
    16131619
    16141620    // More exposed on left side.
     
    16601666    FloatRect tileArea = m_visibleRect;
    16611667    if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
    1662         tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
     1668        tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, tileArea, m_sizeAtLastVisibleRectUpdate, m_size);
    16631669
    16641670    tiledBacking()->setVisibleRect(tileArea);
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r147797 r148651  
    251251    const FloatRect& visibleRect() const { return m_visibleRect; }
    252252   
    253     FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatSize& oldSize) const;
     253    static FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize);
    254254
    255255    bool recursiveVisibleRectChangeRequiresFlush(const TransformState&) const;
Note: See TracChangeset for help on using the changeset viewer.