changeset 3614:2043eca1b412

[gaim-migrate @ 3728] Somewhat faster Pangonated gtkimhtml by Christian Hammond committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 09 Oct 2002 05:47:38 +0000
parents 95669ff6dc3b
children 220bed0e439c
files src/gtkimhtml.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Wed Oct 09 05:46:02 2002 +0000
+++ b/src/gtkimhtml.c	Wed Oct 09 05:47:38 2002 +0000
@@ -449,15 +449,17 @@
 text_width(PangoContext *context, PangoFontDescription *desc,
 		   const char *text, gint len)
 {
-	PangoLayout *layout;
+	static PangoLayout *layout = NULL;
 	int width;
 
-	layout = pango_layout_new(context);
+	if (layout == NULL)
+		layout = pango_layout_new(context);
+
 	pango_layout_set_font_description(layout, desc);
 	pango_layout_set_text(layout, text, len);
 	pango_layout_get_pixel_size(layout, &width, NULL);
 
-	g_object_unref(G_OBJECT(layout));
+ 	/* g_object_unref(G_OBJECT(layout)); */
 
 	return width;
 }