mirror of https://github.com/GNOME/gimp.git
app: make gimp_item_mask_bounds() and _intersect() honor a suspended selection
and remove the same check from the stroke and fill code.
This commit is contained in:
parent
1bd9d3dd5b
commit
3c7fbe93b3
|
@ -214,7 +214,6 @@ gimp_drawable_fill_scan_convert (GimpDrawable *drawable,
|
|||
gboolean push_undo)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpImage *image;
|
||||
GeglBuffer *buffer;
|
||||
GeglBuffer *mask_buffer;
|
||||
gint x, y, w, h;
|
||||
|
@ -230,23 +229,9 @@ gimp_drawable_fill_scan_convert (GimpDrawable *drawable,
|
|||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
|
||||
|
||||
context = GIMP_CONTEXT (options);
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
/* must call gimp_channel_is_empty() instead of relying on
|
||||
* gimp_item_mask_intersect() because the selection pretends to
|
||||
* be empty while it is being stroked, to prevent masking itself.
|
||||
*/
|
||||
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = gimp_item_get_width (GIMP_ITEM (drawable));
|
||||
h = gimp_item_get_height (GIMP_ITEM (drawable));
|
||||
}
|
||||
else if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
||||
return;
|
||||
|
||||
/* fill a 1-bpp GeglBuffer with black, this will describe the shape
|
||||
* of the stroke.
|
||||
|
|
|
@ -119,9 +119,8 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
|||
GimpScanConvert *scan_convert,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpImage *image;
|
||||
gdouble width;
|
||||
GimpUnit unit;
|
||||
gdouble width;
|
||||
GimpUnit unit;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
|
@ -131,25 +130,17 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
|||
GIMP_FILL_STYLE_PATTERN ||
|
||||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
/* must call gimp_channel_is_empty() instead of relying on
|
||||
* gimp_item_mask_intersect() because the selection pretends to
|
||||
* be empty while it is being stroked, to prevent masking itself.
|
||||
*/
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)) &&
|
||||
! gimp_item_mask_intersect (GIMP_ITEM (drawable), NULL, NULL, NULL, NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), NULL, NULL, NULL, NULL))
|
||||
return;
|
||||
|
||||
width = gimp_stroke_options_get_width (options);
|
||||
unit = gimp_stroke_options_get_unit (options);
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
|
||||
|
|
|
@ -2275,7 +2275,11 @@ gimp_item_mask_bounds (GimpItem *item,
|
|||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
/* check for is_empty() before intersecting so we ignore the
|
||||
* selection if it is suspended (like when stroking)
|
||||
*/
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
! gimp_channel_is_empty (selection) &&
|
||||
gimp_item_bounds (GIMP_ITEM (selection), &x, &y, &width, &height))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
@ -2345,7 +2349,11 @@ gimp_item_mask_intersect (GimpItem *item,
|
|||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
/* check for is_empty() before intersecting so we ignore the
|
||||
* selection if it is suspended (like when stroking)
|
||||
*/
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
! gimp_channel_is_empty (selection) &&
|
||||
gimp_item_bounds (GIMP_ITEM (selection),
|
||||
&tmp_x, &tmp_y, &tmp_width, &tmp_height))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue