[vte] Draw rectangles in one shot



commit 3c4380448abf647fe7ff93745c9def5f5e2ec326
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Jan 12 02:07:47 2010 -0500

    Draw rectangles in one shot

 src/vte.c     |   22 ++++++++++++----------
 src/vtedraw.c |    4 ++--
 2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 4749bb2..11de4e7 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8758,15 +8758,17 @@ vte_terminal_draw_rectangle(VteTerminal *terminal,
 			    gint width,
 			    gint height)
 {
+	GdkColor color;
+
 	_vte_draw_start(terminal->pvt->draw);
-	vte_terminal_draw_line(terminal, entry,
-			       x, y, x, y + height);
-	vte_terminal_draw_line(terminal, entry,
-			       x + width, y, x + width, y + height);
-	vte_terminal_draw_line(terminal, entry,
-			       x, y, x + width, y);
-	vte_terminal_draw_line(terminal, entry,
-			       x, y + height, x + width, y + height);
+	color.red = entry->red;
+	color.green = entry->green;
+	color.blue = entry->blue;
+	_vte_draw_draw_rectangle(terminal->pvt->draw,
+				 x + terminal->pvt->inner_border.left,
+                                 y + terminal->pvt->inner_border.top,
+				 width, height,
+				 &color, VTE_DRAW_OPAQUE);
 	_vte_draw_end(terminal->pvt->draw);
 }
 
@@ -9652,8 +9654,8 @@ vte_terminal_draw_cells(VteTerminal *terminal,
 				vte_terminal_draw_rectangle(terminal,
 						&terminal->pvt->palette[fore],
 						x, y,
-						MAX(0, (columns * column_width) - 1),
-						MAX(0, row_height - 1));
+						MAX(0, (columns * column_width)),
+						MAX(0, row_height));
 			}
 		}while (i < n);
 	}
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 7f085bd..6b1f92c 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -1196,9 +1196,9 @@ _vte_draw_draw_rectangle (struct _vte_draw *draw,
 			alpha);
 
 	cairo_set_operator (draw->cr, CAIRO_OPERATOR_OVER);
-	cairo_rectangle (draw->cr, x+.5, y+.5, width-1, height-1);
+	cairo_rectangle (draw->cr, x+VTE_LINE_WIDTH/2., y+VTE_LINE_WIDTH/2., width-VTE_LINE_WIDTH, height-VTE_LINE_WIDTH);
 	set_source_color_alpha (draw->cr, color, alpha);
-	cairo_set_line_width (draw->cr, 1);
+	cairo_set_line_width (draw->cr, VTE_LINE_WIDTH);
 	cairo_stroke (draw->cr);
 }
 



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