mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-27 06:13:01 +00:00
* Fix to GLimp_DetectAvailableModes not sorting the first returned mode
This commit is contained in:
parent
eee9770fbf
commit
568cf2732a
1 changed files with 10 additions and 10 deletions
|
@ -117,8 +117,12 @@ static int GLimp_CompareModes( const void *a, const void *b )
|
||||||
const float ASPECT_EPSILON = 0.001f;
|
const float ASPECT_EPSILON = 0.001f;
|
||||||
SDL_Rect *modeA = *(SDL_Rect **)a;
|
SDL_Rect *modeA = *(SDL_Rect **)a;
|
||||||
SDL_Rect *modeB = *(SDL_Rect **)b;
|
SDL_Rect *modeB = *(SDL_Rect **)b;
|
||||||
float aspectDiffA = fabs( ( (float)modeA->w / (float)modeA->h ) - displayAspect );
|
float aspectA = (float)modeA->w / (float)modeA->h;
|
||||||
float aspectDiffB = fabs( ( (float)modeB->w / (float)modeB->h ) - displayAspect );
|
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;
|
float aspectDiffsDiff = aspectDiffA - aspectDiffB;
|
||||||
|
|
||||||
if( aspectDiffsDiff > ASPECT_EPSILON )
|
if( aspectDiffsDiff > ASPECT_EPSILON )
|
||||||
|
@ -126,14 +130,10 @@ static int GLimp_CompareModes( const void *a, const void *b )
|
||||||
else if( aspectDiffsDiff < -ASPECT_EPSILON )
|
else if( aspectDiffsDiff < -ASPECT_EPSILON )
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
{
|
return areaA - areaB;
|
||||||
if( modeA->w == modeB->w )
|
|
||||||
return modeA->h - modeB->h;
|
|
||||||
else
|
|
||||||
return modeA->w - modeB->w;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
GLimp_DetectAvailableModes
|
GLimp_DetectAvailableModes
|
||||||
|
@ -163,7 +163,7 @@ static void GLimp_DetectAvailableModes(void)
|
||||||
for( numModes = 0; modes[ numModes ]; numModes++ );
|
for( numModes = 0; modes[ numModes ]; numModes++ );
|
||||||
|
|
||||||
if( numModes > 1 )
|
if( numModes > 1 )
|
||||||
qsort( modes+1, numModes-1, sizeof( SDL_Rect* ), GLimp_CompareModes );
|
qsort( modes, numModes, sizeof( SDL_Rect* ), GLimp_CompareModes );
|
||||||
|
|
||||||
for( i = 0; i < numModes; i++ )
|
for( i = 0; i < numModes; i++ )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue