[Scummvm-cvs-logs] SF.net SVN: scummvm: [26128] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Mar 14 00:30:38 CET 2007


Revision: 26128
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26128&view=rev
Author:   peres001
Date:     2007-03-13 16:30:36 -0700 (Tue, 13 Mar 2007)

Log Message:
-----------
enforced use of Common::Rect on all graphic routines

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/intro.cpp
    scummvm/trunk/engines/parallaction/inventory.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/menu.cpp

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-13 23:30:36 UTC (rev 26128)
@@ -110,9 +110,17 @@
 void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) {
 //	printf("Gfx::drawBalloon(%i, %i, %i, %i, %i)...", left, top, width, height, winding);
 
-	floodFill(0, r.left, r.top, r.right+5, r.bottom, kBitFront);
-	floodFill(1, r.left+1, r.top+2, r.right+5-1, r.bottom-1, kBitFront);
+	Common::Rect q = r;
 
+	q.right += 5;
+	floodFill(kBitFront, q, 0);
+
+	q.left++;
+	q.top+=2;
+	q.right--;
+	q.bottom--;
+	floodFill(kBitFront, q, 1);
+
 	winding = (winding == 0 ? 1 : 0);
 	byte *s = _resBalloon[winding];
 	byte *d = _buffers[kBitFront] + (r.left + (r.width()+5)/2 - 5) + (r.bottom - 1) * SCREEN_WIDTH;
@@ -330,12 +338,12 @@
 }
 */
 
-void Gfx::floodFill(byte color, uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers buffer) {
+void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
 //	printf("Gfx::floodFill(%i, %i, %i, %i, %i)\n", color, left, top, right, bottom);
 
-	byte *d = _buffers[buffer] + (left + top * SCREEN_WIDTH);
-	uint16 w = right - left + 1;
-	uint16 h = bottom - top + 1;
+	byte *d = _buffers[buffer] + (r.left + r.top * SCREEN_WIDTH);
+	uint16 w = r.width() + 1;
+	uint16 h = r.height() + 1;
 
 	for (uint16 i = 0; i < h; i++) {
 		memset(d, color, w);
@@ -809,10 +817,13 @@
 	if (left+width >= SCREEN_WIDTH) width = SCREEN_WIDTH - left;
 	if (top+height >= SCREEN_HEIGHT) height = SCREEN_HEIGHT - top;
 
+	Common::Rect q(width, height);
+	q.moveTo(left, top);
+
 	copyRect(
 		kBitBack,
-		left, top, width, height,
-		_buffers[kBit2] + left + top * SCREEN_WIDTH,
+		q,
+		_buffers[kBit2] + q.left + q.top * SCREEN_WIDTH,
 		SCREEN_WIDTH
 	);
 
@@ -943,13 +954,13 @@
 
 
 
-void Gfx::copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16 h, byte *src, uint16 pitch) {
+void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch) {
 
-	byte *d = _buffers[dstbuffer] + x + SCREEN_WIDTH * y;
+	byte *d = _buffers[dstbuffer] + r.left + SCREEN_WIDTH * r.top;
 	byte *s = src;
 
-	for (uint16 _si = 0; _si < h; _si++) {
-		memcpy(d, s, w);
+	for (uint16 _si = 0; _si < r.height(); _si++) {
+		memcpy(d, s, r.width());
 
 		s += pitch;
 		d += SCREEN_WIDTH;
@@ -959,12 +970,12 @@
 }
 
 
-void Gfx::grabRect(Gfx::Buffers srcbuffer, byte *dst, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch) {
+void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
 
-	byte *s = _buffers[srcbuffer] + x + SCREEN_WIDTH * y;
+	byte *s = _buffers[srcbuffer] + r.left + SCREEN_WIDTH * r.top;
 
-	for (uint16 i = 0; i < h; i++) {
-		memcpy(dst, s, w);
+	for (uint16 i = 0; i < r.height(); i++) {
+		memcpy(dst, s, r.width());
 
 		s += SCREEN_WIDTH;
 		dst += pitch;

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-03-13 23:30:36 UTC (rev 26128)
@@ -112,10 +112,9 @@
 	void updateScreen();
 	void clearScreen(Gfx::Buffers buffer);
 	void copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer);
-	void copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16 h, byte *src, uint16 pitch);
-	void grabRect(Gfx::Buffers srcbuffer, byte *dst, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch);
-	void drawBorder(Gfx::Buffers buffer, uint16 x, uint16 y, uint16 w, uint16 h, byte color);
-	void floodFill(byte color, uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers buffer);
+	void copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch);
+	void grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch);
+	void floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color);
 	void flatBlitCnv(StaticCnv *cnv, int16 x, int16 y, Gfx::Buffers buffer, byte *unused);
 	void blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer, Gfx::Buffers mask);
 

