From e8e137a46c988358e171d85cd53b239cf22a8760 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 16 Aug 2020 23:50:46 +0200 Subject: [PATCH] GRAPHICS: Create FloodFill mask with the matching pixel format of the main surface --- graphics/surface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index d389f139efa..ebdf2256f83 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -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();