Committing patch #1578: Resolution problem fix.

Fixes bug #15773: in windowed resolution for 1024x600 monitors is
1024x768 if the video card supports it.
This commit is contained in:
Eric S. Raymond 2010-04-02 21:06:52 +00:00
parent a41288cd4a
commit 0e0b0fd70f
3 changed files with 17 additions and 4 deletions

View file

@ -82,7 +82,7 @@ bool detect_video_settings(CVideo& video, std::pair<int,int>& resolution, int& b
#endif
bpp = video.modePossible(resolution.first, resolution.second,
DefaultBPP, video_flags);
DefaultBPP, video_flags, true);
foreach (const res_t &res, res_list)
{

View file

@ -354,9 +354,22 @@ void CVideo::make_test_fake(const unsigned width,
}
int CVideo::modePossible( int x, int y, int bits_per_pixel, int flags )
int CVideo::modePossible( int x, int y, int bits_per_pixel, int flags, bool current_screen_optimal )
{
return SDL_VideoModeOK( x, y, bits_per_pixel, get_flags(flags) );
int bpp = SDL_VideoModeOK( x, y, bits_per_pixel, get_flags(flags) );
if(current_screen_optimal)
{
const SDL_VideoInfo* const video_info = SDL_GetVideoInfo();
/* if current video_info is smaller than the mode checking and the checked mode is supported
(meaning that probably the video card supports higher resolutions than the monitor)
that means that we just need to adjust the resolution and the bpp is ok
*/
if(bpp==0 && video_info->current_h<y && video_info->current_w<x){
return bits_per_pixel;
}
}
return bpp;
}
int CVideo::setMode( int x, int y, int bits_per_pixel, int flags )

View file

@ -47,7 +47,7 @@ class CVideo : private boost::noncopyable {
~CVideo();
int modePossible( int x, int y, int bits_per_pixel, int flags );
int modePossible( int x, int y, int bits_per_pixel, int flags ,bool current_screen_optimal=false);
int setMode( int x, int y, int bits_per_pixel, int flags );
//did the mode change, since the last call to the modeChanged() method?