[vte/vte-next: 30/223] Use cairo rect and region directly



commit b73ab2c83c8092b8432ba9acaff3c46798876ca5
Author: Christian Persch <chpe gnome org>
Date:   Mon May 2 22:03:59 2011 +0200

    Use cairo rect and region directly

 src/vte.c     |   44 ++++++++++++++++++++++----------------------
 src/vteapp.c  |    2 +-
 src/vtedraw.c |    2 +-
 src/vtedraw.h |    2 +-
 4 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index e8b44fc..67a195e 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -357,7 +357,7 @@ _vte_invalidate_cells(VteTerminal *terminal,
 		      glong column_start, gint column_count,
 		      glong row_start, gint row_count)
 {
-	VteRegionRectangle rect;
+	cairo_rectangle_int_t rect;
 	glong i;
 
 	if (!column_count || !row_count) {
@@ -436,7 +436,7 @@ _vte_invalidate_cells(VteTerminal *terminal,
 	if (terminal->pvt->active != NULL) {
 		terminal->pvt->update_regions = g_slist_prepend (
 				terminal->pvt->update_regions,
-				gdk_region_rectangle (&rect));
+				cairo_region_create_rectangle (&rect));
 		/* Wait a bit before doing any invalidation, just in
 		 * case updates are coming in really soon. */
 		add_update_timeout (terminal);
@@ -476,7 +476,7 @@ _vte_invalidate_region (VteTerminal *terminal,
 void
 _vte_invalidate_all(VteTerminal *terminal)
 {
-	VteRegionRectangle rect;
+	cairo_rectangle_int_t rect;
 	GtkAllocation allocation;
 
 	g_assert(VTE_IS_TERMINAL(terminal));
@@ -502,7 +502,7 @@ _vte_invalidate_all(VteTerminal *terminal)
 
 	if (terminal->pvt->active != NULL) {
 		terminal->pvt->update_regions = g_slist_prepend (NULL,
-				gdk_region_rectangle (&rect));
+				cairo_region_create_rectangle (&rect));
 		/* Wait a bit before doing any invalidation, just in
 		 * case updates are coming in really soon. */
 		add_update_timeout (terminal);
@@ -3928,7 +3928,7 @@ next_match:
 
 	/* Tell the input method where the cursor is. */
 	if (gtk_widget_get_realized (&terminal->widget)) {
-		GdkRectangle rect;
+		cairo_rectangle_int_t rect;
 		rect.x = terminal->pvt->screen->cursor_current.col *
 			 terminal->char_width + terminal->pvt->inner_border.left;
 		rect.width = terminal->char_width;
@@ -10255,12 +10255,12 @@ fg_out:
 }
 
 static void
-vte_terminal_expand_region (VteTerminal *terminal, GdkRegion *region, const GdkRectangle *area)
+vte_terminal_expand_region (VteTerminal *terminal, cairo_region_t *region, const cairo_rectangle_int_t *area)
 {
 	VteScreen *screen;
 	int width, height;
 	int row, col, row_stop, col_stop;
-	VteRegionRectangle rect;
+	cairo_rectangle_int_t rect;
 
 	screen = terminal->pvt->screen;
 
@@ -10289,7 +10289,7 @@ vte_terminal_expand_region (VteTerminal *terminal, GdkRegion *region, const GdkR
 	rect.height = (row_stop - row)*height;
 
 	/* the rect must be cell aligned to avoid overlapping XY bands */
-	gdk_region_union_with_rect(region, &rect);
+	cairo_region_union_rectangle(region, &rect);
 
 	_vte_debug_print (VTE_DEBUG_UPDATES,
 			"vte_terminal_expand_region"
@@ -10302,7 +10302,7 @@ vte_terminal_expand_region (VteTerminal *terminal, GdkRegion *region, const GdkR
 }
 
 static void
-vte_terminal_paint_area (VteTerminal *terminal, const GdkRectangle *area)
+vte_terminal_paint_area (VteTerminal *terminal, const cairo_rectangle_int_t *area)
 {
 	VteScreen *screen;
 	int width, height, delta;
@@ -10575,7 +10575,7 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
 
 /* Draw the widget. */
 static void
-vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
+vte_terminal_paint(GtkWidget *widget, cairo_region_t *region)
 {
 	VteTerminal *terminal;
 	GtkAllocation allocation;
@@ -10604,8 +10604,8 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 	}
 
 	_VTE_DEBUG_IF (VTE_DEBUG_UPDATES) {
-		VteRegionRectangle clip;
-		gdk_region_get_clipbox (region, &clip);
+		cairo_rectangle_int_t clip;
+		cairo_region_get_extents (region, &clip);
 		g_printerr ("vte_terminal_paint"
 				"	(%d,%d)x(%d,%d) pixels\n",
 				clip.x, clip.y, clip.width, clip.height);
@@ -10618,21 +10618,21 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 
 	/* Calculate the bounding rectangle. */
 	{
-		VteRegionRectangle *rectangles;
+		cairo_rectangle_int_t *rectangles;
 		gint n, n_rectangles;
 		gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
 		/* don't bother to enlarge an invalidate all */
 		if (!(n_rectangles == 1
 		      && rectangles[0].width == allocation.width
 		      && rectangles[0].height == allocation.height)) {
-			GdkRegion *rr = gdk_region_new ();
+			cairo_region_t *rr = cairo_region_create ();
 			/* convert pixels into whole cells */
 			for (n = 0; n < n_rectangles; n++) {
 				vte_terminal_expand_region (terminal, rr, rectangles + n);
 			}
 			g_free (rectangles);
 			gdk_region_get_rectangles (rr, &rectangles, &n_rectangles);
-			gdk_region_destroy (rr);
+			cairo_region_destroy (rr);
 		}
 
 		/* and now paint them */
@@ -10755,7 +10755,7 @@ vte_terminal_expose(GtkWidget *widget,
 			} else {
 				terminal->pvt->update_regions =
 					g_slist_prepend (terminal->pvt->update_regions,
-							gdk_region_copy (event->region));
+							cairo_region_copy (event->region));
 			}
 		}
 	} else {
@@ -13792,7 +13792,7 @@ reset_update_regions (VteTerminal *terminal)
 {
 	if (terminal->pvt->update_regions != NULL) {
 		g_slist_foreach (terminal->pvt->update_regions,
-				(GFunc)gdk_region_destroy, NULL);
+				(GFunc)cairo_region_destroy, NULL);
 		g_slist_free (terminal->pvt->update_regions);
 		terminal->pvt->update_regions = NULL;
 	}
@@ -14049,7 +14049,7 @@ static gboolean
 update_regions (VteTerminal *terminal)
 {
 	GSList *l;
-	GdkRegion *region;
+	cairo_region_t *region;
 	GdkWindow *window;
 
 	if (G_UNLIKELY (! gtk_widget_is_drawable (&terminal->widget)
@@ -14065,10 +14065,10 @@ update_regions (VteTerminal *terminal)
 	l = terminal->pvt->update_regions;
 	if (g_slist_next (l) != NULL) {
 		/* amalgamate into one super-region */
-		region = gdk_region_new ();
+		region = cairo_region_create ();
 		do {
-			gdk_region_union (region, l->data);
-			gdk_region_destroy (l->data);
+			cairo_region_union (region, l->data);
+			cairo_region_destroy (l->data);
 		} while ((l = g_slist_next (l)) != NULL);
 	} else {
 		region = l->data;
@@ -14081,7 +14081,7 @@ update_regions (VteTerminal *terminal)
 	window = gtk_widget_get_window (&terminal->widget);
 	gdk_window_invalidate_region (window, region, FALSE);
 	gdk_window_process_updates (window, FALSE);
-	gdk_region_destroy (region);
+	cairo_region_destroy (region);
 
 	_vte_debug_print (VTE_DEBUG_WORK, "-");
 
diff --git a/src/vteapp.c b/src/vteapp.c
index 2abb91d..4c19518 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -288,7 +288,7 @@ refresh_window(GtkWidget *widget, gpointer data)
 {
 	GdkWindow *window;
 	GtkAllocation allocation;
-	GdkRectangle rect;
+	cairo_rectangle_int_t rect;
 
 	if (GTK_IS_WIDGET(data)) {
 		window = gtk_widget_get_window(widget);
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 9b7e028..57f522b 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -865,7 +865,7 @@ _vte_draw_set_background_scroll (struct _vte_draw *draw,
 }
 
 void
-_vte_draw_clip (struct _vte_draw *draw, GdkRegion *region)
+_vte_draw_clip (struct _vte_draw *draw, cairo_region_t *region)
 {
 	_vte_debug_print (VTE_DEBUG_DRAW, "draw_clip\n");
 	gdk_cairo_region(draw->cr, region);
diff --git a/src/vtedraw.h b/src/vtedraw.h
index f495dfa..22f9fe3 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -83,7 +83,7 @@ void _vte_draw_set_background_image(struct _vte_draw *draw,
 void _vte_draw_set_background_scroll(struct _vte_draw *draw,
 				     gint x, gint y);
 
-void _vte_draw_clip(struct _vte_draw *draw, GdkRegion *region);
+void _vte_draw_clip(struct _vte_draw *draw, cairo_region_t *region);
 void _vte_draw_clear(struct _vte_draw *draw,
 		     gint x, gint y, gint width, gint height);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]