vte r2143 - in trunk: . src



Author: behdad
Date: Fri Nov 14 10:06:20 2008
New Revision: 2143
URL: http://svn.gnome.org/viewvc/vte?rev=2143&view=rev

Log:
2008-11-14  Behdad Esfahbod  <behdad gnome org>

        * src/vtedraw.c (_vte_draw_get_char_width): Minor fix.

        * src/vtepangox.c (_vte_pango_x_create), (_vte_pango_x_start),
        (_vte_pango_x_clear): Cleanup here too.



Modified:
   trunk/ChangeLog
   trunk/src/vtedraw.c
   trunk/src/vtepangox.c

Modified: trunk/src/vtedraw.c
==============================================================================
--- trunk/src/vtedraw.c	(original)
+++ trunk/src/vtedraw.c	Fri Nov 14 10:06:20 2008
@@ -363,7 +363,7 @@
 	if (draw->impl->get_char_width)
 		width = draw->impl->get_char_width (draw, c, columns);
 
-	return width ? width : draw->width * columns;
+	return width ? width : _vte_draw_get_text_width (draw) * columns;
 }
 
 gboolean

Modified: trunk/src/vtepangox.c
==============================================================================
--- trunk/src/vtepangox.c	(original)
+++ trunk/src/vtepangox.c	Fri Nov 14 10:06:20 2008
@@ -36,10 +36,8 @@
 
 struct _vte_pango_x_data
 {
-	GdkColor color;
 	GdkPixmap *pixmap;
 	gint pixmapw, pixmaph;
-	gint scrollx, scrolly;
 	PangoFontDescription *font;
 	PangoLayout *layout;
 	GdkGC *gc;
@@ -48,13 +46,6 @@
 	int x_offs, y_offs;
 };
 
-static gboolean
-_vte_pango_x_check(struct _vte_draw *draw, GtkWidget *widget)
-{
-	/* We can draw onto any widget. */
-	return TRUE;
-}
-
 static void
 _vte_pango_x_create(struct _vte_draw *draw, GtkWidget *widget)
 {
@@ -63,12 +54,8 @@
 	draw->impl_data = g_slice_new(struct _vte_pango_x_data);
 	data = (struct _vte_pango_x_data*) draw->impl_data;
 
-	data->color.red = 0;
-	data->color.green = 0;
-	data->color.blue = 0;
 	data->pixmap = NULL;
 	data->pixmapw = data->pixmaph = 0;
-	data->scrollx = data->scrolly = 0;
 	data->font = NULL;
 	data->layout = NULL;
 	data->gc = NULL;
@@ -100,18 +87,6 @@
 	g_slice_free(struct _vte_pango_x_data, draw->impl_data);
 }
 
-static GdkVisual *
-_vte_pango_x_get_visual(struct _vte_draw *draw)
-{
-	return gtk_widget_get_visual(draw->widget);
-}
-
-static GdkColormap *
-_vte_pango_x_get_colormap(struct _vte_draw *draw)
-{
-	return gtk_widget_get_colormap(draw->widget);
-}
-
 static void
 _vte_pango_x_start(struct _vte_draw *draw)
 {
@@ -143,7 +118,7 @@
 	data->gc = gdk_gc_new(draw->widget->window);
 
 	gdk_rgb_find_color(gdk_drawable_get_colormap(draw->widget->window),
-			   &data->color);
+			   &draw->bg_color);
 
 	gdk_window_get_internal_paint_info(draw->widget->window, &drawable,
 					&x_offs, &y_offs);
@@ -179,14 +154,6 @@
 }
 
 static void
