diff options
author | Nipun Garg | 2019-06-18 00:14:21 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:46 +0200 |
commit | e267210ec863a5e7c870e15eb4e72c71e72645f1 (patch) | |
tree | 654eecd7a14aedeb277766f0c18694f10cbfca12 | |
parent | 8bc38a67ee1aa60a8e7c4bc386fb20f31a7b869d (diff) | |
download | scummvm-rg350-e267210ec863a5e7c870e15eb4e72c71e72645f1.tar.gz scummvm-rg350-e267210ec863a5e7c870e15eb4e72c71e72645f1.tar.bz2 scummvm-rg350-e267210ec863a5e7c870e15eb4e72c71e72645f1.zip |
HDB: Clip before passing to copyRectToSurface
-rw-r--r-- | engines/hdb/draw-manager.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index 1a49b3050b..e0a4e7c36c 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -270,13 +270,21 @@ Graphics::Surface Picture::load(Common::SeekableReadStream *stream) { } void Picture::draw(int x, int y) { - g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h); + Common::Rect clip(_surface.getBounds()); + clip.clip(Common::Rect(0, 0, kScreenWidth - 1 - x, kScreenHeight - 1 - y)); + if (!clip.isEmpty()) { + g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, clip.width(), clip.height()); + } // g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h); } void Picture::drawMasked(int x, int y) { _surface.transBlitFrom(_surface, 0xf81f); - g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h); + Common::Rect clip(_surface.getBounds()); + clip.clip(Common::Rect(0, 0, kScreenWidth - 1 - x, kScreenHeight - 1 - y)); + if (!clip.isEmpty()) { + g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, clip.width(), clip.height()); + } // g_system->copyRectToScreen(tempSurf.getBasePtr(0, 0), tempSurf.pitch, x, y, tempSurf.w, tempSurf.h); } @@ -305,7 +313,11 @@ Graphics::Surface Tile::load(Common::SeekableReadStream *stream) { } void Tile::draw(int x, int y) { - g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h); + Common::Rect clip(_surface.getBounds()); + clip.clip(Common::Rect(0, 0, kScreenWidth - 1 - x, kScreenHeight - 1 - y)); + if (!clip.isEmpty()) { + g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, clip.width(), clip.height()); + } // g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h); } |