diff src/video/win32/SDL_win32modes.c @ 1913:83420da906a5

Implemented Windows OpenGL support Fixed slowdown enumerating display modes, which was hosing OpenGL as well... Removed SDL_ from the render driver prefixes
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 Jul 2006 06:47:33 +0000
parents c121d94672cb
children a788656ca29a
line wrap: on
line diff
--- a/src/video/win32/SDL_win32modes.c	Sun Jul 16 09:34:01 2006 +0000
+++ b/src/video/win32/SDL_win32modes.c	Mon Jul 17 06:47:33 2006 +0000
@@ -24,10 +24,6 @@
 #include "SDL_win32video.h"
 
 
-/* FIXME: Each call to EnumDisplaySettings() takes about 6 ms on my laptop.
-          With 500 or so modes, this takes almost 3 seconds to run!
-*/
-
 static SDL_bool
 WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
 {
@@ -58,8 +54,8 @@
     mode->refresh_rate = devmode.dmDisplayFrequency;
     mode->driverdata = data;
 
-    hdc = CreateDC(deviceName, NULL, NULL, &devmode);
-    if (hdc) {
+    if (index == ENUM_CURRENT_SETTINGS
+        && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
         char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
         LPBITMAPINFO bmi;
         HBITMAP hbm;
@@ -92,6 +88,7 @@
             mode->format = SDL_PixelFormat_Index8;
         }
     } else {
+        /* FIXME: Can we tell what this will be? */
         switch (devmode.dmBitsPerPel) {
         case 32:
             mode->format = SDL_PixelFormat_RGB888;