From bfd7e70d96a769e5d62fb5c9148b5c810a8bef65 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 23 May 2012 16:01:50 -0700 Subject: Use Surface areas to compute tile usage Previously we used the surface's first layer's area, which is often incorrect in the case of significant layer merging. bug:6545187 Change-Id: Ied3e5e3cd894b145ed905f8ba83649b3c4f3b1dd --- .../graphics/android/rendering/SurfaceBacking.cpp | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp') diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp index fcd9655..6d26aa8 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp @@ -161,36 +161,37 @@ bool SurfaceBacking::swapTiles() return swap; } -void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer) +void SurfaceBacking::computeTexturesAmount(TexturesResult* result, + const IntRect& visibleContentArea, + const IntRect& fullContentArea, + LayerAndroid* layer) { - // TODO: shouldn't use layer, as this SB may paint multiple layers - if (!layer) - return; - - IntRect fullContentArea = layer->fullContentArea(); - IntRect clippedVisibleArea = layer->visibleContentArea(); // get two numbers here: // - textures needed for a clipped area // - textures needed for an un-clipped area TileGrid* tileGrid = m_zooming ? m_backTileGrid : m_frontTileGrid; int nbTexturesUnclipped = tileGrid->nbTextures(fullContentArea, m_scale); - int nbTexturesClipped = tileGrid->nbTextures(clippedVisibleArea, m_scale); + int nbTexturesClipped = tileGrid->nbTextures(visibleContentArea, m_scale); + + if (layer) { + // TODO: should handle multi-layer case better - // Set kFixedLayers level - if (layer->isPositionFixed()) - result->fixed += nbTexturesClipped; + // Set kFixedLayers level + if (layer->isPositionFixed()) + result->fixed += nbTexturesClipped; - // Set kScrollableAndFixedLayers level - if (layer->contentIsScrollable() - || layer->isPositionFixed()) - result->scrollable += nbTexturesClipped; + // Set kScrollableAndFixedLayers level + if (layer->contentIsScrollable() + || layer->isPositionFixed()) + result->scrollable += nbTexturesClipped; + } // Set kClippedTextures level result->clipped += nbTexturesClipped; // Set kAllTextures level - if (layer->contentIsScrollable()) + if (layer && layer->contentIsScrollable()) result->full += nbTexturesClipped; else result->full += nbTexturesUnclipped; -- cgit v1.1