1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Make the invalidation grid size dynamic

This commit is contained in:
ζeh Matt
2025-04-05 17:36:43 +03:00
parent c6a3fcdca0
commit 921c1d8daa
2 changed files with 8 additions and 2 deletions

View File

@@ -33,6 +33,11 @@ namespace OpenRCT2::Drawing
_rowCount = (height / blockHeight) + 1;
_screenWidth = width;
_screenHeight = height;
_blocks.resize(_columnCount * _rowCount);
_blocks.shrink_to_fit();
std::fill(_blocks.begin(), _blocks.end(), 0);
}
void InvalidationGrid::invalidate(int32_t left, int32_t top, int32_t right, int32_t bottom) noexcept
@@ -58,7 +63,7 @@ namespace OpenRCT2::Drawing
bottom /= _blockHeight;
// TODO: Remove this once _blocks is no longer interop wrapper.
auto& blocks = _blocks;
auto* blocks = _blocks.data();
const auto columnSize = right - left + 1;

View File

@@ -2,6 +2,7 @@
#include <algorithm>
#include <cstdint>
#include <vector>
namespace OpenRCT2::Drawing
{
@@ -12,7 +13,7 @@ namespace OpenRCT2::Drawing
uint32_t _columnCount{};
uint32_t _rowCount{};
uint8_t _blocks[7500]{};
std::vector<uint8_t> _blocks;
uint32_t _screenWidth{};
uint32_t _screenHeight{};