summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-04-20 11:28:59 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2012-04-24 13:17:58 -0700
commit32ce41e0241790f20e63cafea4d3c1db87423eec (patch)
treea72d776306a0a76d099f3997c35a84a4750fa02f /Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
parent492bcfac9fc25b61f44811050fb0cfe827eb6a08 (diff)
downloadexternal_webkit-32ce41e0241790f20e63cafea4d3c1db87423eec.zip
external_webkit-32ce41e0241790f20e63cafea4d3c1db87423eec.tar.gz
external_webkit-32ce41e0241790f20e63cafea4d3c1db87423eec.tar.bz2
Don't overdraw TileGrids
Given the visible area info, we can just tune the shader and matrix to draw partial tile at the edge of TileGrids. This could save a lot of GPU time. Change-Id: I1a45aa9a3a76ab5894096828bfff83057b1c9272
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
index e3aa2a9..7c6175f 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
@@ -232,9 +232,6 @@ void TileGrid::prepareTile(int x, int y, TilePainter* painter,
tile->setContents(x, y, m_scale, isExpandPrefetch);
- // TODO: move below (which is largely the same for layers / tiled page) into
- // prepareGL() function
-
if (tile->isDirty() || !tile->frontTexture())
tile->reserveTexture();
@@ -299,6 +296,10 @@ void TileGrid::drawGL(const IntRect& visibleArea, float opacity,
bool usePointSampling =
TilesManager::instance()->shader()->usePointSampling(m_scale, transform);
+
+ float maxTileWidth = visibleArea.maxX() / tileWidth;
+ float maxTileHeight = visibleArea.maxY() / tileWidth;
+
for (unsigned int i = 0; i < m_tiles.size(); i++) {
Tile* tile = m_tiles[i];
@@ -314,8 +315,11 @@ void TileGrid::drawGL(const IntRect& visibleArea, float opacity,
tile->scale(), m_scale, tile->isTileReady(), tile->isDirty());
bool forceBaseBlending = background ? background->hasAlpha() : false;
+
+ FloatPoint fillPortion(std::min(maxTileWidth - tile->x(), 1.0f),
+ std::min(maxTileHeight - tile->y(), 1.0f));
bool success = tile->drawGL(opacity, rect, m_scale, transform,
- forceBaseBlending, usePointSampling);
+ forceBaseBlending, usePointSampling, fillPortion);
if (semiOpaqueBaseSurface && success) {
// Cut the successful drawn tile area from the missing region.
missingRegion.op(SkIRect::MakeXYWH(tile->x(), tile->y(), 1, 1),