app: use gimp_drawable_mask_intersect() instead of mask_bounds()

This commit is contained in:
Michael Natterer 2010-09-07 17:43:39 +02:00
parent df1575234c
commit 24b6c27e42
2 changed files with 16 additions and 16 deletions

View File

@ -587,14 +587,14 @@ gradient_precalc_shapeburst (GimpImage *image,
if (! gimp_channel_is_empty (mask))
{
PixelRegion maskR;
gint x1, y1, x2, y2;
gint offx, offy;
gint x, y, width, height;
gint off_x, off_y;
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
gimp_item_get_offset (GIMP_ITEM (drawable), &offx, &offy);
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height);
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
pixel_region_init (&maskR, gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
x1 + offx, y1 + offy, (x2 - x1), (y2 - y1), FALSE);
x + off_x, y + off_y, width, height, FALSE);
/* copy the mask to the temp mask */
copy_region (&maskR, &tempR);

View File

@ -26,7 +26,7 @@
#include "base/gimphistogram.h"
#include "base/pixel-region.h"
#include "gimpdrawable.h"
#include "gimpchannel.h"
#include "gimpdrawable-histogram.h"
#include "gimpimage.h"
@ -35,24 +35,24 @@ void
gimp_drawable_calculate_histogram (GimpDrawable *drawable,
GimpHistogram *histogram)
{
PixelRegion region;
PixelRegion mask;
gint x1, y1, x2, y2;
gboolean have_mask;
GimpImage *image;
PixelRegion region;
PixelRegion mask;
gint x, y, width, height;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (histogram != NULL);
have_mask = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if ((x1 == x2) || (y1 == y2))
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
return;
pixel_region_init (&region, gimp_drawable_get_tiles (drawable),
x1, y1, (x2 - x1), (y2 - y1), FALSE);
x, y, width, height, FALSE);
if (have_mask)
image = gimp_item_get_image (GIMP_ITEM (drawable));
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
{
GimpChannel *sel_mask;
GimpImage *image;
@ -64,7 +64,7 @@ gimp_drawable_calculate_histogram (GimpDrawable *drawable,
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
pixel_region_init (&mask,
gimp_drawable_get_tiles (GIMP_DRAWABLE (sel_mask)),
x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE);
x + off_x, y + off_y, width, height, FALSE);
gimp_histogram_calculate (histogram, &region, &mask);
}
else