Skip to content

Commit

Permalink
Fix TileAllocator not responding correctly to resizes
Browse files Browse the repository at this point in the history
  • Loading branch information
lhecker committed Jul 8, 2022
1 parent b5763fa commit f4c10f7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/renderer/atlas/AtlasEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ namespace Microsoft::Console::Render
return false;
}

// We need to backup _pos/_size in case our resize below exceeds _maxArea.
// In that case we have to restore _pos/_size so that if _maxArea is increased
// (window resize for instance), we can pick up were we previously left off.
const auto pos = _pos;

_pos.x += _tileSize.x;
if (_pos.x <= _limit.x)
{
Expand Down Expand Up @@ -717,10 +722,19 @@ namespace Microsoft::Console::Render
_size.y *= 2;
_pos.x = 0;
}
_limit = { gsl::narrow_cast<u16>(_size.x - _tileSize.x), gsl::narrow_cast<u16>(_size.y - _tileSize.y) };
_originX = _pos.x;

_updateCanGenerate();
if (_canGenerate)
{
_limit = { static_cast<u16>(_size.x - _tileSize.x), static_cast<u16>(_size.y - _tileSize.y) };
_originX = _pos.x;
}
else
{
_size = size;
_pos = pos;
}

return _canGenerate;
}

Expand Down

0 comments on commit f4c10f7

Please sign in to comment.