diff options
author | Eugene Sandulenko | 2016-06-03 15:52:48 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-06-03 15:52:48 +0200 |
commit | e171d21fc5fa8e0b918593ca57860835012085a1 (patch) | |
tree | f49297ecb31ecda2ae4346e899b2910236213f6a /graphics | |
parent | c00506521724dd0d775ed90b3034c2ac590b1a78 (diff) | |
download | scummvm-rg350-e171d21fc5fa8e0b918593ca57860835012085a1.tar.gz scummvm-rg350-e171d21fc5fa8e0b918593ca57860835012085a1.tar.bz2 scummvm-rg350-e171d21fc5fa8e0b918593ca57860835012085a1.zip |
GRAPHICS: Fix FloodFill
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/surface.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 8e5a22aec6..2fe6a73010 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -524,23 +524,32 @@ void FloodFill::addSeed(int x, int y) { if (!_visited[y * _w + x]) { _visited[y * _w + x] = 1; void *p = _surface->getBasePtr(x, y); + bool changed = false; if (_surface->format.bytesPerPixel == 1) { - if (*((byte *)p) == _oldColor) + if (*((byte *)p) == _oldColor) { *((byte *)p) = _fillColor; + changed = true; + } } else if (_surface->format.bytesPerPixel == 2) { - if (READ_UINT16(p) == _oldColor) + if (READ_UINT16(p) == _oldColor) { WRITE_UINT16(p, _fillColor); + changed = true; + } } else if (_surface->format.bytesPerPixel == 4) { - if (READ_UINT32(p) == _oldColor) + if (READ_UINT32(p) == _oldColor) { WRITE_UINT32(p, _fillColor); + changed = true; + } } else { error("Unsupported bpp in FloodFill"); } - Common::Point *pt = new Common::Point(x, y); + if (changed) { + Common::Point *pt = new Common::Point(x, y); - _queue.push_back(pt); + _queue.push_back(pt); + } } } } |