X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Frender.c;h=4735ec51a948a385a1d6116ecfcc474b9dddc938;hb=a9567a816385f8f66ed0f827bb4af78cdb10cd6d;hp=7be3993e1cda2e6188a88e60ef2280d2fce2c911;hpb=3a26c8aa8ec1441d28f9f771d4ce4a318ec05147;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index 7be3993e..4735ec51 100644 --- a/render/render.c +++ b/render/render.c @@ -15,8 +15,8 @@ # include #endif -static void RrPixel32_to_pixmap(RrAppearance *l, - gint x, gint y, gint w, gint h); +static void pixel_data_to_pixmap(RrAppearance *l, + gint x, gint y, gint w, gint h); void RrPaint(RrAppearance *l, Window win, gint w, gint h) { @@ -89,7 +89,7 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h) if (!transferred) { transferred = 1; if (l->surface.grad != RR_SURFACE_SOLID) - RrPixel32_to_pixmap(l, 0, 0, w, h); + pixel_data_to_pixmap(l, 0, 0, w, h); } if (l->xftdraw == NULL) { l->xftdraw = XftDrawCreate(RrDisplay(l->inst), l->pixmap, @@ -102,7 +102,7 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h) if (!transferred) { transferred = 1; if (l->surface.grad != RR_SURFACE_SOLID) - RrPixel32_to_pixmap(l, 0, 0, w, h); + pixel_data_to_pixmap(l, 0, 0, w, h); } if (l->texture[i].data.mask.color->gc == None) RrColorAllocateGC(l->texture[i].data.mask.color); @@ -118,7 +118,7 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h) if (!transferred) { transferred = 1; if (l->surface.grad != RR_SURFACE_SOLID) - RrPixel32_to_pixmap(l, 0, 0, w, h); + pixel_data_to_pixmap(l, 0, 0, w, h); } @@ -143,6 +143,7 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig) { RrSurface *spo, *spc; RrAppearance *copy = g_new(RrAppearance, 1); + gint i; copy->inst = orig->inst; @@ -195,6 +196,11 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig) copy->textures = orig->textures; copy->texture = g_memdup(orig->texture, orig->textures * sizeof(RrTexture)); + for (i = 0; i < copy->textures; ++i) + if (copy->texture[i].type == RR_TEXTURE_RGBA) { + g_free(copy->texture[i].data.rgba.cache); + copy->texture[i].data.rgba.cache = NULL; + } copy->pixmap = None; copy->xftdraw = NULL; copy->w = copy->h = 0; @@ -203,10 +209,17 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig) void RrAppearanceFree(RrAppearance *a) { + gint i; + if (a) { RrSurface *p; if (a->pixmap != None) XFreePixmap(RrDisplay(a->inst), a->pixmap); if (a->xftdraw != NULL) XftDrawDestroy(a->xftdraw); + for (i = 0; i < a->textures; ++i) + if (a->texture[i].type == RR_TEXTURE_RGBA) { + g_free(a->texture[i].data.rgba.cache); + a->texture[i].data.rgba.cache = NULL; + } if (a->textures) g_free(a->texture); p = &a->surface; @@ -222,7 +235,8 @@ void RrAppearanceFree(RrAppearance *a) } -static void RrPixel32_to_pixmap(RrAppearance *l, gint x, gint y, gint w, gint h) +static void pixel_data_to_pixmap(RrAppearance *l, + gint x, gint y, gint w, gint h) { RrPixel32 *in, *scratch; Pixmap out;