From 168c5b5a424f12b885b32bfa1a49062f4d1b0ce6 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 4 Oct 2004 19:38:26 +0000 Subject: [PATCH] take drawable offsets into account when masking the preview with the 2004-10-04 Sven Neumann * libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_area): take drawable offsets into account when masking the preview with the selection mask. --- ChangeLog | 6 ++++++ libgimp/gimpdrawablepreview.c | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index db7966f4b3..af18a1fed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-10-04 Sven Neumann + + * libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_area): + take drawable offsets into account when masking the preview with + the selection mask. + 2004-10-04 Michael Natterer * tools/pdbgen/pdb/gimprc.pdb (gimprc_query, gimprc_set): disallow diff --git a/libgimp/gimpdrawablepreview.c b/libgimp/gimpdrawablepreview.c index dff799e68b..29053a41eb 100644 --- a/libgimp/gimpdrawablepreview.c +++ b/libgimp/gimpdrawablepreview.c @@ -236,26 +236,32 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview, } else { - GimpPixelRgn selection_rgn; GimpPixelRgn drawable_rgn; - guchar *sel; + GimpPixelRgn selection_rgn; guchar *src; + guchar *sel; + gint offset_x; + gint offset_y; gint selection_id; selection_id = gimp_image_get_selection (image_id); + gimp_drawable_offsets (drawable->drawable_id, &offset_x, &offset_y); + gimp_pixel_rgn_init (&drawable_rgn, drawable, x, y, width, height, FALSE, FALSE); gimp_pixel_rgn_init (&selection_rgn, gimp_drawable_get (selection_id), - x, y, width, height, + x + offset_x, y + offset_y, width, height, FALSE, FALSE); - sel = g_new (guchar, width * height); src = g_new (guchar, width * height * drawable->bpp); + sel = g_new (guchar, width * height); - gimp_pixel_rgn_get_rect (&drawable_rgn, src, x, y, width, height); - gimp_pixel_rgn_get_rect (&selection_rgn, sel, x, y, width, height); + gimp_pixel_rgn_get_rect (&drawable_rgn, + src, x, y, width, height); + gimp_pixel_rgn_get_rect (&selection_rgn, + sel, x + offset_x, y + offset_y, width, height); gimp_preview_area_mask (GIMP_PREVIEW_AREA (gimp_preview->area), x - gimp_preview->xoff - gimp_preview->xmin,