GRAPHICS: Initialize mask in FllodFill when required

This commit is contained in:
Eugene Sandulenko 2016-06-14 20:45:09 +02:00
parent 2bf0ebf317
commit 934e186063

View file

@ -508,6 +508,11 @@ FloodFill::FloodFill(Graphics::Surface *surface, uint32 oldColor, uint32 fillCol
_mask = nullptr;
_maskMode = maskMode;
if (_maskMode) {
_mask = new Graphics::Surface();
_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
}
_visited = (byte *)calloc(_w * _h, 1);
}
@ -588,10 +593,13 @@ void FloodFill::fill() {
}
void FloodFill::fillMask() {
_mask = new Graphics::Surface();
_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
_maskMode = true;
if (!_mask) {
_mask = new Graphics::Surface();
_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
}
fill();
}