[quake3-commits] r1636 - trunk/code/sdl
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Sep 28 07:57:16 EDT 2009
Author: tma
Date: 2009-09-28 07:57:16 -0400 (Mon, 28 Sep 2009)
New Revision: 1636
Modified:
trunk/code/sdl/sdl_glimp.c
Log:
* Avoid calculating a NaN when failing to compute the display aspect ratio
Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c 2009-09-21 00:20:43 UTC (rev 1635)
+++ trunk/code/sdl/sdl_glimp.c 2009-09-28 11:57:16 UTC (rev 1636)
@@ -239,12 +239,20 @@
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
More information about the quake3-commits
mailing list