aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-07-04 01:18:49 +0000
committerJohannes Schickel2010-07-04 01:18:49 +0000
commit052d2ab6f17e6ec239f368ee802a659be46098cc (patch)
tree5a412b61ea3128dd4150fa4dfd0b10d899973b00 /gui/widget.cpp
parent336cde4b61df758dd438c9633863d50f5442037c (diff)
downloadscummvm-rg350-052d2ab6f17e6ec239f368ee802a659be46098cc.tar.gz
scummvm-rg350-052d2ab6f17e6ec239f368ee802a659be46098cc.tar.bz2
scummvm-rg350-052d2ab6f17e6ec239f368ee802a659be46098cc.zip
Prevent GraphicsWidget from being assigned a surface which wouldn't fit in the widget.
svn-id: r50641
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 9297cce344..14cb61006b 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -583,6 +583,11 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) {
if (!gfx || !gfx->pixels)
return;
+ if (gfx->w > _w || gfx->h > _h) {
+ warning("GraphicsWidget has size %dx%d, but a surface with %dx%d is to be set", _w, _h, gfx->w, gfx->h);
+ return;
+ }
+
// TODO: add conversion to OverlayColor
_gfx.copyFrom(*gfx);
}