Bill Skaggs <weskaggs@primate.ucdavis.edu>
* libgimp/gimpdrawablepreview.c: set preview bounds correctly when previewed drawable extends beyond image edges, fixes bug #165372.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2005-01-26 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||||
|
|
||||||
|
* libgimp/gimpdrawablepreview.c: set preview bounds correctly
|
||||||
|
when previewed drawable extends beyond image edges,
|
||||||
|
fixes bug #165372.
|
||||||
|
|
||||||
2005-01-27 Manish Singh <yosh@gimp.org>
|
2005-01-27 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* README: update ancient IRC info.
|
* README: update ancient IRC info.
|
||||||
|
@ -318,6 +318,9 @@ gimp_drawable_preview_draw_buffer (GimpPreview *preview,
|
|||||||
buffer, rowstride);
|
buffer, rowstride);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX3(a, b, c) (MAX (MAX ((a), (b)), (c)))
|
||||||
|
#define MIN3(a, b, c) (MIN (MIN ((a), (b)), (c)))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
|
gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
|
||||||
GimpDrawable *drawable)
|
GimpDrawable *drawable)
|
||||||
@ -327,16 +330,20 @@ gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
|
|||||||
gint height = gimp_drawable_height (drawable->drawable_id);
|
gint height = gimp_drawable_height (drawable->drawable_id);
|
||||||
gint x1, x2;
|
gint x1, x2;
|
||||||
gint y1, y2;
|
gint y1, y2;
|
||||||
|
gint xmin, ymin, xmax, ymax;
|
||||||
|
gint offset_x, offset_y;
|
||||||
|
|
||||||
drawable_preview->drawable = drawable;
|
drawable_preview->drawable = drawable;
|
||||||
|
|
||||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||||
|
gimp_drawable_offsets (drawable->drawable_id, &offset_x, &offset_y);
|
||||||
|
|
||||||
gimp_preview_set_bounds (preview,
|
xmin = MAX3 (x1 - SELECTION_BORDER, 0, - offset_x);
|
||||||
MAX (x1 - SELECTION_BORDER, 0),
|
ymin = MAX3 (y1 - SELECTION_BORDER, 0, - offset_y);
|
||||||
MAX (y1 - SELECTION_BORDER, 0),
|
xmax = MIN3 (x2 + SELECTION_BORDER, width, width + offset_x);
|
||||||
MIN (x2 + SELECTION_BORDER, width),
|
ymax = MIN3 (y2 + SELECTION_BORDER, height, height + offset_y);
|
||||||
MIN (y2 + SELECTION_BORDER, height));
|
|
||||||
|
gimp_preview_set_bounds (preview, xmin, ymin, xmax, ymax);
|
||||||
|
|
||||||
if (gimp_drawable_is_indexed (drawable->drawable_id))
|
if (gimp_drawable_is_indexed (drawable->drawable_id))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user