summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-05-23 16:01:50 -0700
committerChris Craik <ccraik@google.com>2012-05-23 16:19:38 -0700
commitbfd7e70d96a769e5d62fb5c9148b5c810a8bef65 (patch)
tree5e5a6bbdbfd1ccf95f702fa2d69b4fb087d59702 /Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
parent55d602593a60888cfc87c244a5e3258f35bae50e (diff)
downloadexternal_webkit-bfd7e70d96a769e5d62fb5c9148b5c810a8bef65.zip
external_webkit-bfd7e70d96a769e5d62fb5c9148b5c810a8bef65.tar.gz
external_webkit-bfd7e70d96a769e5d62fb5c9148b5c810a8bef65.tar.bz2
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
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp33
1 files changed, 17 insertions, 16 deletions
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;