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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Jan 12 11:46:51 CET 2008


Revision: 30441
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30441&view=rev
Author:   peres001
Date:     2008-01-12 02:46:51 -0800 (Sat, 12 Jan 2008)

Log Message:
-----------
Added function to encapsulate/protect manipulation of background.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-12 08:31:36 UTC (rev 30440)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-12 10:46:51 UTC (rev 30441)
@@ -133,15 +133,9 @@
 
 	int16 x = inst->_opA.getRValue();
 	int16 y = inst->_opB.getRValue();
+	bool mask = (inst->_flags & kInstMaskedPut) == kInstMaskedPut;
 
-	if (inst->_flags & kInstMaskedPut) {
-		uint16 z = _gfx->queryMask(y);
-		_gfx->blitCnv(&v18, x, y, z, Gfx::kBitBack);
-		_gfx->blitCnv(&v18, x, y, z, Gfx::kBit2);
-	} else {
-		_gfx->flatBlitCnv(&v18, x, y, Gfx::kBitBack);
-		_gfx->flatBlitCnv(&v18, x, y, Gfx::kBit2);
-	}
+	_gfx->patchBackground(v18, x, y, mask);
 }
 
 DECLARE_INSTRUCTION_OPCODE(null) {

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-12 08:31:36 UTC (rev 30440)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-12 10:46:51 UTC (rev 30441)
@@ -394,6 +394,19 @@
 	return;
 }
 
+void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
+
+	if (mask) {
+		uint16 z = queryMask(y);
+		blitCnv(&surf, x, y, z, kBitBack);
+		blitCnv(&surf, x, y, z, kBit2);
+	} else {
+		flatBlitCnv(&surf, x, y, kBitBack);
+		flatBlitCnv(&surf, x, y, kBit2);
+	}
+
+}
+
 void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
 
 	byte *d = (byte*)_buffers[buffer]->getBasePtr(r.left, r.top);

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-01-12 08:31:36 UTC (rev 30440)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-01-12 10:46:51 UTC (rev 30441)
@@ -274,6 +274,8 @@
 	void freeLabels();
 
 	// cut/paste
+	void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
+
 	void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y, Gfx::Buffers buffer);
 	void flatBlitCnv(Frames *cnv, uint16 frame, int16 x, int16 y, Gfx::Buffers buffer);
 	void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer);


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