[gimp] app: shuffle precision enum values around to make room for U64
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: shuffle precision enum values around to make room for U64
- Date: Sun, 9 Mar 2014 00:47:19 +0000 (UTC)
commit e7ff0589cb94d9587a17d601880a1783f3d746a0
Author: Michael Natterer <mitch gimp org>
Date: Sun Mar 9 01:44:43 2014 +0100
app: shuffle precision enum values around to make room for U64
and add code to handle the old values from XCF files < version 7.
app/core/core-enums.h | 18 +++++++++---------
app/xcf/xcf-load.c | 19 +++++++++++++++++++
app/xcf/xcf-save.c | 8 ++------
libgimp/gimpenums.h | 18 +++++++++---------
tools/pdbgen/enums.pl | 18 +++++++++---------
5 files changed, 48 insertions(+), 33 deletions(-)
---
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index bab4702..beb09b2 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -63,9 +63,9 @@ typedef enum
GIMP_COMPONENT_TYPE_U8 = 100, /*< desc="8-bit integer" >*/
GIMP_COMPONENT_TYPE_U16 = 200, /*< desc="16-bit integer" >*/
GIMP_COMPONENT_TYPE_U32 = 300, /*< desc="32-bit integer" >*/
- GIMP_COMPONENT_TYPE_HALF = 400, /*< desc="16-bit floating point" >*/
- GIMP_COMPONENT_TYPE_FLOAT = 500, /*< desc="32-bit floating point" >*/
- GIMP_COMPONENT_TYPE_DOUBLE = 600 /*< desc="64-bit floating point" >*/
+ GIMP_COMPONENT_TYPE_HALF = 500, /*< desc="16-bit floating point" >*/
+ GIMP_COMPONENT_TYPE_FLOAT = 600, /*< desc="32-bit floating point" >*/
+ GIMP_COMPONENT_TYPE_DOUBLE = 700 /*< desc="64-bit floating point" >*/
} GimpComponentType;
@@ -369,12 +369,12 @@ typedef enum
GIMP_PRECISION_U16_GAMMA = 250, /*< desc="16-bit gamma integer" >*/
GIMP_PRECISION_U32_LINEAR = 300, /*< desc="32-bit linear integer" >*/
GIMP_PRECISION_U32_GAMMA = 350, /*< desc="32-bit gamma integer" >*/
- GIMP_PRECISION_HALF_LINEAR = 400, /*< desc="16-bit linear floating point" >*/
- GIMP_PRECISION_HALF_GAMMA = 450, /*< desc="16-bit gamma floating point" >*/
- GIMP_PRECISION_FLOAT_LINEAR = 500, /*< desc="32-bit linear floating point" >*/
- GIMP_PRECISION_FLOAT_GAMMA = 550, /*< desc="32-bit gamma floating point" >*/
- GIMP_PRECISION_DOUBLE_LINEAR = 600, /*< desc="64-bit linear floating point" >*/
- GIMP_PRECISION_DOUBLE_GAMMA = 650 /*< desc="64-bit gamma floating point" >*/
+ GIMP_PRECISION_HALF_LINEAR = 500, /*< desc="16-bit linear floating point" >*/
+ GIMP_PRECISION_HALF_GAMMA = 550, /*< desc="16-bit gamma floating point" >*/
+ GIMP_PRECISION_FLOAT_LINEAR = 600, /*< desc="32-bit linear floating point" >*/
+ GIMP_PRECISION_FLOAT_GAMMA = 650, /*< desc="32-bit gamma floating point" >*/
+ GIMP_PRECISION_DOUBLE_LINEAR = 700, /*< desc="64-bit linear floating point" >*/
+ GIMP_PRECISION_DOUBLE_GAMMA = 750 /*< desc="64-bit gamma floating point" >*/
} GimpPrecision;
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 061ee31..a0476fa 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -174,6 +174,25 @@ xcf_load_image (Gimp *gimp,
goto hard_error;
}
}
+ else if (info->file_version == 5 ||
+ info->file_version == 6)
+ {
+ switch (p)
+ {
+ case 100: precision = GIMP_PRECISION_U8_LINEAR; break;
+ case 150: precision = GIMP_PRECISION_U8_GAMMA; break;
+ case 200: precision = GIMP_PRECISION_U16_LINEAR; break;
+ case 250: precision = GIMP_PRECISION_U16_GAMMA; break;
+ case 300: precision = GIMP_PRECISION_U32_LINEAR; break;
+ case 350: precision = GIMP_PRECISION_U32_GAMMA; break;
+ case 400: precision = GIMP_PRECISION_HALF_LINEAR; break;
+ case 450: precision = GIMP_PRECISION_HALF_GAMMA; break;
+ case 500: precision = GIMP_PRECISION_FLOAT_LINEAR; break;
+ case 550: precision = GIMP_PRECISION_FLOAT_GAMMA; break;
+ default:
+ goto hard_error;
+ }
+ }
else
{
precision = p;
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 3d849b8..aaa1109 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -215,16 +215,12 @@ xcf_save_choose_format (XcfInfo *info,
save_version = MAX (3, save_version);
}
- /* need version 5 for high bit depth images */
- if (gimp_image_get_precision (image) != GIMP_PRECISION_U8_GAMMA)
- save_version = MAX (5, save_version);
-
/* need version 6 for new metadata */
if (gimp_image_get_metadata (image))
save_version = MAX (6, save_version);
- /* need version 7 for double precision images */
- if (gimp_image_get_component_type (image) != GIMP_COMPONENT_TYPE_DOUBLE)
+ /* need version 5 for high bit depth images */
+ if (gimp_image_get_precision (image) != GIMP_PRECISION_U8_GAMMA)
save_version = MAX (7, save_version);
info->file_version = save_version;
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index 029c0f5..6bf1282 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -56,9 +56,9 @@ typedef enum
GIMP_COMPONENT_TYPE_U8 = 100,
GIMP_COMPONENT_TYPE_U16 = 200,
GIMP_COMPONENT_TYPE_U32 = 300,
- GIMP_COMPONENT_TYPE_HALF = 400,
- GIMP_COMPONENT_TYPE_FLOAT = 500,
- GIMP_COMPONENT_TYPE_DOUBLE = 600
+ GIMP_COMPONENT_TYPE_HALF = 500,
+ GIMP_COMPONENT_TYPE_FLOAT = 600,
+ GIMP_COMPONENT_TYPE_DOUBLE = 700
} GimpComponentType;
@@ -285,12 +285,12 @@ typedef enum
GIMP_PRECISION_U16_GAMMA = 250,
GIMP_PRECISION_U32_LINEAR = 300,
GIMP_PRECISION_U32_GAMMA = 350,
- GIMP_PRECISION_HALF_LINEAR = 400,
- GIMP_PRECISION_HALF_GAMMA = 450,
- GIMP_PRECISION_FLOAT_LINEAR = 500,
- GIMP_PRECISION_FLOAT_GAMMA = 550,
- GIMP_PRECISION_DOUBLE_LINEAR = 600,
- GIMP_PRECISION_DOUBLE_GAMMA = 650
+ GIMP_PRECISION_HALF_LINEAR = 500,
+ GIMP_PRECISION_HALF_GAMMA = 550,
+ GIMP_PRECISION_FLOAT_LINEAR = 600,
+ GIMP_PRECISION_FLOAT_GAMMA = 650,
+ GIMP_PRECISION_DOUBLE_LINEAR = 700,
+ GIMP_PRECISION_DOUBLE_GAMMA = 750
} GimpPrecision;
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index 4b2378c..d8bff5b 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -425,9 +425,9 @@ package Gimp::CodeGen::enums;
mapping => { GIMP_COMPONENT_TYPE_U8 => '100',
GIMP_COMPONENT_TYPE_U16 => '200',
GIMP_COMPONENT_TYPE_U32 => '300',
- GIMP_COMPONENT_TYPE_HALF => '400',
- GIMP_COMPONENT_TYPE_FLOAT => '500',
- GIMP_COMPONENT_TYPE_DOUBLE => '600' }
+ GIMP_COMPONENT_TYPE_HALF => '500',
+ GIMP_COMPONENT_TYPE_FLOAT => '600',
+ GIMP_COMPONENT_TYPE_DOUBLE => '700' }
},
GimpConvertDitherType =>
{ contig => 1,
@@ -573,12 +573,12 @@ package Gimp::CodeGen::enums;
GIMP_PRECISION_U16_GAMMA => '250',
GIMP_PRECISION_U32_LINEAR => '300',
GIMP_PRECISION_U32_GAMMA => '350',
- GIMP_PRECISION_HALF_LINEAR => '400',
- GIMP_PRECISION_HALF_GAMMA => '450',
- GIMP_PRECISION_FLOAT_LINEAR => '500',
- GIMP_PRECISION_FLOAT_GAMMA => '550',
- GIMP_PRECISION_DOUBLE_LINEAR => '600',
- GIMP_PRECISION_DOUBLE_GAMMA => '650' }
+ GIMP_PRECISION_HALF_LINEAR => '500',
+ GIMP_PRECISION_HALF_GAMMA => '550',
+ GIMP_PRECISION_FLOAT_LINEAR => '600',
+ GIMP_PRECISION_FLOAT_GAMMA => '650',
+ GIMP_PRECISION_DOUBLE_LINEAR => '700',
+ GIMP_PRECISION_DOUBLE_GAMMA => '750' }
},
GimpRotationType =>
{ contig => 1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]