remove function gimp_bpp_to_babl_format_linear() and add "gboolean linear"

2008-10-13  Michael Natterer  <mitch@gimp.org>

	* app/gegl/gimp-gegl-utils.[ch]: remove function
	gimp_bpp_to_babl_format_linear() and add "gboolean linear"
	parameter to gimp_bpp_to_babl_format().

	* app/gegl/gimpoperationtilesink.c (process)
	* app/gegl/gimpoperationtilesource.c (prepare): simply pass
	self->linear to above changed function instead of selecting
	between the two old functions.


svn path=/trunk/; revision=27275
This commit is contained in:
Michael Natterer 2008-10-14 09:19:37 +00:00 committed by Michael Natterer
parent 121785c0ed
commit 79463b2065
5 changed files with 45 additions and 52 deletions

View File

@ -1,3 +1,14 @@
2008-10-13 Michael Natterer <mitch@gimp.org>
* app/gegl/gimp-gegl-utils.[ch]: remove function
gimp_bpp_to_babl_format_linear() and add "gboolean linear"
parameter to gimp_bpp_to_babl_format().
* app/gegl/gimpoperationtilesink.c (process)
* app/gegl/gimpoperationtilesource.c (prepare): simply pass
self->linear to above changed function instead of selecting
between the two old functions.
2008-10-14 Sven Neumann <sven@gimp.org>
* app/signals.c (gimp_init_signal_handlers): comments.

View File

@ -31,56 +31,46 @@
/**
* gimp_bpp_to_babl_format:
* @bpp: bytes per pixel
* @linear: whether the pixels are linear or gamma-corrected.
*
* Return the Babl format to use for a given number of bytes per pixel.
* This function assumes that the data is 8bit gamma-corrected data.
* This function assumes that the data is 8bit.
*
* Return value: the Babl format to use
**/
const Babl *
gimp_bpp_to_babl_format (guint bpp)
gimp_bpp_to_babl_format (guint bpp,
gboolean linear)
{
g_return_val_if_fail (bpp > 0 && bpp <= 4, NULL);
switch (bpp)
if (linear)
{
case 1:
return babl_format ("Y' u8");
case 2:
return babl_format ("Y'A u8");
case 3:
return babl_format ("R'G'B' u8");
case 4:
return babl_format ("R'G'B'A u8");
switch (bpp)
{
case 1:
return babl_format ("Y u8");
case 2:
return babl_format ("YA u8");
case 3:
return babl_format ("RGB u8");
case 4:
return babl_format ("RGBA u8");
}
}
return NULL;
}
/**
* gimp_bpp_to_babl_format_linear:
* @bpp: bytes per pixel
*
* Return the Babl format to use for a given number of bytes per pixel.
* This function assumes that the data is 8bit linear.
*
* Return value: the Babl format to use
**/
const Babl *
gimp_bpp_to_babl_format_linear (guint bpp)
{
g_return_val_if_fail (bpp > 0 && bpp <= 4, NULL);
switch (bpp)
else
{
case 1:
return babl_format ("Y u8");
case 2:
return babl_format ("YA u8");
case 3:
return babl_format ("RGB u8");
case 4:
return babl_format ("RGBA u8");
switch (bpp)
{
case 1:
return babl_format ("Y' u8");
case 2:
return babl_format ("Y'A u8");
case 3:
return babl_format ("R'G'B' u8");
case 4:
return babl_format ("R'G'B'A u8");
}
}
return NULL;

View File

@ -23,8 +23,8 @@
#define __GIMP_GEGL_UTILS_H__
const Babl * gimp_bpp_to_babl_format (guint bpp) G_GNUC_CONST;
const Babl * gimp_bpp_to_babl_format_linear (guint bpp) G_GNUC_CONST;
const Babl * gimp_bpp_to_babl_format (guint bpp,
gboolean linear) G_GNUC_CONST;
const gchar * gimp_layer_mode_to_gegl_operation (GimpLayerModeEffects mode) G_GNUC_CONST;

View File

@ -196,18 +196,13 @@ gimp_operation_tile_sink_process (GeglOperation *operation,
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (operation);
const Babl *format;
PixelRegion destPR;
guint bpp;
gpointer pr;
if (! self->tile_manager)
return FALSE;
bpp = tile_manager_bpp (self->tile_manager);
if (self->linear)
format = gimp_bpp_to_babl_format_linear (bpp);
else
format = gimp_bpp_to_babl_format (bpp);
format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
self->linear);
pixel_region_init (&destPR, self->tile_manager,
result->x, result->y,

View File

@ -186,12 +186,9 @@ gimp_operation_tile_source_prepare (GeglOperation *operation)
if (self->tile_manager)
{
const Babl *format;
guint bpp = tile_manager_bpp (self->tile_manager);
if (self->linear)
format = gimp_bpp_to_babl_format_linear (bpp);
else
format = gimp_bpp_to_babl_format (bpp);
format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
self->linear);
gegl_operation_set_format (operation, "output", format);
}