[vte/vte-next: 29/47] Use cairo rect and region directly



commit c33f1e2fb4ae30ef95dc903124f5fc7ff3ed5979
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 edf2b5d..14761d2 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);
@@ -3930,7 +3930,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;
@@ -10257,12 +10257,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;
 
@@ -10291,7 +10291,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"
@@ -10304,7 +10304,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;
@@ -10577,7 +10577,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;
@@ -10606,8 +10606,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);
@@ -10620,21 +10620,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 */
@@ -10757,7 +10757,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 {
@@ -13794,7 +13794,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;
 	}
@@ -14051,7 +14051,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)
@@ -14067,10 +14067,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;
@@ -14083,7 +14083,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 f68879e..fcc0f6b 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 a45d4a2..4f6d9ed 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 b75fdb6..31f7336 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]