Yuriy Kaminskiy wrote:
>   Attached patch fixes that.
Just in case, I did not noticed any user-visible effects (before|after),
and not sure whether this patch correct or not.
But current code wrong ;-) and should be somehow changed.

And I noticed few more places to use introduced in previous patch
macros. See attached patches [again, with 03-*.patch - I did not seen
any visible effects, neither before, nor after patch].

TODO: `:grep 'gdouble\|scale' pixbuf-renderer.c' and think more about
using floor/ceil usage.
More code cleanup with ROUND_{UP,DOWN} macros (should not change generated code)

-- 

--- geeqie-20090616/src/pixbuf-renderer.c.~1~	2009-06-17 05:56:58.000000000 +0400
+++ geeqie-20090616/src/pixbuf-renderer.c	2009-06-17 18:19:03.000000000 +0400
@@ -1472,10 +1472,10 @@
 
 	if (!st) return FALSE;
 
-	x1 = (pr->x_scroll / pr->tile_width) * pr->tile_width;
-	y1 = (pr->y_scroll / pr->tile_height) * pr->tile_height;
-	x2 = ((pr->x_scroll + pr->vis_width) / pr->tile_width) * pr->tile_width + pr->tile_width;
-	y2 = ((pr->y_scroll + pr->vis_height) / pr->tile_height) * pr->tile_height + pr->tile_height;
+	x1 = ROUND_DOWN(pr->x_scroll, pr->tile_width);
+	y1 = ROUND_DOWN(pr->y_scroll, pr->tile_height);
+	x2 = ROUND_DOWN(pr->x_scroll + pr->vis_width, pr->tile_width) + pr->tile_width;
+	y2 = ROUND_DOWN(pr->y_scroll + pr->vis_height, pr->tile_height) + pr->tile_height;
 
 	return !((gdouble)st->x * pr->scale > (gdouble)x2 ||
 		 (gdouble)(st->x + pr->source_tile_width) * pr->scale < (gdouble)x1 ||
@@ -1537,8 +1537,8 @@
 					    pr->source_tile_width, pr->source_tile_height);
 		}
 
-	st->x = (x / pr->source_tile_width) * pr->source_tile_width;
-	st->y = (y / pr->source_tile_height) * pr->source_tile_height;
+	st->x = ROUND_DOWN(x, pr->source_tile_width);
+	st->y = ROUND_DOWN(y, pr->source_tile_height);
 	st->blank = TRUE;
 
 	pr->source_tiles = g_list_prepend(pr->source_tiles, st);
@@ -1603,8 +1603,8 @@
 	if (w > pr->image_width) w = pr->image_width;
 	if (h > pr->image_height) h = pr->image_height;
 
-	sx = (x / pr->source_tile_width) * pr->source_tile_width;
-	sy = (y / pr->source_tile_height) * pr->source_tile_height;
+	sx = ROUND_DOWN(x, pr->source_tile_width);
+	sy = ROUND_DOWN(y, pr->source_tile_height);
 
 	for (x1 = sx; x1 < x + w; x1+= pr->source_tile_width)
 		{
Fixes (harmless) off-by-one error.

-- 

--- geeqie-20090616/src/pixbuf-renderer.c.~1~	2009-06-17 05:56:58.000000000 +0400
+++ geeqie-20090616/src/pixbuf-renderer.c	2009-06-17 18:19:03.000000000 +0400
@@ -1474,8 +1474,8 @@
 
 	x1 = ROUND_DOWN(pr->x_scroll, pr->tile_width);
 	y1 = ROUND_DOWN(pr->y_scroll, pr->tile_height);
-	x2 = ROUND_DOWN(pr->x_scroll + pr->vis_width, pr->tile_width) + pr->tile_width;
-	y2 = ROUND_DOWN(pr->y_scroll + pr->vis_height, pr->tile_height) + pr->tile_height;
+	x2 = ROUND_UP(pr->x_scroll + pr->vis_width, pr->tile_width);
+	y2 = ROUND_UP(pr->y_scroll + pr->vis_height, pr->tile_height);
 
 	return !((gdouble)st->x * pr->scale > (gdouble)x2 ||
 		 (gdouble)(st->x + pr->source_tile_width) * pr->scale < (gdouble)x1 ||
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel

Reply via email to