Merge pull request #48549 from kleonc/bitmap_resize_fix

BitMask::create Don't request more memory than needed when size is a multiply of 8
This commit is contained in:
Rémi Verschelde 2021-05-17 17:39:24 +02:00 committed by GitHub
commit 8e8cad5bc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ void BitMap::create(const Size2 &p_size) {
width = p_size.width; width = p_size.width;
height = p_size.height; height = p_size.height;
bitmask.resize(((width * height) / 8) + 1); bitmask.resize((((width * height) - 1) / 8) + 1);
memset(bitmask.ptrw(), 0, bitmask.size()); memset(bitmask.ptrw(), 0, bitmask.size());
} }