Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Video modes are sorted width first, then height
  • Loading branch information
slouken committed Nov 12, 2004
1 parent 4a73f77 commit d582fad
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/video/dga/SDL_dgavideo.c
Expand Up @@ -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)
Expand Down
24 changes: 8 additions & 16 deletions src/video/photon/SDL_ph_modes.c
Expand Up @@ -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;
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/video/riscos/SDL_riscosFullScreenVideo.c
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/video/windib/SDL_dibvideo.c
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/video/x11/SDL_x11modes.c
Expand Up @@ -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

Expand Down

0 comments on commit d582fad

Please sign in to comment.