src/video/x11/SDL_x11render.c
changeset 2967 e4a469d6ddab
parent 2927 2133d2d300fd
child 3044 b36579172f27
--- a/src/video/x11/SDL_x11render.c	Fri Jan 02 16:38:31 2009 +0000
+++ b/src/video/x11/SDL_x11render.c	Fri Jan 02 17:39:48 2009 +0000
@@ -87,7 +87,7 @@
     Pixmap pixmaps[3];
     int current_pixmap;
     Drawable drawable;
-    SDL_PixelFormat *format;
+    SDL_PixelFormat format;
     GC gc;
     SDL_DirtyRectList dirty;
     SDL_bool makedirty;
@@ -251,11 +251,7 @@
         X11_DestroyRenderer(renderer);
         return NULL;
     }
-    data->format = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
-    if (!data->format) {
-        X11_DestroyRenderer(renderer);
-        return NULL;
-    }
+    SDL_InitFormat(&data->format, bpp, Rmask, Gmask, Bmask, Amask);
 
     /* Create the drawing context */
     gcv.graphics_exposures = False;
@@ -583,11 +579,11 @@
     Uint8 b = renderer->b;
     Uint8 a = renderer->a;
     if (premult)
-        return SDL_MapRGBA(data->format, ((int) r * (int) a) / 255,
+        return SDL_MapRGBA(&data->format, ((int) r * (int) a) / 255,
                            ((int) g * (int) a) / 255,
                            ((int) b * (int) a) / 255, 255);
     else
-        return SDL_MapRGBA(data->format, r, g, b, a);
+        return SDL_MapRGBA(&data->format, r, g, b, a);
 }
 
 static int
@@ -852,9 +848,6 @@
                 XFreePixmap(data->display, data->pixmaps[i]);
             }
         }
-        if (data->format) {
-            SDL_FreeFormat(data->format);
-        }
         if (data->gc) {
             XFreeGC(data->display, data->gc);
         }