summaryrefslogtreecommitdiff
path: root/gtk/gtktextutil.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-08-15 21:24:55 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:03:01 +0200
commit4138e86ad458fe157d47e1244addbd6939f3f7be (patch)
tree262ff2dc36f111cd0e592d02aa70bb7a29b78c59 /gtk/gtktextutil.c
parent331999d84db1dfaa14a00a1dc423be12dc33e9a9 (diff)
downloadgtk+-4138e86ad458fe157d47e1244addbd6939f3f7be.tar.gz
testview: Convert _gtk_text_util_create_rich_drag_icon() to use surfaces
Diffstat (limited to 'gtk/gtktextutil.c')
-rw-r--r--gtk/gtktextutil.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 262f89b5c1..0ef71cf22c 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -280,14 +280,14 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
values->font = pango_font_description_copy (style->font_desc);
}
-GdkPixmap *
+cairo_surface_t *
_gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
GtkTextBuffer *buffer,
GtkTextIter *start,
GtkTextIter *end)
{
GtkAllocation allocation;
- GdkDrawable *drawable = NULL;
+ cairo_surface_t *surface;
gint pixmap_height, pixmap_width;
gint layout_width, layout_height;
GtkStyle *widget_style;
@@ -303,7 +303,7 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
g_return_val_if_fail (start != NULL, NULL);
g_return_val_if_fail (end != NULL, NULL);
- widget_style = gtk_widget_get_style (widget);
+ widget_style = gtk_widget_get_style (widget);
new_buffer = gtk_text_buffer_new (gtk_text_buffer_get_tag_table (buffer));
gtk_text_buffer_get_start_iter (new_buffer, &iter);
@@ -359,12 +359,14 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
pixmap_width = layout_width + DRAG_ICON_LAYOUT_BORDER * 2;
pixmap_height = layout_height + DRAG_ICON_LAYOUT_BORDER * 2;
- drawable = gdk_pixmap_new (gtk_widget_get_window (widget),
- pixmap_width + 2, pixmap_height + 2, -1);
+ surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
+ CAIRO_CONTENT_COLOR,
+ pixmap_width + 2,
+ pixmap_height + 2);
- cr = gdk_cairo_create (drawable);
+ cr = cairo_create (surface);
- gdk_cairo_set_source_color (cr, &widget_style->base [gtk_widget_get_state (widget)]);
+ gdk_cairo_set_source_color (cr, &widget_style->base [gtk_widget_get_state (widget)]);
cairo_paint (cr);
cairo_save (cr);
@@ -383,7 +385,9 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
g_object_unref (layout);
g_object_unref (new_buffer);
- return drawable;
+ cairo_surface_set_device_offset (surface, 2, 2);
+
+ return surface;
}