char *file, *buf;
int buflen;
+ icon->surface = NULL;
+ icon->surface_width = 0;
+ icon->surface_height = 0;
+
status = xsvg_create (&icon->xsvg);
if (status)
return RR_STATUS_NO_MEMORY;
fprintf (stderr, "Error parsing built-in SVG icon for: %s\n", name);
return RR_STATUS_PARSE_ERROR;
}
-
- icon->surface = NULL;
-
return RR_STATUS_SUCCESS;
}
}
void
-grr_icon_draw (grr_icon_t *icon, XrState *xrs)
+grr_icon_draw (grr_icon_t *icon, cairo_t *xrs)
{
xsvg_status_t status;
}
void
-grr_icon_predraw (grr_icon_t *icon, XrState *xrs, int width, int height)
+grr_icon_predraw (grr_icon_t *icon, cairo_t *xrs, int width, int height)
{
if (icon->surface_width != width || icon->surface_height != height) {
if (icon->surface)
- XrSurfaceDestroy (icon->surface);
+ cairo_surface_destroy (icon->surface);
icon->surface_width = width;
icon->surface_height = height;
- icon->surface = XrSurfaceCreateNextTo (XrGetTargetSurface (xrs),
- XrFormatARGB32,
- width, height);
+ icon->surface = cairo_surface_create_similar (cairo_get_target_surface (xrs),
+ CAIRO_FORMAT_ARGB32,
+ width, height);
}
- XrSave (xrs);
- XrSetTargetSurface (xrs, icon->surface);
+ cairo_save (xrs);
+ cairo_set_target_surface (xrs, icon->surface);
grr_icon_draw (icon, xrs);
- XrRestore (xrs);
+ cairo_restore (xrs);
}
void
-grr_icon_draw_predrawn (grr_icon_t *icon, XrState *xrs)
+grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs)
{
if (icon->surface)
- XrShowSurface (xrs, icon->surface, icon->surface_width, icon->surface_height);
+ cairo_show_surface (xrs, icon->surface, icon->surface_width, icon->surface_height);
}