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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user