Commit 31059f33 authored by Cosimo Cecchi's avatar Cosimo Cecchi

canvas-item: use gtk_render_icon_surface for the DnD surface

So to get HiDpi support.
parent 622d1abc
......@@ -461,6 +461,7 @@ nautilus_canvas_item_get_drag_surface (NautilusCanvasItem *item)
double item_x, item_y;
cairo_t *cr;
GtkStyleContext *context;
cairo_surface_t *drag_surface;
g_return_val_if_fail (NAUTILUS_IS_CANVAS_ITEM (item), NULL);
......@@ -485,13 +486,17 @@ nautilus_canvas_item_get_drag_surface (NautilusCanvasItem *item)
width = EEL_CANVAS_ITEM (item)->x2 - EEL_CANVAS_ITEM (item)->x1;
height = EEL_CANVAS_ITEM (item)->y2 - EEL_CANVAS_ITEM (item)->y1;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
width, height);
surface = gdk_window_create_similar_surface (gtk_widget_get_window (GTK_WIDGET (canvas)),
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
cr = cairo_create (surface);
gtk_render_icon (context, cr, item->details->pixbuf,
item_offset_x, item_offset_y);
drag_surface = gdk_cairo_surface_create_from_pixbuf (item->details->pixbuf,
gtk_widget_get_scale_factor (GTK_WIDGET (canvas)),
gtk_widget_get_window (GTK_WIDGET (canvas)));
gtk_render_icon_surface (context, cr, drag_surface,
item_offset_x, item_offset_y);
cairo_surface_destroy (drag_surface);
get_scaled_icon_size (item, &pix_width, &pix_height);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment