Revert "Patch:graphics/sdl:use g_alloca for temporary allocations|That's much cheaper...
authornorad <norad@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 11 Feb 2011 17:57:55 +0000 (17:57 +0000)
committernorad <norad@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 11 Feb 2011 17:57:55 +0000 (17:57 +0000)
This reverts commit 42bdd07e990b489637caa82eb1196b2420ef4366.

git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4131 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/graphics/sdl/graphics_sdl.c

index 58cc562..af0ecfa 100644 (file)
@@ -986,7 +986,7 @@ display_text_draw(struct font_freetype_text *text,
        if (g->w && g->h && bg) {
            stride = (g->w + 2) * 4;
            if (color) {
-               shadow = g_alloca(stride * (g->h + 2));
+               shadow = g_malloc(stride * (g->h + 2));
                gr->freetype_methods.get_shadow(g, shadow, 32, stride, &white, &transparent);
 
                SDL_Surface *glyph_surface =
@@ -1004,6 +1004,7 @@ display_text_draw(struct font_freetype_text *text,
                    SDL_BlitSurface(glyph_surface, NULL, gr->screen, &r);
                    SDL_FreeSurface(glyph_surface);
                }
+               g_free(shadow);
            }
        }
        x += g->dx;
@@ -1020,7 +1021,7 @@ display_text_draw(struct font_freetype_text *text,
            if (color) {
                stride = g->w;
                if (bg) {
-                   glyph = g_alloca(stride * g->h * 4);
+                   glyph = g_malloc(stride * g->h * 4);
                    gr->freetype_methods.get_glyph(g, glyph, 32,
                                                   stride * 4, &black,
                                                   &white, &transparent);
@@ -1038,9 +1039,10 @@ display_text_draw(struct font_freetype_text *text,
                        SDL_BlitSurface(glyph_surface, NULL, gr->screen,&r);
                        SDL_FreeSurface(glyph_surface);
                    }
+                   g_free(glyph);
                }
                stride *= 4;
-               glyph = g_alloca(stride * g->h);
+               glyph = g_malloc(stride * g->h);
                gr->freetype_methods.get_glyph(g, glyph, 32, stride,
                                               &black, &white,
                                               &transparent);
@@ -1061,6 +1063,7 @@ display_text_draw(struct font_freetype_text *text,
                         pGlyph += 4;
                    }
                }
+               g_free(glyph);
            }
        }
        x += g->dx;