comparison src/video/win32/SDL_gdirender.c @ 1924:69217fdd2c0a

If the OpenGL renderer is selected for a non-OpenGL window, recreate the window with OpenGL enabled. Added OpenGL renderer error checking. Use fast-path texture formats in the OpenGL renderer.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 22 Jul 2006 21:02:57 +0000
parents 8a162bfdc838
children a788656ca29a
comparison
equal deleted inserted replaced
1923:d4572b97b08f 1924:69217fdd2c0a
247 texture->driverdata = data; 247 texture->driverdata = data;
248 248
249 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { 249 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
250 data->yuv = SDL_SW_CreateYUVTexture(texture); 250 data->yuv = SDL_SW_CreateYUVTexture(texture);
251 if (!data->yuv) { 251 if (!data->yuv) {
252 GDI_DestroyTexture(renderer, texture);
253 return -1; 252 return -1;
254 } 253 }
255 data->format = display->current_mode.format; 254 data->format = display->current_mode.format;
256 } else { 255 } else {
257 data->format = texture->format; 256 data->format = texture->format;
264 LPBITMAPINFO bmi; 263 LPBITMAPINFO bmi;
265 264
266 bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); 265 bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD);
267 bmi = (LPBITMAPINFO) SDL_calloc(1, bmi_size); 266 bmi = (LPBITMAPINFO) SDL_calloc(1, bmi_size);
268 if (!bmi) { 267 if (!bmi) {
269 GDI_DestroyTexture(renderer, texture);
270 SDL_OutOfMemory(); 268 SDL_OutOfMemory();
271 return -1; 269 return -1;
272 } 270 }
273 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 271 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
274 bmi->bmiHeader.biWidth = texture->w; 272 bmi->bmiHeader.biWidth = texture->w;
289 palette = 287 palette =
290 (LOGPALETTE *) SDL_malloc(sizeof(*palette) + 288 (LOGPALETTE *) SDL_malloc(sizeof(*palette) +
291 ncolors * sizeof(PALETTEENTRY)); 289 ncolors * sizeof(PALETTEENTRY));
292 if (!palette) { 290 if (!palette) {
293 SDL_free(bmi); 291 SDL_free(bmi);
294 GDI_DestroyTexture(renderer, texture);
295 SDL_OutOfMemory(); 292 SDL_OutOfMemory();
296 return -1; 293 return -1;
297 } 294 }
298 palette->palVersion = 0x300; 295 palette->palVersion = 0x300;
299 palette->palNumEntries = ncolors; 296 palette->palNumEntries = ncolors;
325 CreateCompatibleBitmap(renderdata->window_hdc, texture->w, 322 CreateCompatibleBitmap(renderdata->window_hdc, texture->w,
326 texture->h); 323 texture->h);
327 data->pixels = NULL; 324 data->pixels = NULL;
328 } 325 }
329 if (!data->hbm) { 326 if (!data->hbm) {
330 GDI_DestroyTexture(renderer, texture);
331 WIN_SetError("Couldn't create bitmap"); 327 WIN_SetError("Couldn't create bitmap");
332 return -1; 328 return -1;
333 } 329 }
334 return 0; 330 return 0;
335 } 331 }