aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/draw-manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/hdb/draw-manager.cpp')
-rw-r--r--engines/hdb/draw-manager.cpp18
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);
}