GRAPHICS: Create FloodFill mask with the matching pixel format of the main surface

This commit is contained in:
Eugene Sandulenko 2020-08-16 23:50:46 +02:00
parent 97fecbec16
commit e8e137a46c

View File

@ -543,7 +543,7 @@ FloodFill::FloodFill(Graphics::Surface *surface, uint32 oldColor, uint32 fillCol
if (_maskMode) {
_mask = new Graphics::Surface();
_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
_mask->create(_w, _h, surface->format); // Uses calloc()
}
_visited = (byte *)calloc(_w * _h, 1);
@ -588,7 +588,7 @@ void FloodFill::addSeed(int x, int y) {
if (!_maskMode)
WRITE_UINT16(src, _fillColor);
else
*((byte *)dst) = 255;
*((uint16 *)dst) = 0xffff;
changed = true;
}
@ -597,7 +597,7 @@ void FloodFill::addSeed(int x, int y) {
if (!_maskMode)
WRITE_UINT32(src, _fillColor);
else
*((byte *)dst) = 255;
*((uint32 *)dst) = 0xffffffff;
changed = true;
}
@ -632,7 +632,7 @@ void FloodFill::fillMask() {
if (!_mask) {
_mask = new Graphics::Surface();
_mask->create(_w, _h, Graphics::PixelFormat::createFormatCLUT8()); // Uses calloc()
_mask->create(_w, _h, _surface->format); // Uses calloc()
}
fill();