[gimp/pippin/linear-is-the-new-black: 11/14] app: duplicate normal mode, one linear and one sRGB



commit 67990ec3b2630af02bc77458ed483aaeb0fc7633
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Dec 23 00:42:23 2016 +0100

    app: duplicate normal mode, one linear and one sRGB
    
    The normal mode at the enum position of old normal composites with the sRGB
    gamma TRC, which should make XCFs created with older versions of GIMP using
    normal mode render correctly/as expected, being able to create new compositions
    that blend in non-linear sRGB is also important for testing how things will
    look with default web blending and similar.
    
    Note: XCFs saved with this version of GIMP renders in sRGB TRC/gamma space also
    when using the new normal enum; since unknown layer modes end up being treated
    as normal - such graceful fallback will fail as more linear/non-linear
    alternatives are implemented - maybe we should move over to string based
    encoding fo layer modes instead of letting the enum continue exploding?

 app/actions/context-commands.c          |    3 ++-
 app/actions/layers-commands.c           |    1 +
 app/core/core-enums.c                   |    6 ++++--
 app/core/core-enums.h                   |    3 ++-
 app/gegl/gimp-gegl-nodes.c              |    2 ++
 app/operations/gimplayermodefunctions.c |    3 ++-
 app/pdb/brush-select-cmds.c             |    4 ++--
 app/pdb/brushes-cmds.c                  |    2 +-
 app/pdb/context-cmds.c                  |    4 ++--
 app/pdb/edit-cmds.c                     |    6 +++---
 app/pdb/layer-cmds.c                    |    6 +++---
 app/widgets/gimpwidgets-constructors.c  |    5 +++--
 libgimp/gimpenums.h                     |    5 +++--
 tools/pdbgen/enums.pl                   |    9 +++++----
 14 files changed, 35 insertions(+), 24 deletions(-)
---
diff --git a/app/actions/context-commands.c b/app/actions/context-commands.c
index 449557c..39dff8f 100644
--- a/app/actions/context-commands.c
+++ b/app/actions/context-commands.c
@@ -76,7 +76,8 @@ static const GimpLayerModeEffects paint_modes[] =
   GIMP_LCH_HUE_MODE,
   GIMP_LCH_CHROMA_MODE,
   GIMP_LCH_COLOR_MODE,
