diff options
| author | Joost Peters | 2005-09-04 01:44:14 +0000 | 
|---|---|---|
| committer | Joost Peters | 2005-09-04 01:44:14 +0000 | 
| commit | a3da7ea7c096e86d423dc5565a10b38e026f0203 (patch) | |
| tree | dd81fd9191da3d1439b52a818a540e761c3dff25 | |
| parent | cdc3d55be44424ff418cbc5b4b412a43096ab721 (diff) | |
| download | scummvm-rg350-a3da7ea7c096e86d423dc5565a10b38e026f0203.tar.gz scummvm-rg350-a3da7ea7c096e86d423dc5565a10b38e026f0203.tar.bz2 scummvm-rg350-a3da7ea7c096e86d423dc5565a10b38e026f0203.zip | |
Clip copyRectToScreen() coordinates.
Fixes bug #1281154, because FT likes to send negative values occasionally.
svn-id: r18763
| -rw-r--r-- | backends/psp/osys_psp_gu.cpp | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/backends/psp/osys_psp_gu.cpp b/backends/psp/osys_psp_gu.cpp index e5e63763ba..31b658af94 100644 --- a/backends/psp/osys_psp_gu.cpp +++ b/backends/psp/osys_psp_gu.cpp @@ -227,6 +227,31 @@ void OSystem_PSP_GU::setPalette(const byte *colors, uint start, uint num) {  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)  | 
