Skip to content
Permalink
Browse files

Use icon width * sizeof(Uint32) instead of icon pitch when copying to…

… icon resource data
  • Loading branch information
slouken committed Jan 18, 2017
1 parent 5718293 commit 95defd662038feaa5c97d4f4ab2c9c2a9eba8c89
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/video/windows/SDL_windowswindow.c
@@ -409,7 +409,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
SDL_RWops *dst;

/* Create temporary bitmap buffer */
icon_len = 40 + icon->h * icon->w * 4;
icon_len = 40 + icon->h * icon->w * sizeof(Uint32);
icon_bmp = SDL_stack_alloc(BYTE, icon_len);
dst = SDL_RWFromMem(icon_bmp, icon_len);
if (!dst) {
@@ -424,7 +424,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
SDL_WriteLE16(dst, 1);
SDL_WriteLE16(dst, 32);
SDL_WriteLE32(dst, BI_RGB);
SDL_WriteLE32(dst, icon->h * icon->w * 4);
SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32));
SDL_WriteLE32(dst, 0);
SDL_WriteLE32(dst, 0);
SDL_WriteLE32(dst, 0);
@@ -435,7 +435,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
y = icon->h;
while (y--) {
Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch;
SDL_RWwrite(dst, src, icon->pitch, 1);
SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1);
}

hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);

0 comments on commit 95defd6

Please sign in to comment.