From 9b60b2ec8119d9ad080409c1bf43cb112c3375b8 Mon Sep 17 00:00:00 2001 From: Mason Chang Date: Fri, 13 Feb 2015 16:36:45 +0800 Subject: [PATCH] Bug 1130681. Part 2: Backout bug 1118876 for android reftest failures. r=jrmuizel --- gfx/layers/TiledLayerBuffer.h | 6 +-- gfx/layers/client/TiledContentClient.cpp | 49 ++++++++++-------------- gfx/layers/client/TiledContentClient.h | 2 - 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/gfx/layers/TiledLayerBuffer.h b/gfx/layers/TiledLayerBuffer.h index b3267ccb942..aee79829213 100644 --- a/gfx/layers/TiledLayerBuffer.h +++ b/gfx/layers/TiledLayerBuffer.h @@ -558,15 +558,15 @@ TiledLayerBuffer::Update(const nsIntRegion& newValidRegion, x += width; } - mRetainedTiles = newRetainedTiles; AsDerived().PostValidate(aPaintRegion); - for (unsigned int i = 0; i < mRetainedTiles.Length(); ++i) { - AsDerived().UnlockTile(mRetainedTiles[i]); + for (unsigned int i = 0; i < newRetainedTiles.Length(); ++i) { + AsDerived().UnlockTile(newRetainedTiles[i]); } // At this point, oldTileCount should be zero MOZ_ASSERT(oldTileCount == 0, "Failed to release old tiles"); + mRetainedTiles = newRetainedTiles; mValidRegion = newValidRegion; mPaintedRegion.Or(mPaintedRegion, aPaintRegion); } diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index a9db8511a78..63afe9a6654 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -517,7 +517,6 @@ TileClient::TileClient(const TileClient& o) mManager = o.mManager; mInvalidFront = o.mInvalidFront; mInvalidBack = o.mInvalidBack; - mOrigin = o.mOrigin; } TileClient& @@ -537,7 +536,6 @@ TileClient::operator=(const TileClient& o) mManager = o.mManager; mInvalidFront = o.mInvalidFront; mInvalidBack = o.mInvalidBack; - mOrigin = o.mOrigin; return *this; } @@ -1058,31 +1056,6 @@ ClientTiledLayerBuffer::PostValidate(const nsIntRegion& aPaintRegion) mTilingOrigin = IntPoint(std::numeric_limits::max(), std::numeric_limits::max()); } - - for (size_t i = 0; i < mRetainedTiles.Length(); ++i) { - TileClient& tile = mRetainedTiles[i]; - if (tile.mFrontBuffer && tile.mFrontBuffer->IsLocked()) { - // Only worry about padding when not doing low-res because it simplifies - // the math and the artifacts won't be noticable - // Edge padding prevents sampling artifacts when compositing. - if (mResolution == 1) { - nsIntRect unscaledTile = nsIntRect(tile.mOrigin.x, tile.mOrigin.y, - GetTileSize().width, GetTileSize().height); - nsIntRegion tileValidRegion = GetValidRegion(); - tileValidRegion.OrWith(aPaintRegion); - - // We only need to pad out if the tile has area that's not valid - if (!tileValidRegion.Contains(unscaledTile)) { - tileValidRegion = tileValidRegion.Intersect(unscaledTile); - // translate the region into tile space and pad - tileValidRegion.MoveBy(-nsIntPoint(unscaledTile.x, unscaledTile.y)); - RefPtr drawTarget = tile.mFrontBuffer->BorrowDrawTarget(); - PadDrawTargetOutFromRegion(drawTarget, tileValidRegion); - } - } - } - } - } void @@ -1171,8 +1144,6 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile, } } - aTile.mOrigin = gfx::ToIntPoint(aTileOrigin); - if (usingTiledDrawTarget) { if (createdTextureClient) { if (!mCompositableClient->AddTextureClient(backBuffer)) { @@ -1276,6 +1247,26 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile, aTile.mInvalidFront.Or(aTile.mInvalidFront, nsIntRect(copyTarget.x, copyTarget.y, copyRect.width, copyRect.height)); } + // only worry about padding when not doing low-res + // because it simplifies the math and the artifacts + // won't be noticable + if (mResolution == 1) { + nsIntRect unscaledTile = nsIntRect(aTileOrigin.x, + aTileOrigin.y, + GetTileSize().width, + GetTileSize().height); + + nsIntRegion tileValidRegion = GetValidRegion(); + tileValidRegion.Or(tileValidRegion, aDirtyRegion); + // We only need to pad out if the tile has area that's not valid + if (!tileValidRegion.Contains(unscaledTile)) { + tileValidRegion = tileValidRegion.Intersect(unscaledTile); + // translate the region into tile space and pad + tileValidRegion.MoveBy(-nsIntPoint(unscaledTile.x, unscaledTile.y)); + PadDrawTargetOutFromRegion(drawTarget, tileValidRegion); + } + } + // The new buffer is now validated, remove the dirty region from it. aTile.mInvalidBack.SubOut(offsetScaledDirtyRegion); diff --git a/gfx/layers/client/TiledContentClient.h b/gfx/layers/client/TiledContentClient.h index 547284519b9..1bbca190980 100644 --- a/gfx/layers/client/TiledContentClient.h +++ b/gfx/layers/client/TiledContentClient.h @@ -274,8 +274,6 @@ struct TileClient nsIntRegion mInvalidBack; nsExpirationState mExpirationState; - gfx::IntPoint mOrigin; - private: // Copies dirty pixels from the front buffer into the back buffer, // and records the copied region in aAddPaintedRegion.