diff options
author | Torbjörn Andersson | 2005-12-20 08:56:48 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-12-20 08:56:48 +0000 |
commit | 53f13b76e41298536145b9e511c2938cc1bc1eb0 (patch) | |
tree | b082db000f37ccf42388e8018b5d8f0b0bea23f3 /sword2 | |
parent | 1b77cac78672aa9a31f997b01de4f91e89b15a9f (diff) | |
download | scummvm-rg350-53f13b76e41298536145b9e511c2938cc1bc1eb0.tar.gz scummvm-rg350-53f13b76e41298536145b9e511c2938cc1bc1eb0.tar.bz2 scummvm-rg350-53f13b76e41298536145b9e511c2938cc1bc1eb0.zip |
If drawSurface() is called with no clip rect, clip to the screen size. This
prevents the subtitles-only cutscenes fallback from drawing outside the
screen.
svn-id: r19813
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/sprite.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp index d1b9a6083c..b2be1dbaaa 100644 --- a/sword2/driver/sprite.cpp +++ b/sword2/driver/sprite.cpp @@ -286,29 +286,33 @@ void Screen::drawSurface(SpriteInfo *s, byte *surface, Common::Rect *clipRect) { rd.top = s->y; rd.bottom = rd.top + rs.bottom; - if (clipRect) { - if (clipRect->left > rd.left) { - rs.left += (clipRect->left - rd.left); - rd.left = clipRect->left; - } + Common::Rect defClipRect(0, 0, _screenWide, _screenDeep); - if (clipRect->top > rd.top) { - rs.top += (clipRect->top - rd.top); - rd.top = clipRect->top; - } + if (!clipRect) { + clipRect = &defClipRect; + } - if (clipRect->right < rd.right) { - rd.right = clipRect->right; - } + if (clipRect->left > rd.left) { + rs.left += (clipRect->left - rd.left); + rd.left = clipRect->left; + } - if (clipRect->bottom < rd.bottom) { - rd.bottom = clipRect->bottom; - } + if (clipRect->top > rd.top) { + rs.top += (clipRect->top - rd.top); + rd.top = clipRect->top; + } - if (rd.width() <= 0 || rd.height() <= 0) - return; + if (clipRect->right < rd.right) { + rd.right = clipRect->right; } + if (clipRect->bottom < rd.bottom) { + rd.bottom = clipRect->bottom; + } + + if (rd.width() <= 0 || rd.height() <= 0) + return; + src = surface + rs.top * s->w + rs.left; dst = _buffer + _screenWide * rd.top + rd.left; |