[babl] babl: use an enum to internally differentiate rgb, cmyk or gray type spaces
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: use an enum to internally differentiate rgb, cmyk or gray type spaces
- Date: Sun, 18 Aug 2019 22:04:56 +0000 (UTC)
commit d9c757e16ae06cf48373c39559d9d3b02bc33809
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Aug 18 21:06:33 2019 +0200
babl: use an enum to internally differentiate rgb, cmyk or gray type spaces
babl/babl-icc.c | 4 ++--
babl/babl-space.c | 4 ++--
babl/babl-space.h | 10 +++++++++-
3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/babl/babl-icc.c b/babl/babl-icc.c
index 9df1954bb..e37197718 100644
--- a/babl/babl-icc.c
+++ b/babl/babl-icc.c
@@ -840,9 +840,9 @@ babl_space_from_icc (const char *icc_data,
if (!strcmp (color_space.str, "CMYK"))
{
ret = _babl_space_for_lcms (icc_data, icc_length);
- if (ret->space.cmyk.is_cmyk)
+ if (ret->space.icc_type == BablICCTypeCMYK)
return ret;
- ret->space.cmyk.is_cmyk = 1;
+ ret->space.icc_type = BablICCTypeCMYK;
ret->space.icc_length = icc_length;
ret->space.icc_profile = malloc (icc_length);
memcpy (ret->space.icc_profile, icc_data, icc_length);
diff --git a/babl/babl-space.c b/babl/babl-space.c
index d531017e3..7a8d7b1f7 100644
--- a/babl/babl-space.c
+++ b/babl/babl-space.c
@@ -1232,7 +1232,7 @@ babl_space_match_trc_matrix (const Babl *trc_red,
for (i = 0; space_db[i].instance.class_type; i++)
{
BablSpace *space = &space_db[i];
- if (space->cmyk.is_cmyk == 0 &&
+ if (space->icc_type == BablICCTypeRGB &&
trc_red == space->trc[0] &&
trc_green == space->trc[1] &&
trc_blue == space->trc[2] &&
@@ -1306,7 +1306,7 @@ babl_space_get (const Babl *babl,
int
babl_space_is_cmyk (const Babl *space)
{
- return space?space->space.cmyk.is_cmyk:0;
+ return space?space->space.icc_type == BablICCTypeCMYK:0;
}
/* Trademarks:
diff --git a/babl/babl-space.h b/babl/babl-space.h
index 7a905e214..1d9934a20 100644
--- a/babl/babl-space.h
+++ b/babl/babl-space.h
@@ -33,12 +33,13 @@ BABL_CLASS_DECLARE (space);
typedef struct
{
- int is_cmyk;
+ //int is_cmyk;
#ifdef HAVE_LCMS
cmsHPROFILE lcms_profile;
cmsHTRANSFORM lcms_to_rgba;
cmsHTRANSFORM lcms_from_rgba;
#endif
+ int filler;
} BablCMYK;
#if 0 // draft datastructures for spectral spaces
@@ -89,6 +90,12 @@ typedef struct
} BablProcessSpace;
#endif
+typedef enum {
+ BablICCTypeRGB = 0,
+ BablICCTypeGray = 2,
+ BablICCTypeCMYK = 3,
+} BablICCType;
+
typedef struct
{
BablInstance instance;
@@ -124,6 +131,7 @@ typedef struct
*/
char *icc_profile;
int icc_length;
+ BablICCType icc_type;
BablCMYK cmyk;
} BablSpace;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]