[gimp/goat-invasion: 141/418] app: remove the !seed_fill case from gimp_drawable_bucket_fill()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 141/418] app: remove the !seed_fill case from gimp_drawable_bucket_fill()
- Date: Wed, 4 Apr 2012 10:37:38 +0000 (UTC)
commit 8ce80b2b431cc8cc3b374e4a329ce85e4d9e6e57
Author: Michael Natterer <mitch gimp org>
Date: Sun Mar 18 23:15:02 2012 +0100
app: remove the !seed_fill case from gimp_drawable_bucket_fill()
We use gimp_edit_fill() for that now. Also remove bucket fill's
_full() variant because it's unused now.
app/core/gimpdrawable-bucket-fill.c | 186 +++++++++++++++++------------------
app/core/gimpdrawable-bucket-fill.h | 39 +++-----
app/pdb/edit-cmds.c | 2 -
app/tools/gimpbucketfilltool.c | 1 -
tools/pdbgen/pdb/edit.pdb | 2 -
5 files changed, 102 insertions(+), 128 deletions(-)
---
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index 90dbcfd..c8c05d6 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -46,6 +46,20 @@
#include "gimp-intl.h"
+static void gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
+ GimpBucketFillMode fill_mode,
+ gint paint_mode,
+ gdouble opacity,
+ gboolean fill_transparent,
+ GimpSelectCriterion fill_criterion,
+ gdouble threshold,
+ gboolean sample_merged,
+ gdouble x,
+ gdouble y,
+ const GimpRGB *color,
+ GimpPattern *pattern);
+
+
/* public functions */
gboolean
@@ -54,7 +68,6 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
GimpBucketFillMode fill_mode,
gint paint_mode,
gdouble opacity,
- gboolean do_seed_fill,
gboolean fill_transparent,
GimpSelectCriterion fill_criterion,
gdouble threshold,
@@ -96,32 +109,33 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
return FALSE;
}
- gimp_drawable_bucket_fill_full (drawable,
- fill_mode,
- paint_mode, opacity,
- do_seed_fill,
- fill_transparent, fill_criterion,
- threshold, sample_merged,
- x, y,
- &color, pattern);
+ gimp_drawable_bucket_fill_internal (drawable,
+ fill_mode,
+ paint_mode, opacity,
+ fill_transparent, fill_criterion,
+ threshold, sample_merged,
+ x, y,
+ &color, pattern);
return TRUE;
}
-void
-gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
- GimpBucketFillMode fill_mode,
- gint paint_mode,
- gdouble opacity,
- gboolean do_seed_fill,
- gboolean fill_transparent,
- GimpSelectCriterion fill_criterion,
- gdouble threshold,
- gboolean sample_merged,
- gdouble x,
- gdouble y,
- const GimpRGB *color,
- GimpPattern *pattern)
+
+/* private functions */
+
+static void
+gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
+ GimpBucketFillMode fill_mode,
+ gint paint_mode,
+ gdouble opacity,
+ gboolean fill_transparent,
+ GimpSelectCriterion fill_criterion,
+ gdouble threshold,
+ gboolean sample_merged,
+ gdouble x,
+ gdouble y,
+ const GimpRGB *color,
+ GimpPattern *pattern)
{
GimpImage *image;
TileManager *buf_tiles;
@@ -173,82 +187,70 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
* contiguous region. If there is a selection, calculate the
* intersection of this region with the existing selection.
*/
- if (do_seed_fill)
+ mask = gimp_image_contiguous_region_by_seed (image, drawable,
+ sample_merged,
+ TRUE,
+ (gint) threshold,
+ fill_transparent,
+ fill_criterion,
+ (gint) x,
+ (gint) y);
+
+ if (selection)
{
- mask = gimp_image_contiguous_region_by_seed (image, drawable,
- sample_merged,
- TRUE,
- (gint) threshold,
- fill_transparent,
- fill_criterion,
- (gint) x,
- (gint) y);
-
- if (selection)
- {
- gint off_x = 0;
- gint off_y = 0;
+ gint off_x = 0;
+ gint off_y = 0;
- if (! sample_merged)
- gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+ if (! sample_merged)
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
- gimp_channel_combine_mask (mask, gimp_image_get_mask (image),
- GIMP_CHANNEL_OP_INTERSECT,
- -off_x, -off_y);
- }
-
- gimp_channel_bounds (mask, &x1, &y1, &x2, &y2);
+ gimp_channel_combine_mask (mask, gimp_image_get_mask (image),
+ GIMP_CHANNEL_OP_INTERSECT,
+ -off_x, -off_y);
+ }
- /* make sure we handle the mask correctly if it was sample-merged */
- if (sample_merged)
- {
- GimpItem *item;
- gint off_x, off_y;
+ gimp_channel_bounds (mask, &x1, &y1, &x2, &y2);
- item = GIMP_ITEM (drawable);
+ /* make sure we handle the mask correctly if it was sample-merged */
+ if (sample_merged)
+ {
+ GimpItem *item;
+ gint off_x, off_y;
- /* Limit the channel bounds to the drawable's extents */
- gimp_item_get_offset (item, &off_x, &off_y);
+ item = GIMP_ITEM (drawable);
- x1 = CLAMP (x1, off_x, (off_x + gimp_item_get_width (item)));
- y1 = CLAMP (y1, off_y, (off_y + gimp_item_get_height (item)));
- x2 = CLAMP (x2, off_x, (off_x + gimp_item_get_width (item)));
- y2 = CLAMP (y2, off_y, (off_y + gimp_item_get_height (item)));
+ /* Limit the channel bounds to the drawable's extents */
+ gimp_item_get_offset (item, &off_x, &off_y);
- pixel_region_init (&maskPR,
- gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
- x1, y1, (x2 - x1), (y2 - y1), TRUE);
+ x1 = CLAMP (x1, off_x, (off_x + gimp_item_get_width (item)));
+ y1 = CLAMP (y1, off_y, (off_y + gimp_item_get_height (item)));
+ x2 = CLAMP (x2, off_x, (off_x + gimp_item_get_width (item)));
+ y2 = CLAMP (y2, off_y, (off_y + gimp_item_get_height (item)));
- /* translate mask bounds to drawable coords */
- x1 -= off_x;
- y1 -= off_y;
- x2 -= off_x;
- y2 -= off_y;
- }
- else
- {
- pixel_region_init (&maskPR,
- gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
- x1, y1, (x2 - x1), (y2 - y1), TRUE);
- }
+ pixel_region_init (&maskPR,
+ gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
+ x1, y1, (x2 - x1), (y2 - y1), TRUE);
- /* if the image doesn't have an alpha channel, make sure that
- * the buf_tiles have. We need the alpha channel to fill with
- * the region calculated above
- */
- if (! gimp_drawable_has_alpha (drawable))
- bytes++;
+ /* translate mask bounds to drawable coords */
+ x1 -= off_x;
+ y1 -= off_y;
+ x2 -= off_x;
+ y2 -= off_y;
}
- else if (fill_mode == GIMP_PATTERN_BUCKET_FILL &&
- (pat_buf->bytes == 2 || pat_buf->bytes == 4))
+ else
{
- /* If pattern being applied has an alpha channel, add one to the
- * buf_tiles.
- */
- if (! gimp_drawable_has_alpha (drawable))
- bytes++;
+ pixel_region_init (&maskPR,
+ gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
+ x1, y1, (x2 - x1), (y2 - y1), TRUE);
}
+ /* if the image doesn't have an alpha channel, make sure that
+ * the buf_tiles have. We need the alpha channel to fill with
+ * the region calculated above
+ */
+ if (! gimp_drawable_has_alpha (drawable))
+ bytes++;
+
buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
@@ -256,17 +258,11 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
{
case GIMP_FG_BUCKET_FILL:
case GIMP_BG_BUCKET_FILL:
- if (mask)
- color_region_mask (&bufPR, &maskPR, col);
- else
- color_region (&bufPR, col);
+ color_region_mask (&bufPR, &maskPR, col);
break;
case GIMP_PATTERN_BUCKET_FILL:
- if (mask)
- pattern_region (&bufPR, &maskPR, pat_buf, x1, y1);
- else
- pattern_region (&bufPR, NULL, pat_buf, x1, y1);
+ pattern_region (&bufPR, &maskPR, pat_buf, x1, y1);
break;
}
@@ -278,12 +274,10 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
NULL, NULL, x1, y1);
tile_manager_unref (buf_tiles);
- /* update the image */
gimp_drawable_update (drawable, x1, y1, x2 - x1, y2 - y1);
/* free the mask */
- if (mask)
- g_object_unref (mask);
+ g_object_unref (mask);
if (new_buf)
temp_buf_free (pat_buf);
diff --git a/app/core/gimpdrawable-bucket-fill.h b/app/core/gimpdrawable-bucket-fill.h
index c19bed0..2804d28 100644
--- a/app/core/gimpdrawable-bucket-fill.h
+++ b/app/core/gimpdrawable-bucket-fill.h
@@ -19,33 +19,18 @@
#define __GIMP_DRAWABLE_BUCKET_FILL_H__
-gboolean gimp_drawable_bucket_fill (GimpDrawable *drawable,
- GimpContext *context,
- GimpBucketFillMode fill_mode,
- gint paint_mode,
- gdouble opacity,
- gboolean do_seed_fill,
- gboolean fill_transparent,
- GimpSelectCriterion fill_criterion,
- gdouble threshold,
- gboolean sample_merged,
- gdouble x,
- gdouble y,
- GError **error);
-
-void gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
- GimpBucketFillMode fill_mode,
- gint paint_mode,
- gdouble opacity,
- gboolean do_seed_fill,
- gboolean fill_transparent,
- GimpSelectCriterion fill_criterion,
- gdouble threshold,
- gboolean sample_merged,
- gdouble x,
- gdouble y,
- const GimpRGB *color,
- GimpPattern *pattern);
+gboolean gimp_drawable_bucket_fill (GimpDrawable *drawable,
+ GimpContext *context,
+ GimpBucketFillMode fill_mode,
+ gint paint_mode,
+ gdouble opacity,
+ gboolean fill_transparent,
+ GimpSelectCriterion fill_criterion,
+ gdouble threshold,
+ gboolean sample_merged,
+ gdouble x,
+ gdouble y,
+ GError **error);
#endif /* __GIMP_DRAWABLE_BUCKET_FILL_H__ */
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
index ad40b7f..8d68b3c 100644
--- a/app/pdb/edit-cmds.c
+++ b/app/pdb/edit-cmds.c
@@ -605,7 +605,6 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
{
success = gimp_drawable_bucket_fill (drawable, context, fill_mode,
paint_mode, opacity / 100.0,
- TRUE,
FALSE /* don't fill transparent */,
GIMP_SELECT_CRITERION_COMPOSITE,
threshold, sample_merged, x, y,
@@ -676,7 +675,6 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
{
success = gimp_drawable_bucket_fill (drawable, context, fill_mode,
paint_mode, opacity / 100.0,
- TRUE,
fill_transparent,
select_criterion,
threshold, sample_merged, x, y,
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index f08742b..87237f0 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -206,7 +206,6 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
options->fill_mode,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
- TRUE,
options->fill_transparent,
options->fill_criterion,
options->threshold,
diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb
index 573dff3..65d8879 100644
--- a/tools/pdbgen/pdb/edit.pdb
+++ b/tools/pdbgen/pdb/edit.pdb
@@ -649,7 +649,6 @@ HELP
{
success = gimp_drawable_bucket_fill (drawable, context, fill_mode,
paint_mode, opacity / 100.0,
- TRUE,
FALSE /* don't fill transparent */,
GIMP_SELECT_CRITERION_COMPOSITE,
threshold, sample_merged, x, y,
@@ -748,7 +747,6 @@ HELP
{
success = gimp_drawable_bucket_fill (drawable, context, fill_mode,
paint_mode, opacity / 100.0,
- TRUE,
fill_transparent,
select_criterion,
threshold, sample_merged, x, y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]