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

sev- sev at scummvm.org
Wed Mar 9 20:13:06 CET 2016


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

Summary:
ca7720960a WAGE: Attempt to fix bounds calculation
ee56fb805b WAGE: Skip flood fill in Bitmap when calclating bounds


Commit: ca7720960a678e91902fd7e42bbe9a753f5b04b3
    https://github.com/scummvm/scummvm/commit/ca7720960a678e91902fd7e42bbe9a753f5b04b3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-09T18:56:42+01:00

Commit Message:
WAGE: Attempt to fix bounds calculation

Changed paths:
    engines/wage/design.cpp
    engines/wage/detection_tables.h



diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 4d3cbdb..15d5d13 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -72,6 +72,8 @@ Design::Design(Common::SeekableReadStream *data) {
 
 	_surface = NULL;
 	_bounds = NULL;
+
+	_boundsCalculationMode = false;
 }
 
 Design::~Design() {
@@ -87,9 +89,13 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
 	if (_surface == NULL) {
 		_boundsCalculationMode = true;
 		_bounds->debugPrint(4, "Internal bounds:");
-		_bounds->left = _bounds->right = _bounds->top = _bounds->bottom = 0;
+		_bounds->left = _bounds->top = 10000;
+		_bounds->right =_bounds->bottom = -10000;
 		render(patterns);
 		_boundsCalculationMode = false;
+		if (_bounds->right == -10000) {
+			_bounds->left = _bounds->top = _bounds->right = _bounds->bottom = 0;
+		}
 		_bounds->debugPrint(4, "Calculated bounds:");
 
 		_surface = new Graphics::Surface;
@@ -100,6 +106,8 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
 
 		needRender = true;
 	}
+
+	_bounds->debugPrint(4, "Using bounds:");
 #if 0
 	PlotData pd(_surface, &patterns, 8, 1, this);
 	int x1 = 50, y1 = 50, x2 = 200, y2 = 200, borderThickness = 30;
@@ -125,15 +133,17 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
 	if (needRender)
 		render(patterns);
 
-	const int padding = 3;
-	for (int i = padding; i < _bounds->height() - 2 * padding; i++) {
-		const byte *src = (const byte *)_surface->getBasePtr(padding, i);
-		byte *dst = (byte *)surface->getBasePtr(x + padding, y+i);
-		for (int j = padding; j < _bounds->width() - 2 * padding; j++) {
-			if (*src != kColorGreen)
-				*dst = *src;
-			src++;
-			dst++;
+	if (_bounds->width() && _bounds->height()) {
+		const int padding = 3;
+		for (int i = padding; i < _bounds->height() - 2 * padding; i++) {
+			const byte *src = (const byte *)_surface->getBasePtr(padding, i);
+			byte *dst = (byte *)surface->getBasePtr(x + padding, y+i);
+			for (int j = padding; j < _bounds->width() - 2 * padding; j++) {
+				if (*src != kColorGreen)
+					*dst = *src;
+				src++;
+				dst++;
+			}
 		}
 	}
 }
@@ -192,7 +202,7 @@ bool Design::isPointOpaque(int x, int y) {
 
 void Design::adjustBounds(int16 x, int16 y) {
 	_bounds->left   = MIN(x, _bounds->left);
-	_bounds->right  = MAX(x, _bounds->left);
+	_bounds->right  = MAX(x, _bounds->right);
 	_bounds->top    = MIN(y, _bounds->top);
 	_bounds->bottom = MAX(y, _bounds->bottom);
 }
@@ -455,7 +465,9 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &
 				color = b;
 
 			for (int c = 0; c < 8; c++) {
-				if (x1 + x >= 0 && x1 + x < surface->w && y1 + y >= 0 && y1 + y < surface->h)
+				if (_boundsCalculationMode) {
+					adjustBounds(x, y);
+				} else if (x1 + x >= 0 && x1 + x < surface->w && y1 + y >= 0 && y1 + y < surface->h)
 					*((byte *)tmp.getBasePtr(x, y)) = (color & (1 << (7 - c % 8))) ? kColorBlack : kColorWhite;
 				x++;
 				if (x == w) {
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index 35ac91f..cc3b2be 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -31,7 +31,7 @@ namespace Wage {
 
 static const ADGameDescription gameDescriptions[] = {
 	FANGAME("3rd Floor", "a107d7a177970b2259e32681bd8b47c9", 285056),
-	BIGGAME("afm", "v1.8", "Another Fine Mess 1.8", "8e5aa915f3253efb2aab52435647b25e", 1456000),
+	BIGGAME("afm", "v1.8", "Another Fine Mess 1.8", "65dc7baec9fb0812238139da15efc4e3", 1456000),
 	BIGGAME("amot", "v1.8", "A Mess O' Trouble 1.8", "b3ef53afed282671b704e45df829350c", 1895552),
 	FANGAME("Bug Hunt", "2ebd3515a87941063ad66c3cf93c5e78", 200064),
 	// Problems with letter rendering


Commit: ee56fb805b1ecf0ab79424d03a64bfea618aba16
    https://github.com/scummvm/scummvm/commit/ee56fb805b1ecf0ab79424d03a64bfea618aba16
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-09T20:12:34+01:00

Commit Message:
WAGE: Skip flood fill in Bitmap when calclating bounds

Changed paths:
    engines/wage/design.cpp



diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 15d5d13..1fd1dd5 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -481,6 +481,9 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &
 
 	in.skip(numBytes);
 
+	if (_boundsCalculationMode)
+		return;
+
 	FloodFill ff(&tmp, kColorWhite, kColorGreen);
 	for (int yy = 0; yy < h; yy++) {
 		ff.addSeed(0, yy);






More information about the Scummvm-git-logs mailing list