diff --git a/ChangeLog b/ChangeLog index 09110f4feb..f5d5425f5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-10-13 Michael Natterer + + * 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 * app/signals.c (gimp_init_signal_handlers): comments. diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c index 7b2ed3804c..d4c86e2d65 100644 --- a/app/gegl/gimp-gegl-utils.c +++ b/app/gegl/gimp-gegl-utils.c @@ -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; diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h index 546dd46d69..659321d4e3 100644 --- a/app/gegl/gimp-gegl-utils.h +++ b/app/gegl/gimp-gegl-utils.h @@ -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; diff --git a/app/gegl/gimpoperationtilesink.c b/app/gegl/gimpoperationtilesink.c index 5208d264b4..45b19237cb 100644 --- a/app/gegl/gimpoperationtilesink.c +++ b/app/gegl/gimpoperationtilesink.c @@ -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, diff --git a/app/gegl/gimpoperationtilesource.c b/app/gegl/gimpoperationtilesource.c index 5e555d61ba..4b4b8b5c30 100644 --- a/app/gegl/gimpoperationtilesource.c +++ b/app/gegl/gimpoperationtilesource.c @@ -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); }