comparison src/video/win32/SDL_win32window.c @ 2990:502adab079a4

indent
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2009 17:14:27 +0000
parents a3012c6652ff
children 9acb9f0f7f0d
comparison
equal deleted inserted replaced
2989:aba5a5cc2e63 2990:502adab079a4
316 WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 316 WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
317 { 317 {
318 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; 318 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
319 HICON hicon = NULL; 319 HICON hicon = NULL;
320 320
321 if(icon) { 321 if (icon) {
322 BYTE *icon_bmp; 322 BYTE *icon_bmp;
323 int icon_len; 323 int icon_len;
324 SDL_RWops *dst; 324 SDL_RWops *dst;
325 SDL_PixelFormat format; 325 SDL_PixelFormat format;
326 SDL_Surface *surface; 326 SDL_Surface *surface;
335 } 335 }
336 336
337 /* Write the BITMAPINFO header */ 337 /* Write the BITMAPINFO header */
338 SDL_WriteLE32(dst, 40); 338 SDL_WriteLE32(dst, 40);
339 SDL_WriteLE32(dst, icon->w); 339 SDL_WriteLE32(dst, icon->w);
340 SDL_WriteLE32(dst, icon->h*2); 340 SDL_WriteLE32(dst, icon->h * 2);
341 SDL_WriteLE16(dst, 1); 341 SDL_WriteLE16(dst, 1);
342 SDL_WriteLE16(dst, 32); 342 SDL_WriteLE16(dst, 32);
343 SDL_WriteLE32(dst, BI_RGB); 343 SDL_WriteLE32(dst, BI_RGB);
344 SDL_WriteLE32(dst, icon->h * icon->w * 4); 344 SDL_WriteLE32(dst, icon->h * icon->w * 4);
345 SDL_WriteLE32(dst, 0); 345 SDL_WriteLE32(dst, 0);
353 surface = SDL_ConvertSurface(icon, &format, 0); 353 surface = SDL_ConvertSurface(icon, &format, 0);
354 if (surface) { 354 if (surface) {
355 /* Write the pixels upside down into the bitmap buffer */ 355 /* Write the pixels upside down into the bitmap buffer */
356 int y = surface->h; 356 int y = surface->h;
357 while (y--) { 357 while (y--) {
358 Uint8 *src = (Uint8 *)surface->pixels + y * surface->pitch; 358 Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch;
359 SDL_RWwrite(dst, src, surface->pitch, 1); 359 SDL_RWwrite(dst, src, surface->pitch, 1);
360 } 360 }
361 SDL_FreeSurface(surface); 361 SDL_FreeSurface(surface);
362 362
363 hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); 363 hicon =
364 CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
364 } 365 }
365 SDL_RWclose(dst); 366 SDL_RWclose(dst);
366 SDL_stack_free(icon_bmp); 367 SDL_stack_free(icon_bmp);
367 } 368 }
368 369
369 /* Set the icon for the window */ 370 /* Set the icon for the window */
370 SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon); 371 SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
371 372
372 /* Set the icon in the task manager (should we do this?) */ 373 /* Set the icon in the task manager (should we do this?) */
373 SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon); 374 SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
374 } 375 }
375 376
376 void 377 void
377 WIN_SetWindowPosition(_THIS, SDL_Window * window) 378 WIN_SetWindowPosition(_THIS, SDL_Window * window)
378 { 379 {