Prevent GraphicsWidget from being assigned a surface which wouldn't fit in the widget.

svn-id: r50641
This commit is contained in:
Johannes Schickel 2010-07-04 01:18:49 +00:00
parent 336cde4b61
commit 052d2ab6f1

View File

@ -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);
}