X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=src%2Fgrr_icon.c;fp=src%2Fgrr_icon.c;h=827d5b8b46e3388050aced2685dae2ed9d605943;hb=71804e890a43f01b8b2b41d5881398b4f21f79f6;hp=c1076b9c6ebdfa874a5d65c8a466734a2cad482f;hpb=525161b8577c2c4dd9c7b3f8be79ec6d110ccedc;p=grrobot diff --git a/src/grr_icon.c b/src/grr_icon.c index c1076b9..827d5b8 100644 --- a/src/grr_icon.c +++ b/src/grr_icon.c @@ -237,25 +237,28 @@ grr_icon_draw (grr_icon_t *icon, cairo_t *xrs) void grr_icon_predraw (grr_icon_t *icon, cairo_t *xrs, int width, int height) { + cairo_t *xrs2; + if (icon->surface_width != width || icon->surface_height != height) { if (icon->surface) cairo_surface_destroy (icon->surface); icon->surface_width = width; icon->surface_height = height; - icon->surface = cairo_surface_create_similar (cairo_current_target_surface (xrs), + icon->surface = cairo_surface_create_similar (cairo_get_target (xrs), CAIRO_FORMAT_ARGB32, width, height); } - cairo_save (xrs); - cairo_set_target_surface (xrs, icon->surface); - grr_icon_draw (icon, xrs); - cairo_restore (xrs); + xrs2 = cairo_create (icon->surface); + grr_icon_draw (icon, xrs2); + cairo_destroy (xrs2); } void -grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs) +grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs, double alpha) { - if (icon->surface) - cairo_show_surface (xrs, icon->surface, icon->surface_width, icon->surface_height); + if (icon->surface) { + cairo_set_source_surface (xrs, icon->surface, 0.0, 0.0); + cairo_paint (xrs); + } }