aboutsummaryrefslogtreecommitdiff
path: root/graphics/surface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/surface.cpp')
-rw-r--r--graphics/surface.cpp19
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);
+ }
}
}
}