src/video/SDL_video.c
changeset 2967 e4a469d6ddab
parent 2934 1fcc36adc73d
child 2984 0b160c970b7e
--- a/src/video/SDL_video.c	Fri Jan 02 16:38:31 2009 +0000
+++ b/src/video/SDL_video.c	Fri Jan 02 17:39:48 2009 +0000
@@ -966,6 +966,19 @@
 }
 
 void
+SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface * icon)
+{
+    SDL_Window *window = SDL_GetWindowFromID(windowID);
+
+    if (!window) {
+        return;
+    }
+    if (_this->SetWindowIcon) {
+        _this->SetWindowIcon(_this, window, icon);
+    }
+}
+
+void
 SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
 {
     SDL_Window *window = SDL_GetWindowFromID(windowID);
@@ -1590,33 +1603,30 @@
                               surface->pitch);
         }
     } else {
-        SDL_PixelFormat *dst_fmt;
+        SDL_PixelFormat dst_fmt;
         SDL_Surface *dst = NULL;
 
         /* Set up a destination surface for the texture update */
-        dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
-        if (dst_fmt) {
-            if (SDL_ISPIXELFORMAT_INDEXED(format)) {
-                dst_fmt->palette =
-                    SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
-                if (dst_fmt->palette) {
-                    /*
-                     * FIXME: Should we try to copy
-                     * fmt->palette?
-                     */
-                    SDL_DitherColors(dst_fmt->palette->colors,
-                                     SDL_BITSPERPIXEL(format));
-                }
+        SDL_InitFormat(&dst_fmt, bpp, Rmask, Gmask, Bmask, Amask);
+        if (SDL_ISPIXELFORMAT_INDEXED(format)) {
+            dst_fmt.palette =
+                SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
+            if (dst_fmt.palette) {
+                /*
+                 * FIXME: Should we try to copy
+                 * fmt->palette?
+                 */
+                SDL_DitherColors(dst_fmt.palette->colors,
+                                 SDL_BITSPERPIXEL(format));
             }
-            dst = SDL_ConvertSurface(surface, dst_fmt, 0);
-            if (dst) {
-                SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
-                SDL_FreeSurface(dst);
-            }
-            if (dst_fmt->palette) {
-                SDL_FreePalette(dst_fmt->palette);
-            }
-            SDL_FreeFormat(dst_fmt);
+        }
+        dst = SDL_ConvertSurface(surface, &dst_fmt, 0);
+        if (dst) {
+            SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
+            SDL_FreeSurface(dst);
+        }
+        if (dst_fmt.palette) {
+            SDL_FreePalette(dst_fmt.palette);
         }
         if (!dst) {
             SDL_DestroyTexture(textureID);