Modified: scummvm/trunk/engines/parallaction/intro.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/intro.cpp	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/intro.cpp	2007-03-13 23:30:36 UTC (rev 26128)
@@ -167,15 +167,23 @@
 	if (x > 66)
 		x -= 16;
 
-	uint16 _ax = (x + 32 > 319) ? 319 : (x + 32);
-	_vm->_gfx->floodFill(1, x, 47, _ax, 199, Gfx::kBitBack);
-	_vm->_gfx->floodFill(1, x, 47, _ax, 199, Gfx::kBit2);
+	Common::Rect r;
 
+	r.left = x;
+	r.top = 47;
+	r.right = (x + 32 > 319) ? 319 : (x + 32);
+	r.bottom = 199;
+	_vm->_gfx->floodFill(Gfx::kBitBack, r, 1);
+	_vm->_gfx->floodFill(Gfx::kBit2, r, 1);
+
 	if (x >= 104) return;
 
-	_ax = (x + 247 > 319) ? 319 : (x + 247);
-	_vm->_gfx->floodFill(12, x+215, 47, _ax, 199, Gfx::kBitBack);
-	_vm->_gfx->floodFill(12, x+215, 47, _ax, 199, Gfx::kBit2);
+	r.left = x+215;
+	r.top = 47;
+	r.right = (x + 247 > 319) ? 319 : (x + 247);
+	r.bottom = 199;
+	_vm->_gfx->floodFill(Gfx::kBitBack, r, 12);
+	_vm->_gfx->floodFill(Gfx::kBit2, r, 12);
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-03-13 23:30:36 UTC (rev 26128)
@@ -268,12 +268,12 @@
 
 	_numInvLines = (_numInvLines + 4) / INVENTORY_ITEMS_PER_LINE;
 
+	Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT);
+	r.moveTo(_invPosition._x, _invPosition._y);
+
 	_vm->_gfx->copyRect(
 		Gfx::kBitBack,
-		_invPosition._x,
-		_invPosition._y,
-		INVENTORY_WIDTH,
-		_numInvLines * INVENTORYITEM_HEIGHT,
+		r,
 		_buffer,
 		INVENTORY_WIDTH
 	);

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-03-13 23:30:36 UTC (rev 26128)
@@ -458,8 +458,12 @@
 
 	int16 v7C, v7A;
 	_vm->_gfx->getStringExtent(_vm->_location._comment, 130, &v7C, &v7A);
-	_vm->_gfx->floodFill(0, 5, 5, 10 + v7C, 5 + v7A, Gfx::kBitFront);
-	_vm->_gfx->floodFill(1, 6, 6, 9 + v7C, 4 + v7A, Gfx::kBitFront);
+
+	Common::Rect r(10 + v7C, 5 + v7A);
+	r.moveTo(5, 5);
+	_vm->_gfx->floodFill(Gfx::kBitFront, r, 0);
+	r.grow(-1);
+	_vm->_gfx->floodFill(Gfx::kBitFront, r, 1);
 	_vm->_gfx->displayWrappedString(_vm->_location._comment, 3, 5, 130, 0);
 
 	// FIXME: ???

Modified: scummvm/trunk/engines/parallaction/menu.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/menu.cpp	2007-03-13 22:31:55 UTC (rev 26127)
+++ scummvm/trunk/engines/parallaction/menu.cpp	2007-03-13 23:30:36 UTC (rev 26128)
@@ -327,7 +327,10 @@
 
 				if (!r.contains(x, y)) continue;
 
-				_vm->_gfx->grabRect(Gfx::kBitFront, v14._data0, _si * BLOCK_X_OFFSET + BLOCK_X, BLOCK_Y - _si * BLOCK_Y_OFFSET, BLOCK_WIDTH, BLOCK_HEIGHT, BLOCK_WIDTH);
+				r.setWidth(BLOCK_WIDTH);
+				r.setHeight(BLOCK_HEIGHT);
+				r.moveTo(_si * BLOCK_X_OFFSET + BLOCK_X, BLOCK_Y - _si * BLOCK_Y_OFFSET);
+				_vm->_gfx->grabRect(v14._data0, r, Gfx::kBitFront, BLOCK_WIDTH);
 
 				_vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitBack, 0);
 				_vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitFront, 0);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list