From 3f28a6851bda996bfcdbd79b1adbf0aa4cf0ef94 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 26 Mar 2018 06:29:06 +0200 Subject: [PATCH] colorswatch: Port drag icon to paintables --- gtk/gtkcolorswatch.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index b763f558ef..a40b334c0e 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -167,19 +167,17 @@ static void drag_set_color_icon (GdkDragContext *context, const GdkRGBA *color) { - cairo_surface_t *surface; - cairo_t *cr; + GtkSnapshot *snapshot; + GdkPaintable *paintable; - surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 48, 32); - cr = cairo_create (surface); - gdk_cairo_set_source_rgba (cr, color); - cairo_paint (cr); + snapshot = gtk_snapshot_new (FALSE, NULL, "ColorDragIcon"); + gtk_snapshot_append_color (snapshot, + color, + &GRAPHENE_RECT_INIT(0, 0, 48, 32), + "ColorDragColor"); + paintable = gtk_snapshot_free_to_paintable (snapshot); - cairo_surface_set_device_offset (surface, -4, -4); - gtk_drag_set_icon_surface (context, surface); - - cairo_destroy (cr); - cairo_surface_destroy (surface); + gtk_drag_set_icon_paintable (context, paintable, 4, 4); } static void -- 2.30.2