Explorar o código

BitMask::create Don't request more memory than needed when size is a multiply of 8

kleonc %!s(int64=4) %!d(string=hai) anos
pai
achega
8963be2ef4
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      scene/resources/bit_map.cpp

+ 1 - 1
scene/resources/bit_map.cpp

@@ -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());
 }
 }