Re: babl docs

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

On 09/11/2010 07:35 PM, Rupert Weber wrote:

For a moment, I thought that might be a trivial one-liner; but all I got
was a whole lot of 'BablBase: babl-type.c:254 babl_type()
babl_type("double"): hmpf!'... oh, well.

So it's a three-liner now. Hope it's ok that I include it here.
I decided to insert a declaration instead of pulling up the static function to the top, so the patch wouldn't look like stuff has changed that hasn't.
If you want it the other way, let me know or just change it. Either way,


>From 2ef6bb3dfaf596e8361811b24dd2bcc1eb7ec8f6 Mon Sep 17 00:00:00 2001
From: Rupert Weber <gimp@xxxxxxxxxxxxxx>
Date: Sat, 11 Sep 2010 21:17:34 +0200
Subject: [PATCH] create double format for every model

Changes babl_model_new() to create a respective double format
for every new registered model.

That way applications and extensions can rely on the double
format to always exist.
 babl/babl-model.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/babl/babl-model.c b/babl/babl-model.c
index eb7eee4..4766b3b 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -23,6 +23,8 @@
 #include "babl-internal.h"
 #include "babl-db.h"
+static Babl *construct_double_format (Babl *model);
 static int
 babl_model_destroy (void *data)
@@ -169,6 +171,7 @@ babl_model_new (void *first_argument,
       babl = model_new (name, id, components, component);
       babl_db_insert (db, babl);
+      construct_double_format (babl);
@@ -224,7 +227,7 @@ static Babl *construct_double_format (Babl *model)
   int   i;
   argument[args++] = model;
-  argument[args++] = babl_type ("double");
+  argument[args++] = babl_type_from_id (BABL_DOUBLE);
   for (i = 0; i < model->model.components; i++)

Gegl-developer mailing list

[Video For Linux]     [Photo]     [Yosemite News]    [Yosemite Photos]    [gtk]     [GIMP Users]     [KDE]     [Scanner]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]     [Webcams]