changeset 879:0f85435ac335

Optimize a bit when connected zoom and scrolling are unset, just move the test outside loops.
author zas_
date Fri, 04 Jul 2008 20:32:48 +0000
parents 1b14c0e177ad
children 71fc4b084e7e
files src/layout_image.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout_image.c	Fri Jul 04 17:21:07 2008 +0000
+++ b/src/layout_image.c	Fri Jul 04 20:32:48 2008 +0000
@@ -1053,13 +1053,15 @@
 
 	image_scroll(lw->image, x, y);
 
+	if (!lw->connect_scroll) return;
+
 	image_get_image_size(lw->image, &width, &height);
 	dx = (gdouble) x / width;
 	dy = (gdouble) y / height;
 	
 	for (i = 0; i < MAX_SPLIT_IMAGES; i++)
 		{
-		if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_scroll)
+		if (lw->split_images[i] && lw->split_images[i] != lw->image)
 			{
 			gdouble sx, sy;
 			image_get_scroll_center(lw->split_images[i], &sx, &sy);
@@ -1078,9 +1080,11 @@
 
 	image_zoom_adjust(lw->image, increment);
 
+	if (!lw->connect_zoom) return;
+
 	for (i = 0; i < MAX_SPLIT_IMAGES; i++)
 		{
-		if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom)
+		if (lw->split_images[i] && lw->split_images[i] != lw->image)
 			image_zoom_adjust(lw->split_images[i], increment); ;
 		}
 }
@@ -1092,9 +1096,11 @@
 
 	image_zoom_adjust_at_point(lw->image, increment, x, y);
 
+	if (!lw->connect_zoom) return;
+
 	for (i = 0; i < MAX_SPLIT_IMAGES; i++)
 		{
-		if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom)
+		if (lw->split_images[i] && lw->split_images[i] != lw->image)
 			image_zoom_adjust_at_point(lw->split_images[i], increment, x, y);
 		}
 }
@@ -1106,9 +1112,11 @@
 
 	image_zoom_set(lw->image, zoom);
 
-	for (i=0; i < MAX_SPLIT_IMAGES; i++)
+	if (!lw->connect_zoom) return;
+
+	for (i = 0; i < MAX_SPLIT_IMAGES; i++)
 		{
-		if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom)
+		if (lw->split_images[i] && lw->split_images[i] != lw->image)
 			image_zoom_set(lw->split_images[i], zoom);
 		}
 }