X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obrender%2Frender.c;h=fe9a2a80dd27669b8888b226ab0b62655e52b23a;hb=6c87b1dd703bb67d7c945dc846da9d17c9c72382;hp=20002e32773c3a25b19267724ff47372da64f33f;hpb=3bd4397b6ec5212bfe53a36892746962dc45dbeb;p=chaz%2Fopenbox diff --git a/obrender/render.c b/obrender/render.c index 20002e32..fe9a2a80 100644 --- a/obrender/render.c +++ b/obrender/render.c @@ -170,6 +170,8 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) } force_transfer = 1; break; + case RR_TEXTURE_NUM_TYPES: + g_assert_not_reached(); } } @@ -200,7 +202,7 @@ RrAppearance *RrAppearanceNew(const RrInstance *inst, gint numtex) { RrAppearance *out; - out = g_new0(RrAppearance, 1); + out = g_slice_new0(RrAppearance); out->inst = inst; out->textures = numtex; out->surface.bevel_light_adjust = 128; @@ -229,10 +231,12 @@ void RrAppearanceClearTextures(RrAppearance *a) memset(a->texture, 0, a->textures * sizeof(RrTexture)); } +/* deep copy of orig, means reset ref to 1 on copy + * and copy each thing memwise. */ RrAppearance *RrAppearanceCopy(RrAppearance *orig) { RrSurface *spo, *spc; - RrAppearance *copy = g_new(RrAppearance, 1); + RrAppearance *copy = g_slice_new(RrAppearance); copy->inst = orig->inst; @@ -314,6 +318,7 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig) return copy; } +/* now decrements ref counter, and frees only if ref <= 0 */ void RrAppearanceFree(RrAppearance *a) { if (a) { @@ -333,7 +338,7 @@ void RrAppearanceFree(RrAppearance *a) RrColorFree(p->split_secondary); g_free(p->pixel_data); p->pixel_data = NULL; - g_free(a); + g_slice_free(RrAppearance, a); } } @@ -377,6 +382,8 @@ void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b) case RR_BEVEL_2: *l = *t = *r = *b = 2; break; + case RR_BEVEL_NUM_TYPES: + g_assert_not_reached(); } } else if (a->surface.border) { *l = *t = *r = *b = 1; @@ -414,7 +421,7 @@ gint RrMinWidth(RrAppearance *a) a->texture[i].data.text.flow, a->texture[i].data.text.maxwidth); w = MAX(w, m->width); - g_free(m); + g_slice_free(RrSize, m); break; case RR_TEXTURE_RGBA: w += MAX(w, a->texture[i].data.rgba.width); @@ -426,6 +433,8 @@ gint RrMinWidth(RrAppearance *a) w = MAX(w, MAX(a->texture[i].data.lineart.x1 - l - r, a->texture[i].data.lineart.x2 - l - r)); break; + case RR_TEXTURE_NUM_TYPES: + g_assert_not_reached(); } } @@ -463,7 +472,7 @@ gint RrMinHeight(RrAppearance *a) a->texture[i].data.text.flow, a->texture[i].data.text.maxwidth); h += MAX(h, m->height); - g_free(m); + g_slice_free(RrSize, m); } else h += MAX(h, @@ -481,6 +490,8 @@ gint RrMinHeight(RrAppearance *a) h = MAX(h, MAX(a->texture[i].data.lineart.y1 - t - b, a->texture[i].data.lineart.y2 - t - b)); break; + case RR_TEXTURE_NUM_TYPES: + g_assert_not_reached(); } }