-_vte_pango_x_set_background_color(struct _vte_draw *draw, GdkColor *color, guint16 opacity)
-{
-	struct _vte_pango_x_data *data;
-	data = (struct _vte_pango_x_data*) draw->impl_data;
-	data->color = *color;
-}
-
-static void
 _vte_pango_x_set_background_image(struct _vte_draw *draw,
 				  enum VteBgSourceType type,
 				  GdkPixbuf *pixbuf,
@@ -238,7 +205,7 @@
 	if ((data->pixmap == NULL) ||
 	    (data->pixmapw == 0) ||
 	    (data->pixmaph == 0)) {
-		gdk_gc_set_foreground(data->gc, &data->color);
+		gdk_gc_set_foreground(data->gc, &draw->bg_color);
 		gdk_draw_rectangle(draw->widget->window,
 				   data->gc,
 				   TRUE,
@@ -251,10 +218,10 @@
 	ystop = y + height;
 
 	y = ystop - height;
-	j = (data->scrolly + y) % data->pixmaph;
+	j = (draw->scrolly + y) % data->pixmaph;
 	while (y < ystop) {
 		x = xstop - width;
-		i = (data->scrollx + x) % data->pixmapw;
+		i = (draw->scrollx + x) % data->pixmapw;
 		h = MIN(data->pixmaph - (j % data->pixmaph), ystop - y);
 		while (x < xstop) {
 			w = MIN(data->pixmapw - (i % data->pixmapw), xstop - x);
@@ -349,30 +316,6 @@
 	g_object_unref(ctx);
 }
 
-static int
-_vte_pango_x_get_text_width(struct _vte_draw *draw)
-{
-	return draw->width;
-}
-
-static int
-_vte_pango_x_get_text_height(struct _vte_draw *draw)
-{
-	return draw->height;
-}
-
-static int
-_vte_pango_x_get_text_ascent(struct _vte_draw *draw)
-{
-	return draw->ascent;
-}
-
-static int
-_vte_pango_x_get_char_width(struct _vte_draw *draw, gunichar c, int columns)
-{
-	return _vte_pango_x_get_text_width(draw) * columns;
-}
-
 static gboolean
 _vte_pango_x_get_using_fontconfig(struct _vte_draw *draw)
 {
@@ -414,15 +357,6 @@
 }
 
 static gboolean
-_vte_pango_x_draw_char(struct _vte_draw *draw,
-		       struct _vte_draw_text_request *request,
-		       GdkColor *color, guchar alpha)
-{
-	_vte_pango_x_draw_text(draw, request, 1, color, alpha);
-	return TRUE;
-}
-
-static gboolean
 _vte_pango_x_draw_has_char(struct _vte_draw *draw, gunichar c)
 {
 	return FALSE;
@@ -465,41 +399,33 @@
 			   x, y, width, height);
 }
 
-static void
-_vte_pango_x_set_scroll(struct _vte_draw *draw, gint x, gint y)
-{
-	struct _vte_pango_x_data *data;
-	data = (struct _vte_pango_x_data*) draw->impl_data;
-	data->scrollx = x;
-	data->scrolly = y;
-}
-
 const struct _vte_draw_impl _vte_draw_pango_x = {
 	"pangox",
-	_vte_pango_x_check,
+	NULL, /* check */
 	_vte_pango_x_create,
 	_vte_pango_x_destroy,
-	_vte_pango_x_get_visual,
-	_vte_pango_x_get_colormap,
+	NULL, /* get_visual */
+	NULL, /* get_colormap */
 	_vte_pango_x_start,
 	_vte_pango_x_end,
-	_vte_pango_x_set_background_color,
+	NULL, /* set_background_opacity */
+	NULL, /* set_background_color */
 	_vte_pango_x_set_background_image,
-	FALSE,
+	FALSE, /* always_requires_clear */
 	_vte_pango_x_clip,
 	_vte_pango_x_clear,
 	_vte_pango_x_set_text_font,
-	_vte_pango_x_get_text_width,
-	_vte_pango_x_get_text_height,
-	_vte_pango_x_get_text_ascent,
-	_vte_pango_x_get_char_width,
+	NULL, /* get_text_width */
+	NULL, /* get_text_height */
+	NULL, /* get_text_ascent */
+	NULL, /* get_char_width */
 	_vte_pango_x_get_using_fontconfig,
 	_vte_pango_x_draw_text,
-	_vte_pango_x_draw_char,
+	NULL, /* draw_char */
 	_vte_pango_x_draw_has_char,
 	_vte_pango_x_draw_rectangle,
 	_vte_pango_x_fill_rectangle,
-	_vte_pango_x_set_scroll,
+	NULL /* set_scroll */
 };
 
 #endif



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