Skip to content
Permalink
Browse files

Video modes are sorted width first, then height

  • Loading branch information
slouken committed Nov 12, 2004
1 parent 4a73f77 commit d582fadc97d043656dde92362c3437de21f08b11
@@ -284,15 +284,15 @@ static int cmpmodes(const void *va, const void *vb)
/* Prefer DirectColor visuals for otherwise equal modes */
if ( (a->viewportWidth == b->viewportWidth) &&
(b->viewportHeight == a->viewportHeight) ) {
if ( a->visualClass == DirectColor )
return -1;
if ( b->visualClass == DirectColor )
return 1;
return 0;
} else {
if(a->viewportWidth > b->viewportWidth)
if ( a->visualClass == DirectColor )
return -1;
if ( b->visualClass == DirectColor )
return 1;
return 0;
} else if ( a->viewportWidth == b->viewportWidth ) {
return b->viewportHeight - a->viewportHeight;
} else {
return b->viewportWidth - a->viewportWidth;
}
}
static void UpdateHWInfo(_THIS, SDL_NAME(XDGAMode) *mode)
@@ -38,34 +38,26 @@ SDL_Rect* SDL_modearray[PH_MAX_VIDEOMODES];

static int compare_modes_by_res(const void* mode1, const void* mode2)
{
if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode_info) < 0)
PgVideoModeInfo_t mode1_info;
PgVideoModeInfo_t mode2_info;

if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode1_info) < 0)
{
return 0;
}

key1 = mode_info.width * mode_info.height;

if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode_info) < 0)
if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode2_info) < 0)
{
return 0;
}

key2 = mode_info.width * mode_info.height;

if (key1 > key2)
if (mode1_info.width == mode2_info.width)
{
return 1;
return mode2_info.height - mode1_info.height;
}
else
{
if (key1 == key2)
{
return 0;
}
else
{
return -1;
}
return mode2_info.width - mode1_info.width;
}
}

@@ -381,9 +381,10 @@ static int cmpmodes(const void *va, const void *vb)
{
SDL_Rect *a = *(SDL_Rect **)va;
SDL_Rect *b = *(SDL_Rect **)vb;
if(a->w > b->w)
return -1;
return b->h - a->h;
if(a->w == b->w)
return b->h - a->h;
else
return b->w - a->w;
}

static int FULLSCREEN_AddMode(_THIS, int bpp, int w, int h)
@@ -201,9 +201,10 @@ static int cmpmodes(const void *va, const void *vb)
{
SDL_Rect *a = *(SDL_Rect **)va;
SDL_Rect *b = *(SDL_Rect **)vb;
if(a->w > b->w)
return -1;
return b->h - a->h;
if ( a->w == b->w )
return b->h - a->h;
else
return b->w - a->w;
}

static int DIB_AddMode(_THIS, int bpp, int w, int h)
@@ -85,9 +85,10 @@ static int cmpmodes(const void *va, const void *vb)
{
const SDL_NAME(XF86VidModeModeInfo) *a = *(const SDL_NAME(XF86VidModeModeInfo)**)va;
const SDL_NAME(XF86VidModeModeInfo) *b = *(const SDL_NAME(XF86VidModeModeInfo)**)vb;
if( (a->vdisplay > b->vdisplay) && (a->hdisplay >= b->hdisplay) )
return -1;
return b->hdisplay - a->hdisplay;
if ( a->hdisplay == b->hdisplay )
return b->vdisplay - a->vdisplay;
else
return b->hdisplay - a->hdisplay;
}
#endif

0 comments on commit d582fad

Please sign in to comment.