summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp33
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h5
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileGrid.h2
5 files changed, 30 insertions, 20 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
index be1e176..94b7b6e 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
@@ -341,7 +341,13 @@ void Surface::computeTexturesAmount(TexturesResult* result)
if (!m_surfaceBacking || isBase())
return;
- m_surfaceBacking->computeTexturesAmount(result, getFirstLayer());
+
+ LayerAndroid* layer = 0;
+ if (singleLayer())
+ layer = getFirstLayer();
+
+ m_surfaceBacking->computeTexturesAmount(result, visibleContentArea(),
+ fullContentArea(), layer);
}
bool Surface::isBase()
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;
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
index 137a25b..5709f2a 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
@@ -49,7 +49,10 @@ public:
const TransformationMatrix* transform, bool aggressiveRendering,
const Color* background);
void markAsDirty(const SkRegion& dirtyArea);
- void computeTexturesAmount(TexturesResult* result, LayerAndroid* layer);
+ void computeTexturesAmount(TexturesResult* result,
+ const IntRect& visibleContentArea,
+ const IntRect& fullContentArea,
+ LayerAndroid* layer);
void discardTextures()
{
m_frontTileGrid->discardTextures();
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
index 9cd904e..f8510bb 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
@@ -275,7 +275,7 @@ Tile* TileGrid::getTile(int x, int y)
return 0;
}
-int TileGrid::nbTextures(IntRect& area, float scale)
+int TileGrid::nbTextures(const IntRect& area, float scale)
{
IntRect tileBounds = computeTilesArea(area, scale);
int numberTextures = tileBounds.width() * tileBounds.height();
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h
index 665f4ec..2879dd9 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h
@@ -67,7 +67,7 @@ public:
bool isMissingContent();
bool isDirty() { return !m_dirtyRegion.isEmpty(); }
- int nbTextures(IntRect& area, float scale);
+ int nbTextures(const IntRect& area, float scale);
private:
void prepareTile(int x, int y, TilePainter* painter,