[evolution-patches] fix for editor redraw problems.



This patch fixes editor redraw problems that show up when the document
shrinks (fejj and I have both seen these, no bug number).  It also
includes some some trivial changes that correct the drawing bounds of
calls to html_engine_draw_background.  I the incorrect bounds are
harmless because they get correctly clipped inside the function, but
they are confusing to read this way.

--Larry
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.534
diff -u -p -r1.534 htmlengine.c
--- htmlengine.c	9 Apr 2003 23:54:50 -0000	1.534
+++ htmlengine.c	15 Apr 2003 02:32:09 -0000
@@ -4823,7 +4823,7 @@ clear_changed_area (HTMLEngine *e, HTMLO
 	if (html_engine_intersection (e, &x1, &y1, &x2, &y2)) {
 		if (html_object_is_transparent (cr->object)) {
 			html_painter_begin (e->painter, x1, y1, x2, y2);
-			html_engine_draw_background (e, x1, y1, x2, y2);
+			html_engine_draw_background (e, x1, y1, x2 - x1, y2 - y1);
 			html_object_draw_background (o, e->painter,
 						     o->x + cr->x, o->y - o->ascent + cr->y,
 						     cr->width, cr->height,
@@ -4962,7 +4962,7 @@ thaw_idle (gpointer data)
 		return FALSE;
 	}
 
-	w = html_engine_get_doc_width (e) - e->rightBorder;
+	w = html_engine_get_doc_width (e)- e->rightBorder;
 	h = html_engine_get_doc_height (e) - e->bottomBorder;
 
 	redraw_whole = html_engine_calc_size (e, &changed_objs);
@@ -4975,25 +4975,22 @@ thaw_idle (gpointer data)
 	if (redraw_whole) {
 		html_engine_queue_redraw_all (e);
 	} else {
-		GtkAdjustment *vadj, *hadj;
 		gint nw, nh;
 
 		do_pending_expose (e);
 		draw_changed_objects (e, changed_objs);
 
-		hadj = GTK_LAYOUT (e->widget)->hadjustment;
-		vadj = GTK_LAYOUT (e->widget)->vadjustment;
 		nw = html_engine_get_doc_width (e) - e->rightBorder;
 		nh = html_engine_get_doc_height (e) - e->bottomBorder;
 
-		if (nh < h && nh - vadj->value < e->height) {
-			html_painter_begin (e->painter, 0, nh - vadj->value, e->width, e->height);
-			html_engine_draw_background (e, 0, nh - vadj->value, e->width, e->height - (nh - vadj->value));
+		if (nh < h && nh - e->y_offset < e->height) {
+			html_painter_begin (e->painter, e->x_offset, nh, e->width + e->x_offset, e->height + e->y_offset);
+			html_engine_draw_background (e, e->x_offset, nh, e->width + e->x_offset, e->height - (nh - e->y_offset));
 			html_painter_end (e->painter);
 		}
-		if (nw < w && nw - hadj->value < e->width) {
-			html_painter_begin (e->painter, nw - hadj->value, 0, e->width, e->height);
-			html_engine_draw_background (e, nw - hadj->value, 0, e->width - (nw - hadj->value), e->height);
+		if (nw < w && nw - e->x_offset < e->width) {
+			html_painter_begin (e->painter, nw, e->y_offset, e->width + e->x_offset, e->height + e->y_offset);
+			html_engine_draw_background (e, nw, e->y_offset, e->width - (nw - e->x_offset), e->height + e->y_offset);
 			html_painter_end (e->painter);
 		}
 		g_list_free (changed_objs);
Index: htmldrawqueue.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmldrawqueue.c,v
retrieving revision 1.40
diff -u -p -r1.40 htmldrawqueue.c
--- htmldrawqueue.c	5 Nov 2002 19:39:01 -0000	1.40
+++ htmldrawqueue.c	15 Apr 2003 02:32:09 -0000
@@ -289,7 +289,7 @@ draw_obj (HTMLDrawQueue *queue,
 	/* Draw the actual object.  */
 
 	if (html_object_is_transparent (obj)) {
-		html_engine_draw_background (e, x1, y1, x2, y2);
+		html_engine_draw_background (e, x1, y1, x2 - x1, y2 - y1);
 		html_object_draw_background (obj, e->painter,
 					     obj->x, obj->y - obj->ascent,
 					     obj->width, obj->ascent + obj->descent,
@@ -349,7 +349,7 @@ clear (HTMLDrawQueue *queue,
 	html_painter_begin (e->painter, x1, y1, x2, y2);
 
 	if (elem->background_color != NULL) {
-		html_engine_draw_background (e, x1, y1, x2, y2);
+		html_engine_draw_background (e, x1, y1, x2 - x1, y2 - y1);
 	}
 
 #if 0
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1778
diff -u -p -r1.1778 ChangeLog
--- ChangeLog	9 Apr 2003 23:54:50 -0000	1.1778
+++ ChangeLog	15 Apr 2003 02:32:14 -0000
@@ -1,3 +1,14 @@
+2003-04-14  Larry Ewing  <lewing ximian com>
+
+	* htmlengine.c (thaw_idle): fix the area passed to the cleanup
+	function.
+	(clear_changed_area): pass the correct extents to
+	::draw_background.
+	
+	* htmldrawqueue.c (clear): pass the correct extents to
+	draw_background.
+	(draw_obj): the same.
+
 2003-04-09  Larry Ewing  <lewing ximian com>
 
 	* htmlengine.c (html_engine_finalize): remove any pending


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