[gtk+/rendering-cleanup: 32/142] treeview: Port to gdk_window_shape_combine_region()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 32/142] treeview: Port to gdk_window_shape_combine_region()
- Date: Thu, 9 Sep 2010 16:06:59 +0000 (UTC)
commit 983076991887e61b4cac3850d11083ff13188f47
Author: Benjamin Otte <otte redhat com>
Date: Sat Aug 14 05:37:24 2010 +0200
treeview: Port to gdk_window_shape_combine_region()
gdk_window_shape_combine_mask() is going away. It's using a GdkPixmap
and falls back to gdk_window_shape_combine_region() anyway.
gtk/gtktreeview.c | 56 +++++++++++++++++++++++++++-------------------------
1 files changed, 29 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index f35e96d..d0f4aec 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3396,7 +3396,8 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
{
GtkTreeViewColumnReorder *reorder = tree_view->priv->cur_reorder;
GtkWidget *widget = GTK_WIDGET (tree_view);
- GdkBitmap *mask = NULL;
+ cairo_surface_t *mask_image;
+ cairo_region_t *mask_region;
gint x;
gint y;
gint width;
@@ -3463,19 +3464,20 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
tree_view->priv->drag_highlight_window = gdk_window_new (tree_view->priv->header_window, &attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
- mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
- cr = gdk_cairo_create (mask);
+ mask_image = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
+ cr = cairo_create (mask_image);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_rectangle (cr, 1, 1, width - 2, height - 2);
cairo_stroke (cr);
cairo_destroy (cr);
- gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
- mask, 0, 0);
- if (mask) g_object_unref (mask);
+ mask_region = gdk_cairo_region_create_from_surface (mask_image);
+ gdk_window_shape_combine_region (tree_view->priv->drag_highlight_window,
+ mask_region, 0, 0);
+
+ cairo_region_destroy (mask_region);
+ cairo_surface_destroy (mask_image);
+
tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ORIGINAL;
}
}
@@ -3526,12 +3528,9 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
&attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
- mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
- cr = gdk_cairo_create (mask);
+ mask_image = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cr = cairo_create (mask_image);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, width, 0);
cairo_line_to (cr, width / 2., width / 2);
@@ -3539,11 +3538,14 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
cairo_line_to (cr, width, height);
cairo_line_to (cr, width / 2., height - width / 2.);
cairo_fill (cr);
-
cairo_destroy (cr);
- gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
- mask, 0, 0);
- if (mask) g_object_unref (mask);
+
+ mask_region = gdk_cairo_region_create_from_surface (mask_image);
+ gdk_window_shape_combine_region (tree_view->priv->drag_highlight_window,
+ mask_region, 0, 0);
+
+ cairo_region_destroy (mask_region);
+ cairo_surface_destroy (mask_image);
}
tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ARROW;
@@ -3604,12 +3606,9 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
tree_view->priv->drag_highlight_window = gdk_window_new (NULL, &attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
- mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
- cr = gdk_cairo_create (mask);
+ mask_image = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cr = cairo_create (mask_image);
/* mirror if we're on the left */
if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT)
{
@@ -3623,11 +3622,14 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
cairo_line_to (cr, width, height - width);
cairo_line_to (cr, 0, height - tree_view->priv->expander_size);
cairo_fill (cr);
-
cairo_destroy (cr);
- gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
- mask, 0, 0);
- if (mask) g_object_unref (mask);
+
+ mask_region = gdk_cairo_region_create_from_surface (mask_image);
+ gdk_window_shape_combine_region (tree_view->priv->drag_highlight_window,
+ mask_region, 0, 0);
+
+ cairo_region_destroy (mask_region);
+ cairo_surface_destroy (mask_image);
}
tree_view->priv->drag_column_window_state = arrow_type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]