Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32modes.c @ 3175:e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Mon, 08 Jun 2009 21:00:52 +0000 |
parents | 7f684f249ec9 |
children | 51750b7a966f |
comparison
equal
deleted
inserted
replaced
3174:c8b9c6d27476 | 3175:e6c113f1ea43 |
---|---|
94 mode->format = SDL_PIXELFORMAT_RGB555; | 94 mode->format = SDL_PIXELFORMAT_RGB555; |
95 break; | 95 break; |
96 } | 96 } |
97 } else if (bmi->bmiHeader.biBitCount == 8) { | 97 } else if (bmi->bmiHeader.biBitCount == 8) { |
98 mode->format = SDL_PIXELFORMAT_INDEX8; | 98 mode->format = SDL_PIXELFORMAT_INDEX8; |
99 } else if (bmi->bmiHeader.biBitCount == 4) { | |
100 mode->format = SDL_PIXELFORMAT_INDEX4LSB; | |
99 } | 101 } |
100 } else | 102 } else |
101 #endif /* _WIN32_WCE */ | 103 #endif /* _WIN32_WCE */ |
102 { | 104 { |
103 | |
104 /* FIXME: Can we tell what this will be? */ | 105 /* FIXME: Can we tell what this will be? */ |
105 switch (devmode.dmBitsPerPel) { | 106 if ((devmode.dmFields & DM_BITSPERPEL)==DM_BITSPERPEL) { |
106 case 32: | 107 switch (devmode.dmBitsPerPel) { |
107 mode->format = SDL_PIXELFORMAT_RGB888; | 108 case 32: |
108 break; | 109 mode->format = SDL_PIXELFORMAT_RGB888; |
109 case 24: | 110 break; |
110 mode->format = SDL_PIXELFORMAT_RGB24; | 111 case 24: |
111 break; | 112 mode->format = SDL_PIXELFORMAT_RGB24; |
112 case 16: | 113 break; |
113 mode->format = SDL_PIXELFORMAT_RGB565; | 114 case 16: |
114 break; | 115 mode->format = SDL_PIXELFORMAT_RGB565; |
115 case 15: | 116 break; |
116 mode->format = SDL_PIXELFORMAT_RGB555; | 117 case 15: |
117 break; | 118 mode->format = SDL_PIXELFORMAT_RGB555; |
118 case 8: | 119 break; |
119 mode->format = SDL_PIXELFORMAT_INDEX8; | 120 case 8: |
120 break; | 121 mode->format = SDL_PIXELFORMAT_INDEX8; |
121 } | 122 break; |
123 case 4: | |
124 mode->format = SDL_PIXELFORMAT_INDEX4LSB; | |
125 break; | |
126 } | |
127 } | |
122 } | 128 } |
123 return SDL_TRUE; | 129 return SDL_TRUE; |
124 } | 130 } |
125 | 131 |
126 static SDL_bool | 132 static SDL_bool |
198 | 204 |
199 for (i = 0;; ++i) { | 205 for (i = 0;; ++i) { |
200 if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { | 206 if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { |
201 break; | 207 break; |
202 } | 208 } |
203 if (!SDL_AddDisplayMode(_this->current_display, &mode)) { | 209 if (mode.format != SDL_PIXELFORMAT_UNKNOWN) |
204 SDL_free(mode.driverdata); | 210 if (!SDL_AddDisplayMode(_this->current_display, &mode)) { |
211 SDL_free(mode.driverdata); | |
205 } | 212 } |
206 } | 213 } |
207 } | 214 } |
208 | 215 |
209 int | 216 int |