gimp r27275 - in trunk: . app/gegl



Author: mitch
Date: Tue Oct 14 09:19:37 2008
New Revision: 27275
URL: http://svn.gnome.org/viewvc/gimp?rev=27275&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/app/gegl/gimp-gegl-utils.c
   trunk/app/gegl/gimp-gegl-utils.h
   trunk/app/gegl/gimpoperationtilesink.c
   trunk/app/gegl/gimpoperationtilesource.c

Modified: trunk/app/gegl/gimp-gegl-utils.c
==============================================================================
--- trunk/app/gegl/gimp-gegl-utils.c	(original)
+++ trunk/app/gegl/gimp-gegl-utils.c	Tue Oct 14 09:19:37 2008
@@ -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;

Modified: trunk/app/gegl/gimp-gegl-utils.h
==============================================================================
--- trunk/app/gegl/gimp-gegl-utils.h	(original)
+++ trunk/app/gegl/gimp-gegl-utils.h	Tue Oct 14 09:19:37 2008
@@ -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;
 

Modified: trunk/app/gegl/gimpoperationtilesink.c
==============================================================================
--- trunk/app/gegl/gimpoperationtilesink.c	(original)
+++ trunk/app/gegl/gimpoperationtilesink.c	Tue Oct 14 09:19:37 2008
@@ -196,18 +196,13 @@
   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,

Modified: trunk/app/gegl/gimpoperationtilesource.c
==============================================================================
--- trunk/app/gegl/gimpoperationtilesource.c	(original)
+++ trunk/app/gegl/gimpoperationtilesource.c	Tue Oct 14 09:19:37 2008
@@ -186,12 +186,9 @@
   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);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]