[Scummvm-cvs-logs] CVS: scummvm/queen graphics.h,1.62,1.63 graphics.cpp,1.86,1.87

Gregory Montoir cyx at users.sourceforge.net
Mon Jan 19 13:48:02 CET 2004


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv7117

Modified Files:
	graphics.h graphics.cpp 
Log Message:
re-use BobFrame

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- graphics.h	12 Jan 2004 13:40:01 -0000	1.62
+++ graphics.h	19 Jan 2004 21:47:20 -0000	1.63
@@ -95,7 +95,7 @@
 	void unpackControlBank();
 	void setupMouseCursor();
 
-	void drawBob(const BobSlot *bs, int16 x, int16 y);
+	void drawBob(const BobSlot *bs, BobFrame *bf, int16 x, int16 y);
 	void drawInventoryItem(uint32 frameNum, uint16 x, uint16 y);
 	void pasteBob(uint16 objNum, uint16 image);
 	void shrinkFrame(const BobFrame *bf, uint16 percentage);

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- graphics.cpp	18 Jan 2004 20:29:00 -0000	1.86
+++ graphics.cpp	19 Jan 2004 21:47:20 -0000	1.87
@@ -200,22 +200,21 @@
 	_vm->display()->setMouseCursor(bf->data, bf->width, bf->height);
 }
 
-void Graphics::drawBob(const BobSlot *bs, int16 x, int16 y) {
+void Graphics::drawBob(const BobSlot *bs, BobFrame *bf, int16 x, int16 y) {
 	debug(9, "Graphics::drawBob(%d, %d, %d)", bs->frameNum, x, y);
 
 	uint16 w, h;
-	BobFrame *pbf = _vm->bankMan()->fetchFrame(bs->frameNum);
 	if (bs->scale < 100) {
-		shrinkFrame(pbf, bs->scale);
-		pbf = &_shrinkBuffer;
+		shrinkFrame(bf, bs->scale);
+		bf = &_shrinkBuffer;
 	}
-	w = pbf->width;
-	h = pbf->height;
+	w = bf->width;
+	h = bf->height;
 
 	const Box *box = &bs->box;
 
 	if(w != 0 && h != 0 && box->intersects(x, y, w, h)) {
-		uint8 *src = pbf->data;
+		uint8 *src = bf->data;
 		uint16 x_skip = 0;
 		uint16 y_skip = 0;
 		uint16 w_new = w;
@@ -274,8 +273,7 @@
 	// computing new size, rounding to upper value
 	uint16 new_w = (bf->width  * percentage + 50) / 100;
 	uint16 new_h = (bf->height * percentage + 50) / 100;
-
-	debug(9, "Graphics::shrinkFrame() - scale = %d, bufsize = %d", percentage, new_w * new_h);
+	assert(new_w * new_h < BOB_SHRINK_BUF_SIZE);
 
 	if (new_w != 0 && new_h != 0) {
 
@@ -389,7 +387,7 @@
 			x = pbs->x - xh - _vm->display()->horizontalScroll();
 			y = pbs->y - yh;
 
-			drawBob(pbs, x, y);
+			drawBob(pbs, pbf, x, y);
 		}
 	}
 }





More information about the Scummvm-git-logs mailing list