Re: [Nautilus-list] Eel background speedup patch



On Fri, 1 Jun 2001, Alex Larsson wrote:

> This patch fixes some bad performance with EelBackground where it renders
> the whole widget area even when only a small rectangle was exposed.

So, this patch didn't solve the whole issue. It broke when using non-aa
mode. Here is a patch that solves this problem. It does change a public
API entrypoint, but the header says "Only intended to be called by
eel_background_canvas_group_draw".

Can I check this in?

? background_fix.patch
? eel/changes.diff
Index: eel/eel-background-canvas-group.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-background-canvas-group.c,v
retrieving revision 1.5
diff -u -p -r1.5 eel-background-canvas-group.c
--- eel/eel-background-canvas-group.c	2001/04/04 07:51:33	1.5
+++ eel/eel-background-canvas-group.c	2001/06/05 18:06:26
@@ -180,7 +180,7 @@ eel_background_canvas_group_draw (GnomeC
 					      GTK_WIDGET (item->canvas)->allocation.width,
 					      GTK_WIDGET (item->canvas)->allocation.height);

-		eel_background_draw (background, drawable, gc, x, y, width, height);
+		eel_background_draw (background, drawable, gc, x, y, 0, 0, width, height);

 		gdk_gc_unref (gc);
 	}
Index: eel/eel-background.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-background.c,v
retrieving revision 1.5
diff -u -p -r1.5 eel-background.c
--- eel/eel-background.c	2001/06/01 23:16:53	1.5
+++ eel/eel-background.c	2001/06/05 18:06:26
@@ -554,9 +554,10 @@ eel_background_pre_draw (EelBackground *

 void
 eel_background_draw (EelBackground *background,
-			  GdkDrawable *drawable, GdkGC *gc,
-			  int drawable_x, int drawable_y,
-			  int drawable_width, int drawable_height)
+		     GdkDrawable *drawable, GdkGC *gc,
+		     int src_x, int src_y,
+		     int dest_x, int dest_y,
+		     int dest_width, int dest_height)
 {
 	int x, y;
 	int x_canvas, y_canvas;
@@ -579,22 +580,22 @@ eel_background_draw (EelBackground *back

 	/* x & y are relative to the drawable
 	 */
-	for (y = 0; y < drawable_height; y += PIXBUF_HEIGHT) {
-		for (x = 0; x < drawable_width; x += PIXBUF_WIDTH) {
+	for (y = 0; y < dest_height; y += PIXBUF_HEIGHT) {
+		for (x = 0; x < dest_width; x += PIXBUF_WIDTH) {

-			width = MIN (drawable_width - x, PIXBUF_WIDTH);
-			height = MIN (drawable_height - y, PIXBUF_HEIGHT);
+			width = MIN (dest_width - x, PIXBUF_WIDTH);
+			height = MIN (dest_height - y, PIXBUF_HEIGHT);

-			x_canvas = drawable_x + x;
-			y_canvas = drawable_y + y;
+			x_canvas = src_x + x;
+			y_canvas = src_y + y;

 			canvas_buf_from_pixbuf (&buffer, pixbuf, x_canvas, y_canvas, width, height);
 			eel_background_draw_aa (background, &buffer);
 			gdk_pixbuf_render_to_drawable (pixbuf, drawable, gc,
 						       0, 0,
-						       x_canvas, y_canvas,
+						       dest_x + x, dest_y + y,
 						       width, height,
-						       GDK_RGB_DITHER_MAX, x_canvas, y_canvas);
+						       GDK_RGB_DITHER_MAX, dest_x + x, dest_y + y);
 		}
 	}

@@ -609,7 +610,10 @@ eel_background_draw_to_drawable (EelBack
 				      int entire_width, int entire_height)
 {
 	eel_background_pre_draw (background, entire_width, entire_height);
-	eel_background_draw (background, drawable, gc, drawable_x, drawable_y, drawable_width, drawable_height);
+	eel_background_draw (background, drawable, gc,
+			     drawable_x, drawable_y,
+			     drawable_x, drawable_y,
+			     drawable_width, drawable_height);
 }

 void
Index: eel/eel-background.h
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-background.h,v
retrieving revision 1.4
diff -u -p -r1.4 eel-background.h
--- eel/eel-background.h	2001/04/04 07:51:33	1.4
+++ eel/eel-background.h	2001/06/05 18:06:26
@@ -100,10 +100,12 @@ void                        eel_backgrou
 void                        eel_background_draw                             (EelBackground               *background,
 									     GdkDrawable                 *drawable,
 									     GdkGC                       *gc,
-									     int                          drawable_x,
-									     int                          drawable_y,
-									     int                          drawable_width,
-									     int                          drawable_height);
+									     int                          src_x,
+									     int                          src_y,
+									     int                          dest_x,
+									     int                          dest_y,
+									     int                          dest_width,
+									     int                          dest_height);
 /* For updating the canvas, aa case. Note: eel_background_pre_draw
  * must have been previously called. Only intended to be called by
  * eel_background_canvas_group_render.





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