changeset 31:c42544f31030

Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net> * pixbuf-renderer.c: Add argument to pr_queue_to_tiles to only redraw the parts of the image that have an existing tile, fixes slow loading of images when zoomed in because it was generating a tile for even off screen parts of the image.
author gqview
date Tue, 05 Apr 2005 09:13:51 +0000
parents a310e31fc513
children 96ac60a9c0f1
files ChangeLog TODO src/pixbuf-renderer.c
diffstat 3 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 04 16:13:18 2005 +0000
+++ b/ChangeLog	Tue Apr 05 09:13:51 2005 +0000
@@ -1,3 +1,10 @@
+Tue Apr  5 05:09:29 2005  John Ellis  <johne@verizon.net>
+
+	* pixbuf-renderer.c: Add argument to pr_queue_to_tiles to only redraw
+	the parts of the image that have an existing tile, fixes slow loading
+	of images when zoomed in because it was generating a tile for even
+	off screen parts of the image.
+
 Mon Apr  4 12:07:05 2005  John Ellis  <johne@verizon.net>
 
 	* pan-view.c: Optimize pixbuf_draw_line, and use pixbuf_set_rect_fill
--- a/TODO	Mon Apr 04 16:13:18 2005 +0000
+++ b/TODO	Tue Apr 05 09:13:51 2005 +0000
@@ -18,7 +18,7 @@
    > make this a g_object with signals for completed, changed, etc.
   d> fix region computation rounding when updating scaled image in 'area ready' signal.
    > fix delay flip 'completed' signal (full screen busy cursor is not always turned off)
-   > fix slow loading of images when zoomed out - bug could be poor clamping to visible in PixbufRenderer.
+  d> fix slow loading of images when zoomed out - bug could be poor clamping to visible in PixbufRenderer.
 
 
  > work on pan view:
--- a/src/pixbuf-renderer.c	Mon Apr 04 16:13:18 2005 +0000
+++ b/src/pixbuf-renderer.c	Tue Apr 05 09:13:51 2005 +0000
@@ -188,7 +188,7 @@
 static void pr_queue_clear(PixbufRenderer *pr);
 static void pr_queue_merge(QueueData *parent, QueueData *qd);
 static void pr_queue(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
-		     gint clamp, ImageTileRenderType render, gint new_data);
+		     gint clamp, ImageTileRenderType render, gint new_data, gint only_existing);
 
 static void pr_redraw(PixbufRenderer *pr, gint new_data);
 
@@ -803,7 +803,7 @@
 	pr_queue(pr, pr->x_scroll - pr->x_offset + x,
 		 pr->y_scroll - pr->y_offset + y,
 		 w, h,
-		 FALSE, TILE_RENDER_ALL, FALSE);
+		 FALSE, TILE_RENDER_ALL, FALSE, FALSE);
 
 	old_vis = od->visible;
 	if (hidden) od->visible = FALSE;
@@ -1803,7 +1803,7 @@
 		}
 }
 
-static ImageTile *pr_tile_get(PixbufRenderer *pr, gint x, gint y)
+static ImageTile *pr_tile_get(PixbufRenderer *pr, gint x, gint y, gint only_existing)
 {
 	GList *work;
 
@@ -1823,6 +1823,8 @@
 		work = work->next;
 		}
 
+	if (only_existing) return NULL;
+
 	return pr_tile_add(pr, x, y);
 }
 
@@ -2211,7 +2213,7 @@
 }
 
 static gint pr_queue_to_tiles(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
-			      gint clamp, ImageTileRenderType render, gint new_data)
+			      gint clamp, ImageTileRenderType render, gint new_data, gint only_existing)
 {
 	gint i, j;
 	gint x1, x2;
@@ -2231,7 +2233,7 @@
 			{
 			ImageTile *it;
 
-			it = pr_tile_get(pr, i, j);
+			it = pr_tile_get(pr, i, j, only_existing);
 			if (it)
 				{
 				QueueData *qd;
@@ -2290,7 +2292,7 @@
 }
 
 static void pr_queue(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
-		     gint clamp, ImageTileRenderType render, gint new_data)
+		     gint clamp, ImageTileRenderType render, gint new_data, gint only_existing)
 {
 	gint nx, ny;
 
@@ -2302,7 +2304,7 @@
 	h = CLAMP(h, 0, pr->height - ny);
 	if (w < 1 || h < 1) return;
 
-	if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data) &&
+	if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data, only_existing) &&
 	    ((!pr->draw_queue && !pr->draw_queue_2pass) || pr->draw_idle_id == -1 || !pr->draw_idle_high))
 		{
 		if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
@@ -2315,7 +2317,7 @@
 static void pr_redraw(PixbufRenderer *pr, gint new_data)
 {
 	pr_queue_clear(pr);
-	pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, new_data);
+	pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, new_data, FALSE);
 }
 
 /*
@@ -2686,7 +2688,7 @@
 	pr_queue(pr, x, y,
 		 MIN((gint)area->width, pr->width - x),
 		 MIN((gint)area->height, pr->height - y),
-		 FALSE, TILE_RENDER_ALL, FALSE);
+		 FALSE, TILE_RENDER_ALL, FALSE, FALSE);
 }
 
 /*
@@ -2740,7 +2742,7 @@
 	if (w < 1 || h < 1)
 		{
 		/* scrolled completely to new material */
-		pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, FALSE);
+		pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
 		return;
 		}
 	else
@@ -2794,14 +2796,14 @@
 			{
 			pr_queue(pr,
 				 x_off > 0 ? pr->x_scroll + (pr->vis_width - w) : pr->x_scroll, pr->y_scroll,
-				 w, pr->vis_height, TRUE, TILE_RENDER_ALL, FALSE);
+				 w, pr->vis_height, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
 			}
 		if (h > 0)
 			{
 			/* FIXME, to optimize this, remove overlap */
 			pr_queue(pr,
 				 pr->x_scroll, y_off > 0 ? pr->y_scroll + (pr->vis_height - h) : pr->y_scroll,
-				 pr->vis_width, h, TRUE, TILE_RENDER_ALL, FALSE);
+				 pr->vis_width, h, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
 			}
 		}
 }
@@ -3134,7 +3136,7 @@
 	x2 = (gint)ceil((double)(x + width) * pr->scale);
 	y2 = (gint)ceil((double)(y + height) * pr->scale);
 
-	pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE);
+	pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
 }
 
 void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment)