diff src/video/SDL_pixels.c @ 2967:e4a469d6ddab

Implemented SDL_SetWindowIcon(), with translucent icon support under X11.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 02 Jan 2009 17:39:48 +0000
parents 99210400e8b9
children 502adab079a4
line wrap: on
line diff
--- a/src/video/SDL_pixels.c	Fri Jan 02 16:38:31 2009 +0000
+++ b/src/video/SDL_pixels.c	Fri Jan 02 17:39:48 2009 +0000
@@ -347,16 +347,25 @@
                 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 {
     SDL_PixelFormat *format;
-    Uint32 mask;
 
     /* Allocate an empty pixel format structure */
-    format = SDL_calloc(1, sizeof(*format));
+    format = SDL_malloc(sizeof(*format));
     if (format == NULL) {
         SDL_OutOfMemory();
         return (NULL);
     }
 
     /* Set up the format */
+    return SDL_InitFormat(format, bpp, Rmask, Gmask, Bmask, Amask);
+}
+
+SDL_PixelFormat *
+SDL_InitFormat(SDL_PixelFormat *format, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
+{
+    Uint32 mask;
+
+    /* Set up the format */
+    SDL_zerop(format);
     format->BitsPerPixel = bpp;
     format->BytesPerPixel = (bpp + 7) / 8;
     if (Rmask || Bmask || Gmask) {      /* Packed pixels with custom mask */
@@ -426,7 +435,7 @@
     }
     format->palette = NULL;
 
-    return (format);
+    return format;
 }
 
 /*