[Scummvm-cvs-logs] scummvm master -> e171d21fc5fa8e0b918593ca57860835012085a1

sev- sev at scummvm.org
Fri Jun 3 15:53:17 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e171d21fc5 GRAPHICS: Fix FloodFill


Commit: e171d21fc5fa8e0b918593ca57860835012085a1
    https://github.com/scummvm/scummvm/commit/e171d21fc5fa8e0b918593ca57860835012085a1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-06-03T15:52:48+02:00

Commit Message:
GRAPHICS: Fix FloodFill

Changed paths:
    graphics/surface.cpp



diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 8e5a22a..2fe6a73 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);
+			}
 		}
 	}
 }






More information about the Scummvm-git-logs mailing list