app/core/gimpchannel.[ch] reordered GimpChannel::is_empty() after

2003-09-04  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpchannel.[ch]
	* app/core/gimpselection.c: reordered GimpChannel::is_empty()
	after GimpChannel::boudary() and GimpChannel::bounds() because it
	belongs to that group of functions.
This commit is contained in:
Michael Natterer 2003-09-04 13:45:31 +00:00 committed by Michael Natterer
parent 430b96b682
commit ce437b5870
4 changed files with 62 additions and 54 deletions

View File

@ -1,3 +1,10 @@
2003-09-04 Michael Natterer <mitch@gimp.org>
* app/core/gimpchannel.[ch]
* app/core/gimpselection.c: reordered GimpChannel::is_empty()
after GimpChannel::boudary() and GimpChannel::bounds() because it
belongs to that group of functions.
2003-09-04 Simon Budig <simon@gimp.org>
* app/vectors/gimpbezierstroke.c: Bah. Fixed stupid error from

View File

@ -115,10 +115,10 @@ static gboolean gimp_channel_real_bounds (GimpChannel *channel,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static gint gimp_channel_real_value (GimpChannel *channel,
gint x,
gint y);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static void gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
@ -219,8 +219,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
klass->boundary = gimp_channel_real_boundary;
klass->bounds = gimp_channel_real_bounds;
klass->value = gimp_channel_real_value;
klass->is_empty = gimp_channel_real_is_empty;
klass->value = gimp_channel_real_value;
klass->feather = gimp_channel_real_feather;
klass->sharpen = gimp_channel_real_sharpen;
klass->clear = gimp_channel_real_clear;
@ -832,38 +832,6 @@ gimp_channel_real_bounds (GimpChannel *channel,
return ! channel->empty;
}
static gint
gimp_channel_real_value (GimpChannel *channel,
gint x,
gint y)
{
Tile *tile;
gint val;
/* Some checks to cut back on unnecessary work */
if (channel->bounds_known)
{
if (channel->empty)
return 0;
else if (x < channel->x1 || x >= channel->x2 ||
y < channel->y1 || y >= channel->y2)
return 0;
}
else
{
if (x < 0 || x >= GIMP_ITEM (channel)->width ||
y < 0 || y >= GIMP_ITEM (channel)->height)
return 0;
}
tile = tile_manager_get_tile (GIMP_DRAWABLE (channel)->tiles, x, y,
TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;
}
static gboolean
gimp_channel_real_is_empty (GimpChannel *channel)
{
@ -917,6 +885,38 @@ gimp_channel_real_is_empty (GimpChannel *channel)
return TRUE;
}
static gint
gimp_channel_real_value (GimpChannel *channel,
gint x,
gint y)
{
Tile *tile;
gint val;
/* Some checks to cut back on unnecessary work */
if (channel->bounds_known)
{
if (channel->empty)
return 0;
else if (x < channel->x1 || x >= channel->x2 ||
y < channel->y1 || y >= channel->y2)
return 0;
}
else
{
if (x < 0 || x >= GIMP_ITEM (channel)->width ||
y < 0 || y >= GIMP_ITEM (channel)->height)
return 0;
}
tile = tile_manager_get_tile (GIMP_DRAWABLE (channel)->tiles, x, y,
TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;
}
static void
gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
@ -1552,6 +1552,14 @@ gimp_channel_bounds (GimpChannel *channel,
return GIMP_CHANNEL_GET_CLASS (channel)->bounds (channel, x1, y1, x2, y2);
}
gboolean
gimp_channel_is_empty (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel);
}
gint
gimp_channel_value (GimpChannel *channel,
gint x,
@ -1562,14 +1570,6 @@ gimp_channel_value (GimpChannel *channel,
return GIMP_CHANNEL_GET_CLASS (channel)->value (channel, x, y);
}
gboolean
gimp_channel_is_empty (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel);
}
void
gimp_channel_feather (GimpChannel *channel,
gdouble radius_x,

View File

@ -74,10 +74,11 @@ struct _GimpChannelClass
gint *y1,
gint *x2,
gint *y2);
gboolean (* is_empty) (GimpChannel *channel);
gint (* value) (GimpChannel *channel,
gint x,
gint y);
gboolean (* is_empty) (GimpChannel *channel);
void (* feather) (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
@ -175,10 +176,10 @@ gboolean gimp_channel_bounds (GimpChannel *mask,
gint *y1,
gint *x2,
gint *y2);
gboolean gimp_channel_is_empty (GimpChannel *mask);
gint gimp_channel_value (GimpChannel *mask,
gint x,
gint y);
gboolean gimp_channel_is_empty (GimpChannel *mask);
void gimp_channel_feather (GimpChannel *mask,
gdouble radius_x,

View File

@ -84,10 +84,10 @@ static gboolean gimp_selection_bounds (GimpChannel *channel,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_selection_is_empty (GimpChannel *channel);
static gint gimp_selection_value (GimpChannel *channel,
gint x,
gint y);
static gboolean gimp_selection_is_empty (GimpChannel *channel);
static void gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
@ -175,8 +175,8 @@ gimp_selection_class_init (GimpSelectionClass *klass)
channel_class->boundary = gimp_selection_boundary;
channel_class->bounds = gimp_selection_bounds;
channel_class->value = gimp_selection_value;
channel_class->is_empty = gimp_selection_is_empty;
channel_class->value = gimp_selection_value;
channel_class->feather = gimp_selection_feather;
channel_class->sharpen = gimp_selection_sharpen;
channel_class->clear = gimp_selection_clear;
@ -444,14 +444,6 @@ gimp_selection_bounds (GimpChannel *channel,
return GIMP_CHANNEL_CLASS (parent_class)->bounds (channel, x1, y1, x2, y2);
}
static gint
gimp_selection_value (GimpChannel *channel,
gint x,
gint y)
{
return GIMP_CHANNEL_CLASS (parent_class)->value (channel, x, y);
}
static gboolean
gimp_selection_is_empty (GimpChannel *channel)
{
@ -467,6 +459,14 @@ gimp_selection_is_empty (GimpChannel *channel)
return GIMP_CHANNEL_CLASS (parent_class)->is_empty (channel);
}
static gint
gimp_selection_value (GimpChannel *channel,
gint x,
gint y)
{
return GIMP_CHANNEL_CLASS (parent_class)->value (channel, x, y);
}
static void
gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,