diff src/video/photon/SDL_ph_modes.c @ 966:f72cc0c7305f

Video modes are sorted width first, then height
author Sam Lantinga <slouken@libsdl.org>
date Fri, 12 Nov 2004 21:25:42 +0000
parents 4ab6d1fd028f
children c07c6ef7c93e
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_modes.c	Fri Nov 12 21:24:46 2004 +0000
+++ b/src/video/photon/SDL_ph_modes.c	Fri Nov 12 21:25:42 2004 +0000
@@ -38,34 +38,26 @@
 
 static int compare_modes_by_res(const void* mode1, const void* mode2)
 {
-    if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode_info) < 0)
-    {
-        return 0;
-    }
+    PgVideoModeInfo_t mode1_info;
+    PgVideoModeInfo_t mode2_info;
 
-    key1 = mode_info.width * mode_info.height;
-
-    if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode_info) < 0)
+    if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode1_info) < 0)
     {
         return 0;
     }
 
-    key2 = mode_info.width * mode_info.height;
+    if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode2_info) < 0)
+    {
+        return 0;
+    }
 
-    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;
     }
 }