save some malloc when possible
Dana Jansens danakj@orodu.net
1 files changed,
5 insertions(+),
3 deletions(-)
jump to
M
render/render.c
→
render/render.c
@@ -42,7 +42,7 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
{ gint i, transferred = 0, sw, sh, partial_w, partial_h; RrPixel32 *source, *dest; - Pixmap oldp; + Pixmap oldp = None; RrRect tarea; /* area in which to draw textures */ gboolean resized;@@ -77,8 +77,10 @@ a->xftdraw = XftDrawCreate(RrDisplay(a->inst), a->pixmap,
RrVisual(a->inst), RrColormap(a->inst)); g_assert(a->xftdraw != NULL); - g_free(a->surface.pixel_data); - a->surface.pixel_data = g_new(RrPixel32, w * h); + if (resized) { + g_free(a->surface.pixel_data); + a->surface.pixel_data = g_new(RrPixel32, w * h); + } if (a->surface.grad == RR_SURFACE_PARENTREL) { g_assert (a->surface.parent);