gtksourceview r2135 - branches/gnome-2-24/gtksourceview



Author: pborelli
Date: Sat Jan 10 18:16:06 2009
New Revision: 2135
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2135&view=rev

Log:
backport mark drawing bugfix


Modified:
   branches/gnome-2-24/gtksourceview/gtksourceview.c

Modified: branches/gnome-2-24/gtksourceview/gtksourceview.c
==============================================================================
--- branches/gnome-2-24/gtksourceview/gtksourceview.c	(original)
+++ branches/gnome-2-24/gtksourceview/gtksourceview.c	Sat Jan 10 18:16:06 2009
@@ -1274,16 +1274,17 @@
 draw_line_marks (GtkSourceView *view,
 		 GSList        *marks,
 		 gint           x,
-		 gint           y)
+		 gint           y,
+		 gint		height)
 {
 	GdkPixbuf *composite;
-	gint width, height;
+	gint mark_width, mark_height;
 
 	/* Draw the mark with higher priority */
 	marks = g_slist_sort_with_data (marks, sort_marks_by_priority, view);
 
 	composite = NULL;
-	width = height = 0;
+	mark_width = mark_height = 0;
 
 	/* composite all the pixbufs for the marks present at the line */
 	do
@@ -1301,8 +1302,8 @@
 			if (composite == NULL)
 			{
 				composite = gdk_pixbuf_copy (pixbuf);
-				width = gdk_pixbuf_get_width (composite);
-				height = gdk_pixbuf_get_height (composite);
+				mark_width = gdk_pixbuf_get_width (composite);
+				mark_height = gdk_pixbuf_get_height (composite);
 			}
 			else
 			{
@@ -1314,10 +1315,10 @@
 				gdk_pixbuf_composite (pixbuf,
 						      composite,
 						      0, 0,
-						      width, height,
+						      mark_width, mark_height,
 						      0, 0,
-						      (double) pixbuf_w / width,
-						      (double) pixbuf_h / height,
+						      (double) pixbuf_w / mark_width,
+						      (double) pixbuf_h / mark_height,
 						      GDK_INTERP_BILINEAR,
 						      COMPOSITE_ALPHA);
 			}
@@ -1334,10 +1335,10 @@
 
 		window = gtk_text_view_get_window (GTK_TEXT_VIEW (view),
 						   GTK_TEXT_WINDOW_LEFT);
-
+						   
 		gdk_draw_pixbuf (GDK_DRAWABLE (window), NULL, composite,
-				 0, 0, x, y,
-				 width, height,
+				 0, 0, x, y + (height - mark_height) / 2.0,
+				 mark_width, mark_height,
 				 GDK_RGB_DITHER_NORMAL, 0, 0);
 		g_object_unref (composite);
 	}
@@ -1513,8 +1514,19 @@
 
 			if (marks != NULL)
 			{
+				GtkTextIter iter;
+				gint height;
+			
+				gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (view->priv->source_buffer),
+								  &iter,
+								  line_to_paint);
+				gtk_text_view_get_line_yrange (GTK_TEXT_VIEW (view),
+							       &iter,
+							       NULL,
+							       &height);
+
 				/* draw marks for the line */
-				draw_line_marks (view, marks, x_pixmap, pos);
+				draw_line_marks (view, marks, x_pixmap, pos, height);
 				g_slist_free (marks);
 			}
 		}
@@ -2564,7 +2576,7 @@
 	g_return_val_if_fail (category != NULL, NULL);
 
 	cat = g_hash_table_lookup (view->priv->mark_categories, category);
-	if (cat != NULL)
+	if (cat != NULL && cat->pixbuf != NULL)
 		return g_object_ref (cat->pixbuf);
 	else
 		return NULL;



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