Bug 1169339 - Fix incorrect tile storage order in TiledContentHost. r=jrmuizel

This commit is contained in:
Nicolas Silva 2015-06-02 12:13:14 +02:00
parent 5adb562d62
commit 4d045910c3
2 changed files with 10 additions and 10 deletions

View File

@ -541,7 +541,7 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
#ifdef DEBUG
int currTileX = floor_div(x - newBufferOrigin.x, scaledTileSize.width);
int currTileY = floor_div(y - newBufferOrigin.y, scaledTileSize.height);
int index = currTileX * mRetainedHeight + currTileY;
int index = TileIndex(currTileX, currTileY);
// If allocating a tile failed we can run into this assertion.
// Rendering is going to be glitchy but we don't want to crash.
NS_ASSERTION(!newValidRegion.Intersects(tileRect) ||
@ -556,7 +556,7 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
int tileX = floor_div(x - newBufferOrigin.x, scaledTileSize.width);
int tileY = floor_div(y - newBufferOrigin.y, scaledTileSize.height);
int index = tileX * mRetainedHeight + tileY;
int index = TileIndex(tileX, tileY);
MOZ_ASSERT(index >= 0 &&
static_cast<unsigned>(index) < newRetainedTiles.Length(),
"index out of range");

View File

@ -213,8 +213,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
if (tile.mTextureHost && !tile.mTextureHost->HasInternalBuffer()) {
MOZ_ASSERT(tile.mSharedLock);
int tileX = i % oldRetainedWidth + oldFirstTileX;
int tileY = i / oldRetainedWidth + oldFirstTileY;
int tileX = i / oldRetainedHeight + oldFirstTileX;
int tileY = i % oldRetainedHeight + oldFirstTileY;
if (tileX >= newFirstTileX && tileY >= newFirstTileY &&
tileX < (newFirstTileX + newRetainedWidth) &&
@ -237,8 +237,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
// they should be with the new retained with and height rather than the
// old one.
for (size_t i = 0; i < tileDescriptors.Length(); i++) {
int tileX = i % newRetainedWidth + newFirstTileX;
int tileY = i / newRetainedWidth + newFirstTileY;
int tileX = i / newRetainedHeight + newFirstTileX;
int tileY = i % newRetainedHeight + newFirstTileY;
// First, get the already existing tiles to the right place in the array,
// and use placeholders where there was no tiles.
@ -247,8 +247,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
tileY >= (oldFirstTileY + oldRetainedHeight)) {
mRetainedTiles[i] = GetPlaceholderTile();
} else {
mRetainedTiles[i] = oldTiles[(tileY - oldFirstTileY) * oldRetainedWidth +
(tileX - oldFirstTileX)];
mRetainedTiles[i] = oldTiles[(tileX - oldFirstTileX) * oldRetainedHeight +
(tileY - oldFirstTileY)];
// If we hit this assertion it means we probably mixed something up in the
// logic that tries to reuse tiles on the compositor side. It is most likely
// benign, but we are missing some fast paths so let's try to make it not happen.
@ -334,8 +334,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
}
}
tile.x = i % newRetainedWidth + newFirstTileX;
tile.y = i / newRetainedWidth + newFirstTileY;
tile.x = i / newRetainedHeight + newFirstTileX;
tile.y = i % newRetainedHeight + newFirstTileY;
}
mFirstTileX = newFirstTileX;