From 095ae5cc9b346d8371e237d1aaf0b3c39e6c37fc Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 7 Sep 2010 21:28:00 +0200 Subject: [PATCH] app: move mask_bounds() and mask_intersect() from GimpDrawable to GimpItem There is nothing drawable-specific in there, and having them on GimpItem enables some simplifications, esp. in upcoming PDB wrappers. None of these refactorings is in this commit though. --- app/core/gimp-edit.c | 5 +- app/core/gimpdrawable-blend.c | 4 +- app/core/gimpdrawable-bucket-fill.c | 2 +- app/core/gimpdrawable-histogram.c | 2 +- app/core/gimpdrawable-levels.c | 2 +- app/core/gimpdrawable-operation.c | 6 +- app/core/gimpdrawable-process.c | 2 +- app/core/gimpdrawable-shadow.c | 2 +- app/core/gimpdrawable-stroke.c | 4 +- app/core/gimpdrawable-transform.c | 2 +- app/core/gimpdrawable.c | 114 ------------------------ app/core/gimpdrawable.h | 11 --- app/core/gimpimagemap.c | 6 +- app/core/gimpitem.c | 108 +++++++++++++++++++++- app/core/gimpitem.h | 11 +++ app/core/gimppalette-import.c | 3 +- app/core/gimpselection.c | 6 +- app/display/gimpdisplayshell-preview.c | 8 +- app/pdb/drawable-cmds.c | 6 +- app/pdb/drawable-transform-cmds.c | 32 +++---- app/pdb/transform-tools-cmds.c | 12 +-- app/tools/gimpeditselectiontool.c | 6 +- app/tools/gimpselectiontool.c | 4 +- app/tools/gimptransformtool.c | 6 +- tools/pdbgen/pdb/drawable.pdb | 6 +- tools/pdbgen/pdb/drawable_transform.pdb | 8 +- tools/pdbgen/pdb/transform_tools.pdb | 12 +-- 27 files changed, 192 insertions(+), 198 deletions(-) diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 6995d3f5ac..bac9593825 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -204,7 +204,8 @@ gimp_edit_paste (GimpImage *image, gboolean have_mask; gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y); - have_mask = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + have_mask = gimp_item_mask_bounds (GIMP_ITEM (drawable), + &x1, &y1, &x2, &y2); if (! have_mask && viewport_width > 0 && @@ -537,7 +538,7 @@ gimp_edit_fill_internal (GimpImage *image, TempBuf *pat_buf = NULL; gboolean new_buf; - if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) return TRUE; /* nothing to do, but the fill succeded */ drawable_type = gimp_drawable_type (drawable); diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index e1e54c708c..0e1e1a2297 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -214,7 +214,7 @@ gimp_drawable_blend (GimpDrawable *drawable, image = gimp_item_get_image (GIMP_ITEM (drawable)); - if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) return; gimp_set_busy (image->gimp); @@ -590,7 +590,7 @@ gradient_precalc_shapeburst (GimpImage *image, gint x, y, width, height; gint off_x, off_y; - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height); + gimp_item_mask_intersect (GIMP_ITEM (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)), diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c index 4b8333e7b4..eb9c039f3c 100644 --- a/app/core/gimpdrawable-bucket-fill.c +++ b/app/core/gimpdrawable-bucket-fill.c @@ -146,7 +146,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable, image = gimp_item_get_image (GIMP_ITEM (drawable)); bytes = gimp_drawable_bytes (drawable); - selection = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + selection = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2); if ((x1 == x2) || (y1 == y2)) return; diff --git a/app/core/gimpdrawable-histogram.c b/app/core/gimpdrawable-histogram.c index 2bdbef3df3..95202c4168 100644 --- a/app/core/gimpdrawable-histogram.c +++ b/app/core/gimpdrawable-histogram.c @@ -44,7 +44,7 @@ gimp_drawable_calculate_histogram (GimpDrawable *drawable, g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); g_return_if_fail (histogram != NULL); - if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) return; pixel_region_init (®ion, gimp_drawable_get_tiles (drawable), diff --git a/app/core/gimpdrawable-levels.c b/app/core/gimpdrawable-levels.c index ac93d648fd..623af95f26 100644 --- a/app/core/gimpdrawable-levels.c +++ b/app/core/gimpdrawable-levels.c @@ -112,7 +112,7 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable, g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); - if (! gimp_drawable_mask_intersect (drawable, NULL, NULL, NULL, NULL)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), NULL, NULL, NULL, NULL)) return; config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL); diff --git a/app/core/gimpdrawable-operation.c b/app/core/gimpdrawable-operation.c index a1bed3df94..95a8d01428 100644 --- a/app/core/gimpdrawable-operation.c +++ b/app/core/gimpdrawable-operation.c @@ -62,9 +62,9 @@ gimp_drawable_apply_operation (GimpDrawable *drawable, g_return_if_fail (undo_desc != NULL); g_return_if_fail (GEGL_IS_NODE (operation)); - if (! gimp_drawable_mask_intersect (drawable, - &rect.x, &rect.y, - &rect.width, &rect.height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), + &rect.x, &rect.y, + &rect.width, &rect.height)) return; gimp_drawable_apply_operation_private (drawable, diff --git a/app/core/gimpdrawable-process.c b/app/core/gimpdrawable-process.c index 4adb785028..1e787dbdfa 100644 --- a/app/core/gimpdrawable-process.c +++ b/app/core/gimpdrawable-process.c @@ -45,7 +45,7 @@ gimp_drawable_process (GimpDrawable *drawable, g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); g_return_if_fail (undo_desc != NULL); - if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { PixelRegion srcPR, destPR; diff --git a/app/core/gimpdrawable-shadow.c b/app/core/gimpdrawable-shadow.c index d17de46a2a..5e852a28cb 100644 --- a/app/core/gimpdrawable-shadow.c +++ b/app/core/gimpdrawable-shadow.c @@ -87,7 +87,7 @@ gimp_drawable_merge_shadow_tiles (GimpDrawable *drawable, * extents of the selection mask, as it cannot extend beyond * them. */ - if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { TileManager *tiles = tile_manager_ref (drawable->private->shadow); PixelRegion shadowPR; diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c index 4c530a1f52..d631ae2f43 100644 --- a/app/core/gimpdrawable-stroke.c +++ b/app/core/gimpdrawable-stroke.c @@ -329,7 +329,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable, PixelRegion basePR; /* must call gimp_channel_is_empty() instead of relying on - * gimp_drawable_mask_intersect() because the selection pretends to + * 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))) @@ -339,7 +339,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable, w = gimp_item_get_width (GIMP_ITEM (drawable)); h = gimp_item_get_height (GIMP_ITEM (drawable)); } - else if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h)) + else if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h)) { return; } diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index 398c22f749..7e152af921 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -830,7 +830,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable, * gimp_layer_new_from_tiles() later which assumes that the tiles * are either RGB or GRAY. Eeek!!! (Sven) */ - if (gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h)) + if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h)) { tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)), GIMP_PICKABLE (drawable), diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 59692e6075..74eb1f3479 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -1742,120 +1742,6 @@ gimp_drawable_fill_by_type (GimpDrawable *drawable, gimp_drawable_fill (drawable, pattern ? NULL : &color, pattern); } -gboolean -gimp_drawable_mask_bounds (GimpDrawable *drawable, - gint *x1, - gint *y1, - gint *x2, - gint *y2) -{ - GimpItem *item; - GimpImage *image; - GimpChannel *selection; - gint tmp_x1, tmp_y1; - gint tmp_x2, tmp_y2; - gboolean retval; - - g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); - - item = GIMP_ITEM (drawable); - - g_return_val_if_fail (gimp_item_is_attached (item), FALSE); - - image = gimp_item_get_image (item); - selection = gimp_image_get_mask (image); - - if (GIMP_DRAWABLE (selection) != drawable && - gimp_channel_bounds (selection, &tmp_x1, &tmp_y1, &tmp_x2, &tmp_y2)) - { - gint off_x, off_y; - - gimp_item_get_offset (item, &off_x, &off_y); - - tmp_x1 = CLAMP (tmp_x1 - off_x, 0, gimp_item_get_width (item)); - tmp_y1 = CLAMP (tmp_y1 - off_y, 0, gimp_item_get_height (item)); - tmp_x2 = CLAMP (tmp_x2 - off_x, 0, gimp_item_get_width (item)); - tmp_y2 = CLAMP (tmp_y2 - off_y, 0, gimp_item_get_height (item)); - - retval = TRUE; - } - else - { - tmp_x1 = 0; - tmp_y1 = 0; - tmp_x2 = gimp_item_get_width (item); - tmp_y2 = gimp_item_get_height (item); - - retval = FALSE; - } - - if (x1) *x1 = tmp_x1; - if (y1) *y1 = tmp_y1; - if (x2) *x2 = tmp_x2; - if (y2) *y2 = tmp_y2; - - return retval;; -} - -gboolean -gimp_drawable_mask_intersect (GimpDrawable *drawable, - gint *x, - gint *y, - gint *width, - gint *height) -{ - GimpItem *item; - GimpImage *image; - GimpChannel *selection; - gint tmp_x, tmp_y; - gint tmp_width, tmp_height; - gboolean retval; - - g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); - - item = GIMP_ITEM (drawable); - - g_return_val_if_fail (gimp_item_is_attached (item), FALSE); - - image = gimp_item_get_image (item); - selection = gimp_image_get_mask (image); - - if (GIMP_DRAWABLE (selection) != drawable && - gimp_channel_bounds (selection, &tmp_x, &tmp_y, &tmp_width, &tmp_height)) - { - gint off_x, off_y; - - gimp_item_get_offset (item, &off_x, &off_y); - - tmp_width -= tmp_x; - tmp_height -= tmp_y; - - retval = gimp_rectangle_intersect (tmp_x - off_x, tmp_y - off_y, - tmp_width, tmp_height, - 0, 0, - gimp_item_get_width (item), - gimp_item_get_height (item), - &tmp_x, &tmp_y, - &tmp_width, &tmp_height); - } - else - { - tmp_x = 0; - tmp_y = 0; - tmp_width = gimp_item_get_width (item); - tmp_height = gimp_item_get_height (item); - - retval = TRUE; - } - - if (x) *x = tmp_x; - if (y) *y = tmp_y; - if (width) *width = tmp_width; - if (height) *height = tmp_height; - - return retval; -} - gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable) { diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h index faf1a69093..cadf83cbff 100644 --- a/app/core/gimpdrawable.h +++ b/app/core/gimpdrawable.h @@ -222,17 +222,6 @@ void gimp_drawable_fill_by_type (GimpDrawable *drawable, GimpContext *context, GimpFillType fill_type); -gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable, - gint *x1, - gint *y1, - gint *x2, - gint *y2); -gboolean gimp_drawable_mask_intersect (GimpDrawable *drawable, - gint *x, - gint *y, - gint *width, - gint *height); - gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable); GimpImageType gimp_drawable_type (const GimpDrawable *drawable); GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable); diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c index cc6a58c74b..3dba5bc493 100644 --- a/app/core/gimpimagemap.c +++ b/app/core/gimpimagemap.c @@ -348,9 +348,9 @@ gimp_image_map_apply (GimpImageMap *image_map, return; /* The application should occur only within selection bounds */ - if (! gimp_drawable_mask_intersect (image_map->drawable, - &rect.x, &rect.y, - &rect.width, &rect.height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (image_map->drawable), + &rect.x, &rect.y, + &rect.width, &rect.height)) return; /* If undo tiles don't exist, or change size, (re)allocate */ diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c index 1173a605d7..c665919517 100644 --- a/app/core/gimpitem.c +++ b/app/core/gimpitem.c @@ -29,7 +29,7 @@ #include "gimp.h" #include "gimp-parasites.h" -#include "gimpdrawable.h" +#include "gimpchannel.h" #include "gimpimage.h" #include "gimpimage-undo.h" #include "gimpimage-undo-push.h" @@ -1788,6 +1788,112 @@ gimp_item_is_content_locked (const GimpItem *item) return GIMP_ITEM_GET_CLASS (item)->is_content_locked (item); } +gboolean +gimp_item_mask_bounds (GimpItem *item, + gint *x1, + gint *y1, + gint *x2, + gint *y2) +{ + GimpImage *image; + GimpChannel *selection; + gint tmp_x1, tmp_y1; + gint tmp_x2, tmp_y2; + gboolean retval; + + g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE); + g_return_val_if_fail (gimp_item_is_attached (item), FALSE); + + image = gimp_item_get_image (item); + selection = gimp_image_get_mask (image); + + if (GIMP_ITEM (selection) != item && + gimp_channel_bounds (selection, &tmp_x1, &tmp_y1, &tmp_x2, &tmp_y2)) + { + gint off_x, off_y; + + gimp_item_get_offset (item, &off_x, &off_y); + + tmp_x1 = CLAMP (tmp_x1 - off_x, 0, gimp_item_get_width (item)); + tmp_y1 = CLAMP (tmp_y1 - off_y, 0, gimp_item_get_height (item)); + tmp_x2 = CLAMP (tmp_x2 - off_x, 0, gimp_item_get_width (item)); + tmp_y2 = CLAMP (tmp_y2 - off_y, 0, gimp_item_get_height (item)); + + retval = TRUE; + } + else + { + tmp_x1 = 0; + tmp_y1 = 0; + tmp_x2 = gimp_item_get_width (item); + tmp_y2 = gimp_item_get_height (item); + + retval = FALSE; + } + + if (x1) *x1 = tmp_x1; + if (y1) *y1 = tmp_y1; + if (x2) *x2 = tmp_x2; + if (y2) *y2 = tmp_y2; + + return retval;; +} + +gboolean +gimp_item_mask_intersect (GimpItem *item, + gint *x, + gint *y, + gint *width, + gint *height) +{ + GimpImage *image; + GimpChannel *selection; + gint tmp_x, tmp_y; + gint tmp_width, tmp_height; + gboolean retval; + + g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE); + g_return_val_if_fail (gimp_item_is_attached (item), FALSE); + + image = gimp_item_get_image (item); + selection = gimp_image_get_mask (image); + + if (GIMP_ITEM (selection) != item && + gimp_channel_bounds (selection, &tmp_x, &tmp_y, &tmp_width, &tmp_height)) + { + gint off_x, off_y; + + gimp_item_get_offset (item, &off_x, &off_y); + + tmp_width -= tmp_x; + tmp_height -= tmp_y; + + retval = gimp_rectangle_intersect (tmp_x - off_x, tmp_y - off_y, + tmp_width, tmp_height, + 0, 0, + gimp_item_get_width (item), + gimp_item_get_height (item), + &tmp_x, &tmp_y, + &tmp_width, &tmp_height); + } + else + { + tmp_x = 0; + tmp_y = 0; + tmp_width = gimp_item_get_width (item); + tmp_height = gimp_item_get_height (item); + + retval = TRUE; + } + + if (x) *x = tmp_x; + if (y) *y = tmp_y; + if (width) *width = tmp_width; + if (height) *height = tmp_height; + + return retval; +} + gboolean gimp_item_is_in_set (GimpItem *item, GimpItemSet set) diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h index 3cee45fbbf..a60ae7ceb0 100644 --- a/app/core/gimpitem.h +++ b/app/core/gimpitem.h @@ -312,6 +312,17 @@ gboolean gimp_item_get_lock_content (const GimpItem *item); gboolean gimp_item_can_lock_content (const GimpItem *item); gboolean gimp_item_is_content_locked (const GimpItem *item); +gboolean gimp_item_mask_bounds (GimpItem *item, + gint *x1, + gint *y1, + gint *x2, + gint *y2); +gboolean gimp_item_mask_intersect (GimpItem *item, + gint *x, + gint *y, + gint *width, + gint *height); + gboolean gimp_item_is_in_set (GimpItem *item, GimpItemSet set); diff --git a/app/core/gimppalette-import.c b/app/core/gimppalette-import.c index 11217d72d6..86fe108faf 100644 --- a/app/core/gimppalette-import.c +++ b/app/core/gimppalette-import.c @@ -474,7 +474,8 @@ gimp_palette_import_from_drawable (GimpDrawable *drawable, if (selection_only) { - if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), + &x, &y, &width, &height)) return NULL; } else diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index 4191dbd0c0..85bf325a43 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -657,8 +657,8 @@ gimp_selection_extract (GimpSelection *selection, * actual selection mask */ if (GIMP_IS_DRAWABLE (pickable)) - non_empty = gimp_drawable_mask_bounds (GIMP_DRAWABLE (pickable), - &x1, &y1, &x2, &y2); + non_empty = gimp_item_mask_bounds (GIMP_ITEM (pickable), + &x1, &y1, &x2, &y2); else non_empty = gimp_channel_bounds (GIMP_CHANNEL (selection), &x1, &y1, &x2, &y2); @@ -837,7 +837,7 @@ gimp_selection_float (GimpSelection *selection, image = gimp_item_get_image (GIMP_ITEM (selection)); /* Make sure there is a region to float... */ - if (! gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) || + if (! gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2) || (x1 == x2 || y1 == y2)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, diff --git a/app/display/gimpdisplayshell-preview.c b/app/display/gimpdisplayshell-preview.c index 801054fc0d..de9e532c33 100644 --- a/app/display/gimpdisplayshell-preview.c +++ b/app/display/gimpdisplayshell-preview.c @@ -200,14 +200,14 @@ gimp_display_shell_preview_transform (GimpDisplayShell *shell) mask = NULL; mask_offx = mask_offy = 0; - if (gimp_drawable_mask_bounds (tool->drawable, - &mask_x1, &mask_y1, - &mask_x2, &mask_y2)) + if (gimp_item_mask_bounds (GIMP_ITEM (tool->drawable), + &mask_x1, &mask_y1, + &mask_x2, &mask_y2)) { mask = gimp_image_get_mask (gimp_display_get_image (shell->display)); gimp_item_get_offset (GIMP_ITEM (tool->drawable), - &mask_offx, &mask_offy); + &mask_offx, &mask_offy); } if (GIMP_IS_PERSPECTIVE_TOOL (tr_tool)) diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c index 46a97a5966..673d5cadf4 100644 --- a/app/pdb/drawable-cmds.c +++ b/app/pdb/drawable-cmds.c @@ -799,7 +799,7 @@ drawable_mask_bounds_invoker (GimpProcedure *procedure, if (success) { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error)) - non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2); else success = FALSE; } @@ -841,8 +841,8 @@ drawable_mask_intersect_invoker (GimpProcedure *procedure, if (success) { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error)) - non_empty = gimp_drawable_mask_intersect (drawable, - &x, &y, &width, &height); + non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable), + &x, &y, &width, &height); else success = FALSE; } diff --git a/app/pdb/drawable-transform-cmds.c b/app/pdb/drawable-transform-cmds.c index fbd3048d39..034e7d20ec 100644 --- a/app/pdb/drawable-transform-cmds.c +++ b/app/pdb/drawable-transform-cmds.c @@ -71,7 +71,7 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_flip (drawable, context, flip_type, @@ -128,7 +128,7 @@ drawable_transform_flip_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -199,7 +199,7 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -288,7 +288,7 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -369,7 +369,7 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -444,7 +444,7 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_rotate (drawable, context, rotate_type, @@ -501,7 +501,7 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -576,7 +576,7 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -661,7 +661,7 @@ drawable_transform_scale_invoker (GimpProcedure *procedure, success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -733,7 +733,7 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure, success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -811,7 +811,7 @@ drawable_transform_shear_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -879,7 +879,7 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -967,7 +967,7 @@ drawable_transform_2d_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -1046,7 +1046,7 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -1139,7 +1139,7 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -1226,7 +1226,7 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; diff --git a/app/pdb/transform-tools-cmds.c b/app/pdb/transform-tools-cmds.c index b6225c80e4..4a02b81e46 100644 --- a/app/pdb/transform-tools-cmds.c +++ b/app/pdb/transform-tools-cmds.c @@ -65,7 +65,7 @@ flip_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_flip (drawable, context, flip_type, TRUE, 0.0, FALSE); @@ -120,7 +120,7 @@ perspective_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -190,7 +190,7 @@ rotate_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -266,7 +266,7 @@ scale_invoker (GimpProcedure *procedure, x0 < x1 && y0 < y1); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -337,7 +337,7 @@ shear_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -418,7 +418,7 @@ transform_2d_invoker (GimpProcedure *procedure, success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index ba3069d279..cf5a59da35 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -303,9 +303,9 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool, * where the translation will result in floating the selection * mask and translating the resulting layer */ - gimp_drawable_mask_bounds (GIMP_DRAWABLE (active_item), - &edit_select->x1, &edit_select->y1, - &edit_select->x2, &edit_select->y2); + gimp_item_mask_bounds (active_item, + &edit_select->x1, &edit_select->y1, + &edit_select->x2, &edit_select->y2); } gimp_edit_selection_tool_calc_coords (edit_select, diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index 45593d9bf7..550bce4d6c 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -184,8 +184,8 @@ gimp_selection_tool_oper_update (GimpTool *tool, if (layer == floating_sel) move_floating_sel = TRUE; } - else if (gimp_drawable_mask_intersect (drawable, - NULL, NULL, NULL, NULL)) + else if (gimp_item_mask_intersect (GIMP_ITEM (drawable), + NULL, NULL, NULL, NULL)) { move_layer = TRUE; } diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 14a3b9b096..fc020d8e3f 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -1540,9 +1540,9 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool, gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y); - gimp_drawable_mask_bounds (drawable, - &tr_tool->x1, &tr_tool->y1, - &tr_tool->x2, &tr_tool->y2); + gimp_item_mask_bounds (GIMP_ITEM (drawable), + &tr_tool->x1, &tr_tool->y1, + &tr_tool->x2, &tr_tool->y2); tr_tool->x1 += offset_x; tr_tool->y1 += offset_y; tr_tool->x2 += offset_x; diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb index f666b2ac54..efc342aded 100644 --- a/tools/pdbgen/pdb/drawable.pdb +++ b/tools/pdbgen/pdb/drawable.pdb @@ -232,7 +232,7 @@ HELP code => <<'CODE' { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error)) - non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2); else success = FALSE; } @@ -279,8 +279,8 @@ HELP code => <<'CODE' { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error)) - non_empty = gimp_drawable_mask_intersect (drawable, - &x, &y, &width, &height); + non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable), + &x, &y, &width, &height); else success = FALSE; } diff --git a/tools/pdbgen/pdb/drawable_transform.pdb b/tools/pdbgen/pdb/drawable_transform.pdb index e1d905ecc5..eb09e243d3 100644 --- a/tools/pdbgen/pdb/drawable_transform.pdb +++ b/tools/pdbgen/pdb/drawable_transform.pdb @@ -38,7 +38,7 @@ sub transform_invoke { success = $success_check if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; gint off_x, off_y; @@ -84,7 +84,7 @@ sub transform_default_invoke { success = $success_check if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -168,7 +168,7 @@ HELP success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_flip (drawable, context, flip_type, @@ -465,7 +465,7 @@ HELP success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_rotate (drawable, context, rotate_type, diff --git a/tools/pdbgen/pdb/transform_tools.pdb b/tools/pdbgen/pdb/transform_tools.pdb index d010229b58..ff29fa11cd 100644 --- a/tools/pdbgen/pdb/transform_tools.pdb +++ b/tools/pdbgen/pdb/transform_tools.pdb @@ -40,7 +40,7 @@ sub flip { success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { success = gimp_drawable_transform_flip (drawable, context, flip_type, TRUE, 0.0, FALSE); @@ -97,7 +97,7 @@ sub perspective { success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -161,7 +161,7 @@ sub rotate { success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -235,7 +235,7 @@ sub scale { x0 < x1 && y0 < y1); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -301,7 +301,7 @@ sub shear { success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; @@ -376,7 +376,7 @@ sub transform_2d { success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error); if (success && - gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) + gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) { GimpMatrix3 matrix; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;