[babl] babl-space: add comments, do not use a static temp struct
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl-space: add comments, do not use a static temp struct
- Date: Wed, 11 Jul 2018 19:11:52 +0000 (UTC)
commit 0b026f9926adaabac00231598e56403cb98064ac
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Jul 11 21:11:17 2018 +0200
babl-space: add comments, do not use a static temp struct
babl/babl-space.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/babl/babl-space.c b/babl/babl-space.c
index 6e8774d..793ab7f 100644
--- a/babl/babl-space.c
+++ b/babl/babl-space.c
@@ -230,9 +230,12 @@ babl_space_from_rgbxyz_matrix (const char *name,
const Babl *trc_blue)
{
int i=0;
- static BablSpace space;
+ BablSpace space;
space.instance.class_type = BABL_SPACE;
space.instance.id = 0;
+ /* it would be better to reconstruct chromaticities - since they
+ * can be asked for with API
+ */
space.xr = rx;
space.yr = gx;
space.xg = bx;
@@ -243,6 +246,7 @@ babl_space_from_rgbxyz_matrix (const char *name,
space.yw = gz;
space.pad = bz;
+
space.whitepoint[0] = wx;
space.whitepoint[1] = wy;
space.whitepoint[2] = wz;
@@ -267,7 +271,9 @@ babl_space_from_rgbxyz_matrix (const char *name,
return NULL;
}
/* transplant matrixes */
- //babl_space_compute_matrices (&space_db[i]);
+
+ /* XXX: there is a potential race condition if making the same space in
+ multiple threads */
space.RGBtoXYZ[0] = rx;
space.RGBtoXYZ[1] = gx;
space.RGBtoXYZ[2] = bx;
@@ -295,7 +301,6 @@ babl_space_from_rgbxyz_matrix (const char *name,
babl_get_name (space.trc[0]),
babl_get_name(space.trc[1]), babl_get_name(space.trc[2]));
-
return (Babl*)&space_db[i];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]