[Scummvm-cvs-logs] CVS: scummvm/backends/psp osys_psp_gu.cpp,1.2,1.3

Joost Peters joostp at users.sourceforge.net
Sat Sep 3 18:45:08 CEST 2005


Update of /cvsroot/scummvm/scummvm/backends/psp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28766

Modified Files:
	osys_psp_gu.cpp 
Log Message:
Clip copyRectToScreen() coordinates.
Fixes bug #1281154, because FT likes to send negative values occasionally.



Index: osys_psp_gu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/psp/osys_psp_gu.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- osys_psp_gu.cpp	17 Aug 2005 10:19:39 -0000	1.2
+++ osys_psp_gu.cpp	4 Sep 2005 01:44:14 -0000	1.3
@@ -227,6 +227,31 @@
 
 void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) 
 {
+	//Clip the coordinates
+	if (x < 0) {
+		w += x;
+		buf -= x;
+		x = 0;
+	}
+
+	if (y < 0) {
+		h += y;
+		buf -= y * pitch;
+		y = 0;
+	}
+
+	if (w > _screenWidth - x) {
+		w = _screenWidth - x;
+	}
+
+	if (h > _screenHeight - y) {
+		h = _screenHeight - y;
+	}
+
+	if (w <= 0 || h <= 0)
+		return;
+
+	
 	byte *dst = _offscreen + y * _screenWidth + x;
 
 	if (_screenWidth == pitch && pitch == w) 





More information about the Scummvm-git-logs mailing list