-  GIMP_LCH_LIGHTNESS_MODE
+  GIMP_LCH_LIGHTNESS_MODE,
+  GIMP_NORMAL_SRGB_MODE
 };
 
 
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 394fa7b..fd26c1c 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -84,6 +84,7 @@
 static const GimpLayerModeEffects layer_modes[] =
 {
   GIMP_NORMAL_MODE,
+  GIMP_NORMAL_SRGB_MODE,
   GIMP_DISSOLVE_MODE,
   GIMP_MULTIPLY_MODE,
   GIMP_DIVIDE_MODE,
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index cbdcf44..81d6f50 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -289,7 +289,7 @@ gimp_layer_mode_effects_get_type (void)
 {
   static const GEnumValue values[] =
   {
-    { GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-mode" },
+    { GIMP_NORMAL_SRGB_MODE, "GIMP_NORMAL_SRGB_MODE", "normal-srgb-mode" },
     { GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", "dissolve-mode" },
     { GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", "behind-mode" },
     { GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", "multiply-mode" },
@@ -317,6 +317,7 @@ gimp_layer_mode_effects_get_type (void)
     { GIMP_LCH_CHROMA_MODE, "GIMP_LCH_CHROMA_MODE", "lch-chroma-mode" },
     { GIMP_LCH_COLOR_MODE, "GIMP_LCH_COLOR_MODE", "lch-color-mode" },
     { GIMP_LCH_LIGHTNESS_MODE, "GIMP_LCH_LIGHTNESS_MODE", "lch-lightness-mode" },
+    { GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-mode" },
     { GIMP_ERASE_MODE, "GIMP_ERASE_MODE", "erase-mode" },
     { GIMP_REPLACE_MODE, "GIMP_REPLACE_MODE", "replace-mode" },
     { GIMP_ANTI_ERASE_MODE, "GIMP_ANTI_ERASE_MODE", "anti-erase-mode" },
@@ -325,7 +326,7 @@ gimp_layer_mode_effects_get_type (void)
 
   static const GimpEnumDesc descs[] =
   {
-    { GIMP_NORMAL_MODE, NC_("layer-mode-effects", "Normal"), NULL },
+    { GIMP_NORMAL_SRGB_MODE, NC_("layer-mode-effects", "Normal (with sRGB gamma)"), NULL },
     { GIMP_DISSOLVE_MODE, NC_("layer-mode-effects", "Dissolve"), NULL },
     { GIMP_BEHIND_MODE, NC_("layer-mode-effects", "Behind"), NULL },
     { GIMP_MULTIPLY_MODE, NC_("layer-mode-effects", "Multiply"), NULL },
@@ -353,6 +354,7 @@ gimp_layer_mode_effects_get_type (void)
     { GIMP_LCH_CHROMA_MODE, NC_("layer-mode-effects", "Chroma (LCH)"), NULL },
     { GIMP_LCH_COLOR_MODE, NC_("layer-mode-effects", "Color (LCH)"), NULL },
     { GIMP_LCH_LIGHTNESS_MODE, NC_("layer-mode-effects", "Lightness (LCH)"), NULL },
+    { GIMP_NORMAL_MODE, NC_("layer-mode-effects", "Normal"), NULL },
     { GIMP_ERASE_MODE, NC_("layer-mode-effects", "Erase"), NULL },
     { GIMP_REPLACE_MODE, NC_("layer-mode-effects", "Replace"), NULL },
     { GIMP_ANTI_ERASE_MODE, NC_("layer-mode-effects", "Anti erase"), NULL },
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 95616e6..172a5b9 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -154,7 +154,7 @@ GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_NORMAL_MODE,          /*< desc="Normal"               >*/
+  GIMP_NORMAL_SRGB_MODE,     /*< desc="Normal (with sRGB gamma)" >*/
   GIMP_DISSOLVE_MODE,        /*< desc="Dissolve"             >*/
   GIMP_BEHIND_MODE,          /*< desc="Behind"               >*/
   GIMP_MULTIPLY_MODE,        /*< desc="Multiply"             >*/
@@ -182,6 +182,7 @@ typedef enum
   GIMP_LCH_CHROMA_MODE,      /*< desc="Chroma (LCH)"         >*/
   GIMP_LCH_COLOR_MODE,       /*< desc="Color (LCH)"          >*/
   GIMP_LCH_LIGHTNESS_MODE,   /*< desc="Lightness (LCH)"      >*/
+  GIMP_NORMAL_MODE,          /*< desc="Normal"               >*/
 
   /* internal modes, not available to the PDB */
   GIMP_ERASE_MODE      = 1000, /*< pdb-skip, desc="Erase"      >*/
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 7f2a77b..905eda8 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -151,6 +151,7 @@ gimp_gegl_mode_node_set_mode (GeglNode             *node,
   switch (mode)
     {
     case GIMP_NORMAL_MODE:        operation = "gimp:normal-mode"; break;
+    case GIMP_NORMAL_SRGB_MODE:   operation = "gimp:normal-mode"; break;
     case GIMP_DISSOLVE_MODE:      operation = "gimp:dissolve-mode"; break;
     case GIMP_BEHIND_MODE:        operation = "gimp:behind-mode"; break;
     case GIMP_MULTIPLY_MODE:      operation = "gimp:multiply-mode"; break;
@@ -213,6 +214,7 @@ gimp_gegl_mode_node_set_mode (GeglNode             *node,
            "linear",    TRUE,
            NULL);
         break;
+    case GIMP_NORMAL_SRGB_MODE:
     case GIMP_OVERLAY_MODE:
     case GIMP_DIFFERENCE_MODE:
     case GIMP_HUE_MODE:
diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c
index 31cf54a..f1cc537 100644
--- a/app/operations/gimplayermodefunctions.c
+++ b/app/operations/gimplayermodefunctions.c
@@ -66,7 +66,8 @@ get_layer_mode_function (GimpLayerModeEffects paint_mode,
 
   switch (paint_mode)
     {
-      case GIMP_NORMAL_MODE:        func = gimp_operation_normal_mode_process_pixels; break;
+      case GIMP_NORMAL_MODE:        func = gimp_operation_normal_mode_process_pixels; break; // XXX : does 
code using these functions properly
+      case GIMP_NORMAL_SRGB_MODE:   func = gimp_operation_normal_mode_process_pixels; break; // XXX : dealt 
with linear or not?
       case GIMP_DISSOLVE_MODE:      func = gimp_operation_dissolve_mode_process_pixels; break;
       case GIMP_BEHIND_MODE:        func = gimp_operation_behind_mode_process_pixels; break;
       case GIMP_MULTIPLY_MODE:      func = gimp_operation_multiply_mode_process_pixels; break;
diff --git a/app/pdb/brush-select-cmds.c b/app/pdb/brush-select-cmds.c
index a28baff..1999fc3 100644
--- a/app/pdb/brush-select-cmds.c
+++ b/app/pdb/brush-select-cmds.c
@@ -204,7 +204,7 @@ register_brush_select_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The initial paint mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
@@ -278,7 +278,7 @@ register_brush_select_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The initial paint mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
diff --git a/app/pdb/brushes-cmds.c b/app/pdb/brushes-cmds.c
index 30e7e84..5e6fff6 100644
--- a/app/pdb/brushes-cmds.c
+++ b/app/pdb/brushes-cmds.c
@@ -440,7 +440,7 @@ register_brushes_procs (GimpPDB *pdb)
                                                       "paint mode",
                                                       "The paint mode",
                                                       GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                      GIMP_NORMAL_MODE,
+                                                      GIMP_NORMAL_SRGB_MODE,
                                                       GIMP_PARAM_READWRITE));
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_int32 ("width",
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index 7be3ed0..d7926ee 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -3139,7 +3139,7 @@ register_context_procs (GimpPDB *pdb)
                                                       "paint mode",
                                                       "The paint mode",
                                                       GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                      GIMP_NORMAL_MODE,
+                                                      GIMP_NORMAL_SRGB_MODE,
                                                       GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
@@ -3163,7 +3163,7 @@ register_context_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The paint mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
index c792750..3ed4d37 100644
--- a/app/pdb/edit-cmds.c
+++ b/app/pdb/edit-cmds.c
@@ -1349,7 +1349,7 @@ register_edit_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The paint application mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_double ("opacity",
@@ -1416,7 +1416,7 @@ register_edit_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The paint application mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_double ("opacity",
@@ -1496,7 +1496,7 @@ register_edit_procs (GimpPDB *pdb)
                                                   "paint mode",
                                                   "The paint application mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_enum ("gradient-type",
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index f7764ec..c36f154 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -1212,7 +1212,7 @@ register_layer_procs (GimpPDB *pdb)
                                                   "mode",
                                                   "The layer combination mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_layer_id ("layer",
@@ -2148,7 +2148,7 @@ register_layer_procs (GimpPDB *pdb)
                                                       "mode",
                                                       "The layer combination mode",
                                                       GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                      GIMP_NORMAL_MODE,
+                                                      GIMP_NORMAL_SRGB_MODE,
                                                       GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
@@ -2178,7 +2178,7 @@ register_layer_procs (GimpPDB *pdb)
                                                   "mode",
                                                   "The new layer combination mode",
                                                   GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                                  GIMP_NORMAL_MODE,
+                                                  GIMP_NORMAL_SRGB_MODE,
                                                   GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index de47f96..f85fe05 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -104,8 +104,9 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   GtkWidget    *combo;
 
   store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                           25,
+                                           26,
                                            GIMP_NORMAL_MODE,
+                                           GIMP_NORMAL_SRGB_MODE,
                                            GIMP_DISSOLVE_MODE,
 
                                            GIMP_LIGHTEN_ONLY_MODE,
@@ -168,7 +169,7 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   if (with_replace_modes)
     {
       gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
-                                          GIMP_NORMAL_MODE,
+                                          GIMP_NORMAL_SRGB_MODE,
                                           GIMP_REPLACE_MODE);
       gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
                                           GIMP_COLOR_ERASE_MODE,
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index 2f1165e..8ed0265 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -69,7 +69,7 @@ GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_NORMAL_MODE,
+  GIMP_NORMAL_SRGB_MODE,
   GIMP_DISSOLVE_MODE,
   GIMP_BEHIND_MODE,
   GIMP_MULTIPLY_MODE,
@@ -96,7 +96,8 @@ typedef enum
   GIMP_LCH_HUE_MODE,
   GIMP_LCH_CHROMA_MODE,
   GIMP_LCH_COLOR_MODE,
-  GIMP_LCH_LIGHTNESS_MODE
+  GIMP_LCH_LIGHTNESS_MODE,
+  GIMP_NORMAL_MODE
 } GimpLayerModeEffects;
 
 
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index 0d6839f..65827a6 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -694,7 +694,7 @@ package Gimp::CodeGen::enums;
     GimpLayerModeEffects =>
        { contig => 1,
          header => 'core/core-enums.h',
-         symbols => [ qw(GIMP_NORMAL_MODE GIMP_DISSOLVE_MODE
+         symbols => [ qw(GIMP_NORMAL_SRGB_MODE GIMP_DISSOLVE_MODE
                          GIMP_BEHIND_MODE GIMP_MULTIPLY_MODE
                          GIMP_SCREEN_MODE GIMP_OVERLAY_MODE
                          GIMP_DIFFERENCE_MODE GIMP_ADDITION_MODE
@@ -707,8 +707,8 @@ package Gimp::CodeGen::enums;
                          GIMP_GRAIN_MERGE_MODE GIMP_COLOR_ERASE_MODE
                          GIMP_NEW_OVERLAY_MODE GIMP_LCH_HUE_MODE
                          GIMP_LCH_CHROMA_MODE GIMP_LCH_COLOR_MODE
-                         GIMP_LCH_LIGHTNESS_MODE) ],
-         mapping => { GIMP_NORMAL_MODE => '0',
+                         GIMP_LCH_LIGHTNESS_MODE GIMP_NORMAL_MODE) ],
+         mapping => { GIMP_NORMAL_SRGB_MODE => '0',
                       GIMP_DISSOLVE_MODE => '1',
                       GIMP_BEHIND_MODE => '2',
                       GIMP_MULTIPLY_MODE => '3',
@@ -735,7 +735,8 @@ package Gimp::CodeGen::enums;
                       GIMP_LCH_HUE_MODE => '24',
                       GIMP_LCH_CHROMA_MODE => '25',
                       GIMP_LCH_COLOR_MODE => '26',
-                      GIMP_LCH_LIGHTNESS_MODE => '27' }
+                      GIMP_LCH_LIGHTNESS_MODE => '27',
+                      GIMP_NORMAL_MODE => '28' }
        },
     GimpBrushApplicationMode =>
        { contig => 1,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]