[babl] babl: add ability to register user data with BablModel
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: add ability to register user data with BablModel
- Date: Sat, 17 Mar 2012 12:22:29 +0000 (UTC)
commit ba6d0f554ecb85c853135ada91bc049b28448da9
Author: Ãyvind KolÃs <pippin gimp org>
Date: Sat Mar 17 12:18:54 2012 +0000
babl: add ability to register user data with BablModel
The user data is available in the callback functions, no ABI change only
processing functions interested in this data needs to define the arguments,..
keeping ABI compatibility.
babl/babl-conversion.c | 12 +++++++++---
babl/babl-conversion.h | 4 +++-
babl/babl-fish-path.c | 4 ++++
babl/babl-format.h | 4 ++++
babl/babl-internal.h | 1 +
babl/babl-model.c | 4 ++--
babl/babl-model.h | 1 +
7 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 0740d17..a7b3129 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -288,7 +288,9 @@ babl_conversion_linear_process (BablConversion *conversion,
void *destination,
long n)
{
- return conversion->function.linear (source, destination, n);
+ return conversion->function.linear (source, destination, n,
+ conversion->source->model.data,
+ conversion->destination->model.data);
}
static long
@@ -301,7 +303,9 @@ babl_conversion_plane_process (BablConversion *conversion,
{
return conversion->function.plane (source, destination,
src_pitch, dst_pitch,
- n);
+ n,
+ conversion->source->model.data,
+ conversion->destination->model.data);
}
static long
@@ -327,7 +331,9 @@ babl_conversion_planar_process (BablConversion *conversion,
destination->components,
dst_data,
destination->pitch,
- n);
+ n,
+ conversion->source->model.data,
+ conversion->destination->model.data);
}
long
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
index 7b6cd4d..336ec57 100644
--- a/babl/babl-conversion.h
+++ b/babl/babl-conversion.h
@@ -32,7 +32,9 @@ typedef long (*BablFuncPlane) (const char *src,
char *dst,
int src_pitch,
int dst_pitch,
- long n);
+ long n,
+ void *src_model_data,
+ void *dst_model_data);
typedef struct
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 53cb658..c7caa35 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -25,6 +25,7 @@
#define BABL_HARD_MAX_PATH_LENGTH 8
#define BABL_MAX_NAME_LEN 1024
+int babl_in_fish_path = 0;
typedef struct _FishPathInstrumentation
{
@@ -292,8 +293,11 @@ babl_fish_path (const Babl *source,
* a consistent state, this code path is not performance critical
* since created fishes are cached.
*/
+ babl_in_fish_path++;
get_conversion_path (&pc, (Babl *) source, 0, max_path_length ());
+
+ babl_in_fish_path--;
babl_mutex_unlock (babl_format_mutex);
babl_free (pc.current_path);
}
diff --git a/babl/babl-format.h b/babl/babl-format.h
index 68fc87d..4dd4c4c 100644
--- a/babl/babl-format.h
+++ b/babl/babl-format.h
@@ -28,6 +28,10 @@ typedef struct
int components;
BablComponent **component;
BablType **type;
+ void *model_data; /* replicated at same offset as in
+ BablModel, permitting assuming
+ that it is available for both
+ */
void *image_template; /* image template for use with
linear (non-planer) images */
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 02723a5..bf85727 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -220,6 +220,7 @@ babl_fatal (const char *format, ...)
)
extern int babl_hmpf_on_name_lookups;
+extern int babl_in_fish_path;
extern BablMutex *babl_format_mutex;
#define BABL_DEBUG_MEM 0
diff --git a/babl/babl-model.c b/babl/babl-model.c
index df71be4..f35e1a3 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -204,8 +204,8 @@ babl_model_new (void *first_argument,
else
{
if (!is_model_duplicate (babl, components, component))
- babl_fatal ("BablModel '%s' already registered "
- "with different components!", name);
+ babl_fatal ("BablModel '%s' already registered "
+ "with different components!", name);
}
babl_free (name);
diff --git a/babl/babl-model.h b/babl/babl-model.h
index 0a4786b..4561fdb 100644
--- a/babl/babl-model.h
+++ b/babl/babl-model.h
@@ -29,6 +29,7 @@ typedef struct
BablComponent **component;
BablType **type; /*< must be doubles,
used here for convenience in code */
+ void *data; /* used for palette */
} BablModel;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]