[Scummvm-cvs-logs] scummvm master -> 3f17a3ff252e802858912818f166539604d8fb86

dreammaster dreammaster at scummvm.org
Sun Jan 1 23:28:08 CET 2012


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:
3f17a3ff25 TSAGE: Simplified some of the dirty rect code to use existing Rect methods


Commit: 3f17a3ff252e802858912818f166539604d8fb86
    https://github.com/scummvm/scummvm/commit/3f17a3ff252e802858912818f166539604d8fb86
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2012-01-01T14:27:24-08:00

Commit Message:
TSAGE: Simplified some of the dirty rect code to use existing Rect methods

Changed paths:
    engines/tsage/graphics.cpp



diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 4db8986..4b9a4ad 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -659,7 +659,7 @@ void GfxSurface::mergeDirtyRects() {
 		rInner = rOuter;
 		while (++rInner != _dirtyRects.end()) {
 
-			if (looseIntersectRectangle(*rOuter, *rInner)) {
+			if ((*rOuter).intersects(*rInner)) {
 				// these two rectangles overlap or
 				// are next to each other - merge them
 
@@ -676,22 +676,6 @@ void GfxSurface::mergeDirtyRects() {
 }
 
 /**
- * Check if the two rectangles are next to each other.
- * @param pSrc1			a source rectangle
- * @param pSrc2			a source rectangle
- */
-bool GfxSurface::looseIntersectRectangle(const Rect &src1, const Rect &src2) {
-	Rect destRect;
-
-	destRect.left   = MAX(src1.left, src2.left);
-	destRect.top    = MAX(src1.top, src2.top);
-	destRect.right  = MIN(src1.right, src2.right);
-	destRect.bottom = MIN(src1.bottom, src2.bottom);
-
-	return destRect.isValidRect();
-}
-
-/**
  * Creates the union of two rectangles.
  * Returns True if there is a union.
  * @param pDest			destination rectangle that is to receive the new union
@@ -699,10 +683,8 @@ bool GfxSurface::looseIntersectRectangle(const Rect &src1, const Rect &src2) {
  * @param pSrc2			a source rectangle
  */
 bool GfxSurface::unionRectangle(Common::Rect &destRect, const Rect &src1, const Rect &src2) {
-	destRect.left   = MIN(src1.left, src2.left);
-	destRect.top    = MIN(src1.top, src2.top);
-	destRect.right  = MAX(src1.right, src2.right);
-	destRect.bottom = MAX(src1.bottom, src2.bottom);
+	destRect = src1;
+	destRect.extend(src2);
 
 	return !destRect.isEmpty();
 }






More information about the Scummvm-git-logs mailing list