use gimp_image_get_component_index() instead of doing the switch()es

2003-03-23  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpchannel.c (gimp_channel_new_from_component): use
	gimp_image_get_component_index() instead of doing the switch()es
	manually.
This commit is contained in:
Michael Natterer 2003-03-23 10:28:53 +00:00 committed by Michael Natterer
parent 06a2f8b110
commit e1c14d732c
3 changed files with 11 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2003-03-23 Michael Natterer <mitch@gimp.org>
* app/core/gimpchannel.c (gimp_channel_new_from_component): use
gimp_image_get_component_index() instead of doing the switch()es
manually.
2003-03-22 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.c
@ -47,7 +53,7 @@
got from gdk_get_current_event().
* app/widgets/gimpcontainerview.c: check view->hash_table for
being non-NULL before using it. Be prepared to be destroyed by as
being non-NULL before using it. Be prepared to be destroyed as
a result of calling gimp_context_set_foo(view->context, foo).
* app/widgets/gimpcontainertreeview.[ch]: added

View File

@ -291,27 +291,12 @@ gimp_channel_new_from_component (GimpImage *gimage,
PixelRegion dest;
gint width;
gint height;
gint pixel = -1;
gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
switch (type)
{
case GIMP_RED_CHANNEL: pixel = RED_PIX; break;
case GIMP_GREEN_CHANNEL: pixel = GREEN_PIX; break;
case GIMP_BLUE_CHANNEL: pixel = BLUE_PIX; break;
case GIMP_GRAY_CHANNEL: pixel = GRAY_PIX; break;
case GIMP_INDEXED_CHANNEL: pixel = INDEXED_PIX; break;
case GIMP_ALPHA_CHANNEL:
switch (gimp_image_base_type (gimage))
{
case GIMP_RGB: pixel = ALPHA_PIX; break;
case GIMP_GRAY: pixel = ALPHA_G_PIX; break;
case GIMP_INDEXED: pixel = ALPHA_I_PIX; break;
}
break;
}
pixel = gimp_image_get_component_index (gimage, type);
g_return_val_if_fail (pixel != -1, NULL);

View File

@ -291,27 +291,12 @@ gimp_channel_new_from_component (GimpImage *gimage,
PixelRegion dest;
gint width;
gint height;
gint pixel = -1;
gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
switch (type)
{
case GIMP_RED_CHANNEL: pixel = RED_PIX; break;
case GIMP_GREEN_CHANNEL: pixel = GREEN_PIX; break;
case GIMP_BLUE_CHANNEL: pixel = BLUE_PIX; break;
case GIMP_GRAY_CHANNEL: pixel = GRAY_PIX; break;
case GIMP_INDEXED_CHANNEL: pixel = INDEXED_PIX; break;
case GIMP_ALPHA_CHANNEL:
switch (gimp_image_base_type (gimage))
{
case GIMP_RGB: pixel = ALPHA_PIX; break;
case GIMP_GRAY: pixel = ALPHA_G_PIX; break;
case GIMP_INDEXED: pixel = ALPHA_I_PIX; break;
}
break;
}
pixel = gimp_image_get_component_index (gimage, type);
g_return_val_if_fail (pixel != -1, NULL);