Mercurial > hg > forks > geeqie
comparison 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 |
comparison
equal
deleted
inserted
replaced
2861:727f2f8edf74 | 2862:f105ca657cb3 |
---|---|
2877 x_pixel = floor((gdouble)(pr->x_mouse - pr->x_offset + pr->x_scroll) / pr->scale); | 2877 x_pixel = floor((gdouble)(pr->x_mouse - pr->x_offset + pr->x_scroll) / pr->scale); |
2878 y_pixel = floor((gdouble)(pr->y_mouse - pr->y_offset + pr->y_scroll) / pr->scale / pr->aspect_ratio); | 2878 y_pixel = floor((gdouble)(pr->y_mouse - pr->y_offset + pr->y_scroll) / pr->scale / pr->aspect_ratio); |
2879 x_pixel_clamped = CLAMP(x_pixel, 0, pr->image_width - 1); | 2879 x_pixel_clamped = CLAMP(x_pixel, 0, pr->image_width - 1); |
2880 y_pixel_clamped = CLAMP(y_pixel, 0, pr->image_height - 1); | 2880 y_pixel_clamped = CLAMP(y_pixel, 0, pr->image_height - 1); |
2881 | 2881 |
2882 if(x_pixel != x_pixel_clamped || y_pixel != y_pixel_clamped) | 2882 if (x_pixel != x_pixel_clamped) |
2883 { | 2883 { |
2884 /* mouse is not on pr */ | 2884 /* mouse is not on pr */ |
2885 x_pixel = y_pixel = -1; | 2885 x_pixel = -1; |
2886 } | |
2887 if (y_pixel != y_pixel_clamped) | |
2888 { | |
2889 /* mouse is not on pr */ | |
2890 y_pixel = -1; | |
2886 } | 2891 } |
2887 | 2892 |
2888 *x_pixel_return = x_pixel; | 2893 *x_pixel_return = x_pixel; |
2889 *y_pixel_return = y_pixel; | 2894 *y_pixel_return = y_pixel; |
2890 | 2895 |