From be6f51861124a8e5f4c10fcc4fdd9df1cf0613ca Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Mon, 30 Mar 2009 19:01:09 +0000 Subject: [PATCH] Fixed bug where pixel/color information at x=0 coordinates werent shown: - pixel-coordinates now calculated with floor - guard for update in layout does not apply for 0 coordinates anymore Patch by Ruben Stein. --- src/layout_image.c | 2 +- src/pixbuf-renderer.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layout_image.c b/src/layout_image.c index 6a8f39d0..9922dc85 100644 --- a/src/layout_image.c +++ b/src/layout_image.c @@ -1541,7 +1541,7 @@ void layout_status_update_pixel_cb(PixbufRenderer *pr, gpointer data) pixbuf_renderer_get_mouse_position(pr, &x_pixel, &y_pixel); - if(x_pixel > 0 && y_pixel > 0) + if(x_pixel >= 0 && y_pixel >= 0) { gint r_mouse, g_mouse, b_mouse; gint width, height; diff --git a/src/pixbuf-renderer.c b/src/pixbuf-renderer.c index 53e461dc..46dd7079 100644 --- a/src/pixbuf-renderer.c +++ b/src/pixbuf-renderer.c @@ -4197,8 +4197,8 @@ gboolean pixbuf_renderer_get_mouse_position(PixbufRenderer *pr, gint *x_pixel_re return FALSE; } - x_pixel = (gint)((gdouble)(pr->x_mouse - pr->x_offset + pr->x_scroll) / pr->scale); - y_pixel = (gint)((gdouble)(pr->y_mouse - pr->y_offset + pr->y_scroll) / pr->scale); + x_pixel = floor((gdouble)(pr->x_mouse - pr->x_offset + pr->x_scroll) / pr->scale); + y_pixel = floor((gdouble)(pr->y_mouse - pr->y_offset + pr->y_scroll) / pr->scale); x_pixel_clamped = CLAMP(x_pixel, 0, pr->image_width - 1); y_pixel_clamped = CLAMP(y_pixel, 0, pr->image_height - 1); -- 2.20.1