xcol.green = (g << 8) | g;
xcol.blue = (b << 8) | b;
if (XAllocColor(RrDisplay(inst), RrColormap(inst), &xcol)) {
- out = g_new(RrColor, 1);
+ out = g_slice_new(RrColor);
out->inst = inst;
out->r = xcol.red >> 8;
out->g = xcol.green >> 8;
return out;
}
+RrColor *RrColorCopy(RrColor* c)
+{
+ return RrColorNew(c->inst, c->r, c->g, c->b);
+}
+
void RrColorFree(RrColor *c)
{
if (c) {
if (c->pixel) XFreeColors(RrDisplay(c->inst), RrColormap(c->inst),
&c->pixel, 1, 0);
if (c->gc) XFreeGC(RrDisplay(c->inst), c->gc);
- g_free(c);
+ g_slice_free(RrColor, c);
}
}
}