| 42 | } |
| 43 | |
| 44 | void InvalidationGrid::invalidate(int32_t left, int32_t top, int32_t right, int32_t bottom) noexcept |
| 45 | { |
| 46 | left = std::max(left, 0); |
| 47 | top = std::max(top, 0); |
| 48 | right = std::min(right, static_cast<int32_t>(_screenWidth)); |
| 49 | bottom = std::min(bottom, static_cast<int32_t>(_screenHeight)); |
| 50 | |
| 51 | if (left >= right) |
| 52 | { |
| 53 | return; |
| 54 | } |
| 55 | if (top >= bottom) |
| 56 | { |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | left /= _blockWidth; |
| 61 | right /= _blockWidth; |
| 62 | |
| 63 | top /= _blockHeight; |
| 64 | bottom /= _blockHeight; |
| 65 | |
| 66 | // TODO: Remove this once _blocks is no longer interop wrapper. |
| 67 | auto& blocks = _blocks; |
| 68 | |
| 69 | const auto columnSize = right - left + 1; |
| 70 | |
| 71 | for (int16_t y = top; y <= bottom; y++) |
| 72 | { |
| 73 | const auto yOffset = y * _columnCount; |
| 74 | |
| 75 | // Mark row by column size as invalidated. |
| 76 | std::fill_n(blocks.begin() + yOffset + left, columnSize, 0xFF); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | } |
no test coverage detected