[Scummvm-cvs-logs] scummvm master -> 53ed7f6ac171b0a6478763121873692b535ec798

wjp wjp at usecode.org
Sat Feb 20 12:32:42 CET 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:
53ed7f6ac1 SCI: Rewrite Plane::mergeToRectList


Commit: 53ed7f6ac171b0a6478763121873692b535ec798
    https://github.com/scummvm/scummvm/commit/53ed7f6ac171b0a6478763121873692b535ec798
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-02-20T12:26:54+01:00

Commit Message:
SCI: Rewrite Plane::mergeToRectList

The old one would continue reading from outerRect after it was deleted.

Changed paths:
    engines/sci/graphics/plane32.cpp



diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 0ab9ea4..40cb565 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -629,18 +629,26 @@ void Plane::mergeToRectList(const Common::Rect &rect, RectList &rectList) const
 	temp.add(rect);
 
 	for (RectList::size_type i = 0; i < temp.size(); ++i) {
-		Common::Rect *outerRect = temp[i];
+		Common::Rect r = *temp[i];
+
 		for (RectList::size_type j = 0; j < rectList.size(); ++j) {
-			Common::Rect *innerRect = rectList[i];
-			if (innerRect->intersects(*outerRect)) {
-				Common::Rect out[4];
-				int count = splitRects(*outerRect, *innerRect, out);
+			Common::Rect *innerRect = rectList[j];
+			if (innerRect->contains(r)) {
+				temp.erase_at(i);
+				break;
+			}
+
+			Common::Rect out[4];
+			int count = splitRects(r, *innerRect, out);
+			if (count != -1) {
 				for (int k = count - 1; k >= 0; --k) {
 					temp.add(out[k]);
 				}
+
 				temp.erase_at(i);
-			} else {
-				temp.erase_at(i);
+
+				// proceed to the next rect
+				r = *temp[++i];
 			}
 		}
 	}






More information about the Scummvm-git-logs mailing list