[babl] babl: properly cache runtime inserted conversions
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: properly cache runtime inserted conversions
- Date: Fri, 16 Nov 2018 20:49:07 +0000 (UTC)
commit c0a4a98e75d0acb2b572415987711c1ab5fe02ab
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Nov 16 18:27:32 2018 +0100
babl: properly cache runtime inserted conversions
The old behavior of avoiding colliding names used in the conversion database
is still used during loading of extension permitting multiple conversions
to be registered for runtime profiling.
babl/babl-conversion.c | 8 +++++++-
babl/babl.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index a7f7eba..011765c 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -235,7 +235,7 @@ _conversion_new (const char *name,
BABL (babl->conversion.destination),
babl_type_from_id (BABL_DOUBLE));
- {
+ if(0){
const Babl *fish = babl_conversion_find (src_format, dst_format);
if (fish)
return fish;
@@ -284,6 +284,8 @@ create_name (Babl *source, Babl *destination, int type)
const char *
babl_conversion_create_name (Babl *source, Babl *destination, int type);
+int _babl_loaded = 0;
+
const char *
babl_conversion_create_name (Babl *source, Babl *destination, int type)
{
@@ -292,6 +294,9 @@ babl_conversion_create_name (Babl *source, Babl *destination, int type)
int id = 0;
collisions = 0;
name = create_name (source, destination, type);
+
+ if (!_babl_loaded)
+ {
babl = babl_db_exist (db, id, name);
while (babl)
{
@@ -302,6 +307,7 @@ babl_conversion_create_name (Babl *source, Babl *destination, int type)
name = create_name (source, destination, type);
babl = babl_db_exist (db, id, name);
}
+ }
return name;
}
diff --git a/babl/babl.c b/babl/babl.c
index 4479f68..ef2cfb7 100644
--- a/babl/babl.c
+++ b/babl/babl.c
@@ -125,6 +125,8 @@ babl_dir_list (void)
return ret;
}
+extern int _babl_loaded;
+
void
babl_init (void)
{
@@ -133,6 +135,7 @@ babl_init (void)
if (ref_count++ == 0)
{
char * dir_list;
+ _babl_loaded = 0;
babl_internal_init ();
babl_sampling_class_init ();
@@ -155,6 +158,7 @@ babl_init (void)
babl_free (dir_list);
babl_init_db ();
+ _babl_loaded = 1;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]