[quake3-commits] r1733 - trunk/code/sdl
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Nov 5 15:29:26 EST 2009
Author: tma
Date: 2009-11-05 15:29:26 -0500 (Thu, 05 Nov 2009)
New Revision: 1733
Modified:
trunk/code/sdl/sdl_glimp.c
Log:
* Fix to GLimp_DetectAvailableModes not sorting the first returned mode
Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c 2009-11-05 20:20:23 UTC (rev 1732)
+++ trunk/code/sdl/sdl_glimp.c 2009-11-05 20:29:26 UTC (rev 1733)
@@ -117,8 +117,12 @@
const float ASPECT_EPSILON = 0.001f;
SDL_Rect *modeA = *(SDL_Rect **)a;
SDL_Rect *modeB = *(SDL_Rect **)b;
- float aspectDiffA = fabs( ( (float)modeA->w / (float)modeA->h ) - displayAspect );
- float aspectDiffB = fabs( ( (float)modeB->w / (float)modeB->h ) - displayAspect );
+ float aspectA = (float)modeA->w / (float)modeA->h;
+ float aspectB = (float)modeB->w / (float)modeB->h;
+ int areaA = modeA->w * modeA->h;
+ int areaB = modeB->w * modeB->h;
+ float aspectDiffA = fabs( aspectA - displayAspect );
+ float aspectDiffB = fabs( aspectB - displayAspect );
float aspectDiffsDiff = aspectDiffA - aspectDiffB;
if( aspectDiffsDiff > ASPECT_EPSILON )
@@ -126,14 +130,10 @@
else if( aspectDiffsDiff < -ASPECT_EPSILON )
return -1;
else
- {
- if( modeA->w == modeB->w )
- return modeA->h - modeB->h;
- else
- return modeA->w - modeB->w;
- }
+ return areaA - areaB;
}
+
/*
===============
GLimp_DetectAvailableModes
@@ -162,8 +162,8 @@
for( numModes = 0; modes[ numModes ]; numModes++ );
- if(numModes > 1)
- qsort( modes+1, numModes-1, sizeof( SDL_Rect* ), GLimp_CompareModes );
+ if( numModes > 1 )
+ qsort( modes, numModes, sizeof( SDL_Rect* ), GLimp_CompareModes );
for( i = 0; i < numModes; i++ )
{
More information about the quake3-commits
mailing list