gimp r27389 - in branches/gimp-2-6: . app/core app/gegl



Author: neo
Date: Fri Oct 24 15:56:57 2008
New Revision: 27389
URL: http://svn.gnome.org/viewvc/gimp?rev=27389&view=rev

Log:
2008-10-24  Sven Neumann  <sven gimp org>

	* app/gegl/gimp-gegl-utils.[ch]: added 
gimp_gegl_check_version(),
	a run-time GEGL version check.

	* app/core/gimpimagemap.c (gimp_image_map_apply): use the new
	function to determine the names of the GEGL ops to use.



Modified:
   branches/gimp-2-6/ChangeLog
   branches/gimp-2-6/app/core/gimpimagemap.c
   branches/gimp-2-6/app/gegl/gimp-gegl-utils.c
   branches/gimp-2-6/app/gegl/gimp-gegl-utils.h

Modified: branches/gimp-2-6/app/core/gimpimagemap.c
==============================================================================
--- branches/gimp-2-6/app/core/gimpimagemap.c	(original)
+++ branches/gimp-2-6/app/core/gimpimagemap.c	Fri Oct 24 15:56:57 2008
@@ -29,6 +29,8 @@
 
 #include "paint-funcs/paint-funcs.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "gimpdrawable.h"
 #include "gimpdrawable-shadow.h"
 #include "gimpimage.h"
@@ -455,6 +457,8 @@
     {
       if (! image_map->gegl)
         {
+	  const gchar *shift_name;
+
           image_map->gegl = gegl_node_new ();
 
           if (g_object_class_find_property (
@@ -466,9 +470,12 @@
                                  "operation", "gimp-tilemanager-source",
                                  NULL);
 
+	  shift_name =
+	    gimp_gegl_check_version (0, 0, 21) ? "gegl:shift" : "shift";
+
           image_map->shift =
             gegl_node_new_child (image_map->gegl,
-                                 "operation", "shift",
+                                 "operation", shift_name,
                                  NULL);
 
           gegl_node_add_child (image_map->gegl, image_map->operation);
@@ -510,9 +517,15 @@
                *  source OP, blend its result on top of the original
                *  pixels.
                */
-              GeglNode *over = gegl_node_new_child (image_map->gegl,
-                                                    "operation", "over",
-                                                    NULL);
+	      const gchar *over_name;
+              GeglNode    *over;
+
+	      over_name =
+		gimp_gegl_check_version (0, 0, 21) ? "gegl:over" : "over";
+
+	      over = gegl_node_new_child (image_map->gegl,
+					  "operation", over_name,
+					  NULL);
 
               gegl_node_link_many (image_map->input,
                                    image_map->shift,

Modified: branches/gimp-2-6/app/gegl/gimp-gegl-utils.c
==============================================================================
--- branches/gimp-2-6/app/gegl/gimp-gegl-utils.c	(original)
+++ branches/gimp-2-6/app/gegl/gimp-gegl-utils.c	Fri Oct 24 15:56:57 2008
@@ -85,3 +85,27 @@
 
   return NULL;
 }
+
+/**
+ * gimp_gegl_check_version:
+ * @required_major: the required major version.
+ * @required_minor: the required minor version.
+ * @required_micro: the required micro version.
+ * 
+ * Return value: %TRUE if the GEGL library in use is the given
+ *               version or newer, %FALSE otherwise
+ */
+gboolean
+gimp_gegl_check_version (guint required_major,
+			 guint required_minor,
+			 guint required_micro)
+{
+  gint major, minor, micro;
+
+  if (required_major != GEGL_MAJOR_VERSION)
+    return FALSE; /* major mismatch */
+
+  gegl_get_version (&major, &minor, &micro);
+
+  return (100 * minor + micro >= 100 * required_minor + required_micro);
+}

Modified: branches/gimp-2-6/app/gegl/gimp-gegl-utils.h
==============================================================================
--- branches/gimp-2-6/app/gegl/gimp-gegl-utils.h	(original)
+++ branches/gimp-2-6/app/gegl/gimp-gegl-utils.h	Fri Oct 24 15:56:57 2008
@@ -26,6 +26,9 @@
 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;
 
+gboolean     gimp_gegl_check_version        (guint required_major,
+					     guint required_minor,
+					     guint required_micro);
 
 
 #endif /* __GIMP_GEGL_UTILS_H__ */



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