Bug 1122631 - Fix wrong logic in DrawTargetTiled::CopySurface. r=jrmuizel

This commit is contained in:
Nicolas Silva 2015-01-19 12:36:43 +01:00
parent 71ad39a7e7
commit bc8f416df2

View File

@ -178,19 +178,14 @@ DrawTargetTiled::CopySurface(SourceSurface *aSurface,
const IntRect &aSourceRect,
const IntPoint &aDestination)
{
// CopySurface ignores the transform, account for that here.
for (size_t i = 0; i < mTiles.size(); i++) {
IntRect src = aSourceRect;
src.x += mTiles[i].mTileOrigin.x;
src.width -= mTiles[i].mTileOrigin.x;
src.y = mTiles[i].mTileOrigin.y;
src.height -= mTiles[i].mTileOrigin.y;
if (src.width <= 0 || src.height <= 0) {
IntPoint tileOrigin = mTiles[i].mTileOrigin;
IntSize tileSize = mTiles[i].mDrawTarget->GetSize();
if (!IntRect(aDestination, aSourceRect.Size()).Intersects(IntRect(tileOrigin, tileSize))) {
continue;
}
mTiles[i].mDrawTarget->CopySurface(aSurface, src, aDestination);
// CopySurface ignores the transform, account for that here.
mTiles[i].mDrawTarget->CopySurface(aSurface, aSourceRect, aDestination - tileOrigin);
}
}