}
force_transfer = 1;
break;
+ case RR_TEXTURE_NUM_TYPES:
+ g_assert_not_reached();
}
}
{
RrAppearance *out;
- out = g_new0(RrAppearance, 1);
+ out = g_slice_new0(RrAppearance);
out->inst = inst;
+ out->ref = 1;
out->textures = numtex;
out->surface.bevel_light_adjust = 128;
out->surface.bevel_dark_adjust = 64;
memset(a->texture, 0, a->textures * sizeof(RrTexture));
}
+/* shallow copy means up the ref count and return it */
+RrAppearance *RrAppearanceCopyShallow(RrAppearance *orig)
+{
+ orig->ref++;
+ return orig;
+}
+
+/* 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;
+ copy->ref = 1;
spo = &(orig->surface);
spc = &(copy->surface);
return copy;
}
+/* now decrements ref counter, and frees only if ref <= 0 */
void RrAppearanceFree(RrAppearance *a)
{
if (a) {
RrColorFree(p->split_secondary);
g_free(p->pixel_data);
p->pixel_data = NULL;
- g_free(a);
+ g_slice_free(RrAppearance, a);
}
}
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;
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);
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();
}
}
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,
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();
}
}