* Avoid calculating a NaN when failing to compute the display aspect ratio
This commit is contained in:
parent
a7d33b1c54
commit
0ba8b20305
1 changed files with 13 additions and 5 deletions
|
@ -239,12 +239,20 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
|
||||||
sVideoInfo.vfmt = &sPixelFormat;
|
sVideoInfo.vfmt = &sPixelFormat;
|
||||||
videoInfo = &sVideoInfo;
|
videoInfo = &sVideoInfo;
|
||||||
|
|
||||||
// Guess the display aspect ratio through the desktop resolution
|
if( videoInfo->current_h > 0 )
|
||||||
// by assuming (relatively safely) that it is set at or close to
|
{
|
||||||
// the display's native aspect ratio
|
// Guess the display aspect ratio through the desktop resolution
|
||||||
displayAspect = (float)videoInfo->current_w / (float)videoInfo->current_h;
|
// by assuming (relatively safely) that it is set at or close to
|
||||||
|
// the display's native aspect ratio
|
||||||
|
displayAspect = (float)videoInfo->current_w / (float)videoInfo->current_h;
|
||||||
|
|
||||||
ri.Printf( PRINT_ALL, "Estimated display aspect: %.3f\n", displayAspect );
|
ri.Printf( PRINT_ALL, "Estimated display aspect: %.3f\n", displayAspect );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ri.Printf( PRINT_ALL,
|
||||||
|
"Cannot estimate display aspect, assuming 1.333f\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue