diff options
author | Eugene Sandulenko | 2016-06-14 20:45:09 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-06-14 20:45:09 +0200 |
commit | 934e1860637186c98d4dd8434a260923748b8936 (patch) | |
tree | afe0ed3403231b6573f4dad67c54658a372a30f2 | |
parent | 2bf0ebf31733988a940dc31fa0bd2367dcd91e68 (diff) | |
download | scummvm-rg350-934e1860637186c98d4dd8434a260923748b8936.tar.gz scummvm-rg350-934e1860637186c98d4dd8434a260923748b8936.tar.bz2 scummvm-rg350-934e1860637186c98d4dd8434a260923748b8936.zip |
GRAPHICS: Initialize mask in FllodFill when required
-rw-r--r-- | graphics/surface.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 5f8796566c..699e1ccd22 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -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(); } |