diff src/pixbuf-renderer.c @ 2862:f105ca657cb3

Bug fix #251: Crop simulation https://github.com/BestImageViewer/geeqie/issues/251 If the drawn rectangle started or ended outside the image area, incorrect coordinates were returned. The coordinates of the enclosed part of the image are now returned.
author Colin Clark <colin.clark@cclark.uk>
date Wed, 14 Nov 2018 10:15:23 +0000
parents 3e9ca298bb1d
children
line wrap: on
line diff
--- a/src/pixbuf-renderer.c	Thu Nov 08 12:26:09 2018 +0000
+++ b/src/pixbuf-renderer.c	Wed Nov 14 10:15:23 2018 +0000
@@ -2879,10 +2879,15 @@
 	x_pixel_clamped = CLAMP(x_pixel, 0, pr->image_width - 1);
 	y_pixel_clamped = CLAMP(y_pixel, 0, pr->image_height - 1);
 
-	if(x_pixel != x_pixel_clamped || y_pixel != y_pixel_clamped)
+	if (x_pixel != x_pixel_clamped)
 		{
 		/* mouse is not on pr */
-		x_pixel = y_pixel = -1;
+		x_pixel = -1;
+		}
+	if (y_pixel != y_pixel_clamped)
+		{
+		/* mouse is not on pr */
+		y_pixel = -1;
 		}
 
 	*x_pixel_return = x_pixel;