Fixed bug where pixel/color information at x=0 coordinates werent shown:
authorLaurent Monin <geeqie@norz.org>
Mon, 30 Mar 2009 19:01:09 +0000 (19:01 +0000)
committerLaurent Monin <geeqie@norz.org>
Mon, 30 Mar 2009 19:01:09 +0000 (19:01 +0000)
- 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
src/pixbuf-renderer.c

index 6a8f39d..9922dc8 100644 (file)
@@ -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;
index 53e461d..46dd707 100644 (file)
@@ -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);