From 22866bd7db3d2b80b8d320c2617768c5df1b665a Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Thu, 29 Jan 2015 23:17:21 +0100 Subject: [PATCH] Some cleanup --- src/tuxpaint.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 28945f01b..a689dba47 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -877,7 +877,6 @@ static void SDL_WarpMouse(Uint16 x, Uint16 y) static SDL_Surface *SDL_DisplayFormat(SDL_Surface *surface) { SDL_Surface *tmp; - // tmp = SDL_ConvertSurfaceFormat(surface, window_format, 0); tmp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGB888, 0); return(tmp); } @@ -12461,7 +12460,9 @@ static void cleanup(void) #endif - + SDL_DestroyTexture(texture); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window_screen); /* Close up! */ @@ -23383,20 +23384,20 @@ static void setup(void) WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_HWSURFACE); printf("3\n"); - if (window_screen == NULL) - printf("window_screen = NULL 3\n"); + if (window_screen == NULL) + printf("window_screen = NULL 3\n"); #else - window_screen = SDL_CreateWindow("Tux Paint", + window_screen = SDL_CreateWindow("Tux Paint", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, NULL); - /* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, + /* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, s VIDEO_BPP, SDL_SWSURFACE);*/ printf("4\n"); - if (window_screen == NULL) - printf("window_screen = NULL 4\n"); + if (window_screen == NULL) + printf("window_screen = NULL 4\n"); #endif @@ -23428,16 +23429,17 @@ VIDEO_BPP, SDL_SWSURFACE);*/ - if (screen == NULL) - { - fprintf(stderr, - "\nError: 1 I could not open the display.\n" - "The Simple DirectMedia Layer error that occurred was:\n" - "%s\n\n", SDL_GetError()); + if (screen == NULL) + { + fprintf(stderr, + "\nError: 1 I could not open the display.\n" + "The Simple DirectMedia Layer error that occurred was:\n" + "%s\n\n", SDL_GetError()); - cleanup(); - exit(1); - }} + cleanup(); + exit(1); + } + } SDL_RenderSetLogicalSize(renderer, WINDOW_WIDTH, WINDOW_HEIGHT); @@ -24043,7 +24045,7 @@ VIDEO_BPP, SDL_SWSURFACE);*/ cleanup(); exit(1); } - // SDL_SetSurfaceAlphaMod(img_color_btns[i], SDL_ALPHA_TRANSPARENT); + SDL_LockSurface(img_color_btns[i]); }