aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-28 11:57:16 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-28 11:57:16 +0000
commit80923cb5d0fb7b286c5a0760d3eb06bd63e779ed (patch)
tree716d409c24f3f37b47fd5493b1213695077aef8b /code
parent0bf2926b4fd2b19ea9c46f25d38a103f568915c4 (diff)
downloadioquake3-aero-80923cb5d0fb7b286c5a0760d3eb06bd63e779ed.tar.gz
ioquake3-aero-80923cb5d0fb7b286c5a0760d3eb06bd63e779ed.zip
* Avoid calculating a NaN when failing to compute the display aspect ratio
git-svn-id: svn://svn.icculus.org/quake3/trunk@1636 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/sdl/sdl_glimp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index 82f6e22..2ed73ea 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -239,12 +239,20 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
sVideoInfo.vfmt = &sPixelFormat;
videoInfo = &sVideoInfo;
- // Guess the display aspect ratio through the desktop resolution
- // 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;
+ if( videoInfo->current_h > 0 )
+ {
+ // Guess the display aspect ratio through the desktop resolution
+ // 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