[vte: 5/9] Make _vte_draw_start() recursive
- From: Kristian Høgsberg <krh src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vte: 5/9] Make _vte_draw_start() recursive
- Date: Wed, 6 Jan 2010 15:56:04 +0000 (UTC)
commit c7c5b1ee0c31736b2a02634da9822d1988e5fdfc
Author: Kristian Høgsberg <krh bitplanet net>
Date: Wed Dec 23 11:06:27 2009 -0500
Make _vte_draw_start() recursive
src/vte.c | 10 ++--------
src/vtedraw.c | 14 ++++++++------
src/vtedraw.h | 2 +-
3 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 0e3764b..1900a82 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8724,12 +8724,8 @@ vte_terminal_fill_rectangle(VteTerminal *terminal,
gint height)
{
GdkColor color;
- gboolean wasdrawing;
- wasdrawing = terminal->pvt->draw->started;
- if (!wasdrawing) {
- _vte_draw_start(terminal->pvt->draw);
- }
+ _vte_draw_start(terminal->pvt->draw);
color.red = entry->red;
color.green = entry->green;
color.blue = entry->blue;
@@ -8738,9 +8734,7 @@ vte_terminal_fill_rectangle(VteTerminal *terminal,
y + terminal->pvt->inner_border.top,
width, height,
&color, VTE_DRAW_OPAQUE);
- if (!wasdrawing) {
- _vte_draw_end(terminal->pvt->draw);
- }
+ _vte_draw_end(terminal->pvt->draw);
}
static void
diff --git a/src/vtedraw.c b/src/vtedraw.c
index f3a556a..ab507bc 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -875,8 +875,10 @@ _vte_draw_start (struct _vte_draw *draw)
g_object_ref (draw->widget->window);
- data->cr = gdk_cairo_create (draw->widget->window);
- draw->started = TRUE;
+ if (draw->started == 0)
+ data->cr = gdk_cairo_create (draw->widget->window);
+
+ draw->started++;
}
void
@@ -885,16 +887,16 @@ _vte_draw_end (struct _vte_draw *draw)
struct _vte_pangocairo_data *data = draw->impl_data;
g_return_if_fail (draw->started == TRUE);
+ g_assert (draw->started > 0);
- if (data->cr != NULL) {
+ draw->started--;
+ if (draw->started == 0) {
cairo_destroy (data->cr);
data->cr = NULL;
- }
+ }
g_object_unref (draw->widget->window);
- draw->started = FALSE;
-
_vte_debug_print (VTE_DEBUG_DRAW, "draw_end\n");
}
diff --git a/src/vtedraw.h b/src/vtedraw.h
index f709413..a0c1041 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -62,7 +62,7 @@ struct _vte_draw_text_request {
struct _vte_draw {
GtkWidget *widget;
- gboolean started;
+ gint started;
gboolean requires_clear;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]