Fixed bug when requesting a videomode larger than the current maximum.

In such a case, the largest possible videomode should be used instead,
and not the smallest one.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1700 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-04-12 17:04:29 +00:00
parent 26f05f5642
commit 28580d3c18
1 changed files with 15 additions and 6 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.165 2009-02-06 23:53:34 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.166 2009-04-12 17:04:29 stephena Exp $
//============================================================================
#include <algorithm>
@ -1092,13 +1092,22 @@ void FrameBuffer::VideoModeList::set(const GraphicsMode& gfxmode)
}
// If we get here, then the gfx type couldn't be found, so we search
// for the first mode with the same zoomlevel
for(unsigned int i = 0; i < myModeList.size(); ++i)
// for the first mode with the same zoomlevel (making sure that the
// requested mode can fit inside the current screen)
if(gfxmode.zoom > myModeList[myModeList.size()-1].gfxmode.zoom)
{
if(myModeList[i].gfxmode.zoom == gfxmode.zoom)
myIdx = myModeList.size()-1;
return;
}
else
{
for(unsigned int i = 0; i < myModeList.size(); ++i)
{
myIdx = i;
return;
if(myModeList[i].gfxmode.zoom == gfxmode.zoom)
{
myIdx = i;
return;
}
}
}