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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Jan 29 10:37:05 CET 2008


Revision: 30695
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30695&view=rev
Author:   peres001
Date:     2008-01-29 01:37:03 -0800 (Tue, 29 Jan 2008)

Log Message:
-----------
Cleanup (step 2). No code outside Gfx reference screen buffers anymore.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/gui_ns.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-01-28 22:21:47 UTC (rev 30694)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-01-29 09:37:03 UTC (rev 30695)
@@ -538,7 +538,7 @@
 	r.top = 47;
 	r.right = (x + 32 > 319) ? 319 : (x + 32);
 	r.bottom = 199;
-	_gfx->floodFill(Gfx::kBit2, r, 1);
+	_gfx->fillBackground(r, 1);
 
 	if (x >= 104) return;
 
@@ -546,7 +546,7 @@
 	r.top = 47;
 	r.right = (x + 247 > 319) ? 319 : (x + 247);
 	r.bottom = 199;
-	_gfx->floodFill(Gfx::kBit2, r, 12);
+	_gfx->fillBackground(r, 12);
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-28 22:21:47 UTC (rev 30694)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-29 09:37:03 UTC (rev 30695)
@@ -382,40 +382,27 @@
 //
 //	graphic primitives
 //
-void Gfx::clearScreen(Gfx::Buffers buffer) {
-	memset(_buffers[buffer]->pixels, 0, _vm->_screenSize);
+void Gfx::clearBackground() {
+	memset(_buffers[kBit2]->pixels, 0, _vm->_screenSize);
 }
 
 
 void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
 
-	if (mask) {
-		uint16 z = queryMask(y);
-		blitCnv(&surf, x, y, z);
-	} else {
-		flatBlitCnv(&surf, x, y);
-	}
+	Common::Rect r(surf.w, surf.h);
+	r.moveTo(x, y);
 
+	uint16 z = (mask) ? queryMask(y) : BUFFER_FOREGROUND;
+	blt(r, (byte*)surf.pixels, _buffers[kBit2], z, 0);
 }
 
-void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
-
-	byte *d = (byte*)_buffers[buffer]->getBasePtr(r.left, r.top);
-	uint16 w = r.width() + 1;
-	uint16 h = r.height() + 1;
-
-	for (uint16 i = 0; i < h; i++) {
-		memset(d, color, w);
-
-		d += _backgroundWidth;
-	}
-
-	return;
+void Gfx::fillBackground(const Common::Rect& r, byte color) {
+	_buffers[kBit2]->fillRect(r, color);
 }
 
-void Gfx::invertRect(Gfx::Buffers buffer, const Common::Rect& r) {
+void Gfx::invertBackground(const Common::Rect& r) {
 
-	byte *d = (byte*)_buffers[buffer]->getBasePtr(r.left, r.top);
+	byte *d = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
 
 	for (int i = 0; i < r.height(); i++) {
 		for (int j = 0; j < r.width(); j++) {
@@ -423,7 +410,7 @@
 			d++;
 		}
 
-		d += (_buffers[buffer]->pitch - r.width());
+		d += (_buffers[kBit2]->pitch - r.width());
 	}
 
 }
@@ -672,23 +659,6 @@
 }
 
 
-
-void Gfx::flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y) {
-	Common::Rect r(cnv->w, cnv->h);
-	r.moveTo(x, y);
-
-	blt(r, (byte*)cnv->pixels, _buffers[kBit2], BUFFER_FOREGROUND, 0);
-}
-
-
-void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z) {
-	Common::Rect r(cnv->w, cnv->h);
-	r.moveTo(x, y);
-
-    blt(r, (byte*)cnv->pixels, _buffers[kBit2], z, 0);
-}
-
-
 void Gfx::getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height) {
 
 	uint16 lines = 0;
@@ -762,9 +732,9 @@
 	return;
 }
 
-void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
-	byte *s = (byte*)_buffers[srcbuffer]->getBasePtr(r.left, r.top);
-	copyRect(r.width(), r.height(), dst, pitch, s, _backgroundWidth);
+void Gfx::grabBackground(const Common::Rect& r, Graphics::Surface &dst) {
+	byte *s = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
+	copyRect(r.width(), r.height(), (byte*)dst.pixels, dst.pitch, s, _backgroundWidth);
 	return;
 }
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-01-28 22:21:47 UTC (rev 30694)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-01-29 09:37:03 UTC (rev 30695)
@@ -398,10 +398,10 @@
 	void freeItems();
 
 	// low level surfaces
-	void clearScreen(Gfx::Buffers buffer);
-	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 invertRect(Gfx::Buffers buffer, const Common::Rect& r);
+	void clearBackground();
+	void grabBackground(const Common::Rect& r, Graphics::Surface &dst);
+	void fillBackground(const Common::Rect& r, byte color);
+	void invertBackground(const Common::Rect& r);
 
 	// palette
 	void setPalette(Palette palette);
@@ -481,9 +481,6 @@
 	void drawItems();
 	void drawBalloons();
 
-	void initBuffers(int w, int h);
-	void freeBuffers();
-
 	void copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src, uint srcPitch);
 
 	int createBalloon(int16 w, int16 h, int16 winding, uint16 borderThickness);
@@ -494,10 +491,6 @@
 	void drawText(Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color);
 	bool drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
 
-
-	void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y);
-	void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z);
-
     void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
 };
 

Modified: scummvm/trunk/engines/parallaction/gui_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-01-28 22:21:47 UTC (rev 30694)
+++ scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-01-29 09:37:03 UTC (rev 30695)
@@ -365,11 +365,11 @@
 	}
 
 	if ((selection != -1) && (getPlatform() == Common::kPlatformAmiga)) {
-		_gfx->invertRect(Gfx::kBit2, codeTrueBlocks[selection]);
+		_gfx->invertBackground(codeTrueBlocks[selection]);
 		_gfx->updateScreen();
 		beep();
 		g_system->delayMillis(100);
-		_gfx->invertRect(Gfx::kBit2, codeTrueBlocks[selection]);
+		_gfx->invertBackground(codeTrueBlocks[selection]);
 		_gfx->updateScreen();
 	}
 
@@ -404,7 +404,7 @@
 	Graphics::Surface v14;
 	v14.create(BLOCK_WIDTH * 8, BLOCK_HEIGHT, 1);
 	Common::Rect rect(SLOT_X, SLOT_Y, SLOT_X + BLOCK_WIDTH * 8, SLOT_Y + BLOCK_HEIGHT);
-	_gfx->grabRect((byte*)v14.pixels, rect, Gfx::kBit2, rect.width());
+	_gfx->grabBackground(rect, v14);
 
 	Graphics::Surface block;
 	block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
@@ -426,7 +426,7 @@
 			int _si = guiGetSelectedBlock(_mousePos);
 
 			if (_si != -1) {
-				_gfx->grabRect((byte*)block.pixels, codeTrueBlocks[_si], Gfx::kBit2, BLOCK_WIDTH);
+				_gfx->grabBackground(codeTrueBlocks[_si], block);
 				_gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false);
 
 				if (keys[0][_di] == _si) {

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-28 22:21:47 UTC (rev 30694)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-29 09:37:03 UTC (rev 30695)
@@ -248,7 +248,7 @@
 
 	uint16 v2 = 0;
 	if (!scumm_stricmp(background, "final")) {
-		_gfx->clearScreen(Gfx::kBit2);
+		_gfx->clearBackground();
 		for (uint16 _si = 0; _si < 32; _si++) {
 			pal.setEntry(_si, v2, v2, v2);
 			v2 += 4;


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