[gimp/blend-tool-fun: 66/163] Bug 478528 - Layer and Image previews are not color managed



commit 0733213b163bf7275e7cf21fdf7416bdb0aec4d6
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 21 20:20:02 2015 +0200

    Bug 478528 - Layer and Image previews are not color managed
    
    Fix color managed layer previews when adding/removing alpha:
    
    Implement GimpDrawable::alpha_changed() in GimpLayer and emit
    GimpColorManaged::profile_changed() so all cached color transforms are
    nuked.

 app/core/gimplayer.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index c2679e2..b901828 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -159,11 +159,12 @@ static void       gimp_layer_to_selection       (GimpItem           *item,
                                                  gdouble             feather_radius_x,
                                                  gdouble             feather_radius_y);
 
-static gint64  gimp_layer_estimate_memsize      (const GimpDrawable *drawable,
+static void       gimp_layer_alpha_changed      (GimpDrawable       *drawable);
+static gint64     gimp_layer_estimate_memsize   (const GimpDrawable *drawable,
                                                  GimpComponentType   component_type,
                                                  gint                width,
                                                  gint                height);
-static void    gimp_layer_convert_type          (GimpDrawable       *drawable,
+static void       gimp_layer_convert_type       (GimpDrawable       *drawable,
                                                  GimpImage          *dest_image,
                                                  const Babl         *new_format,
                                                  GimpImageBaseType   new_base_type,
@@ -333,6 +334,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
   item_class->raise_failed            = _("Layer cannot be raised higher.");
   item_class->lower_failed            = _("Layer cannot be lowered more.");
 
+  drawable_class->alpha_changed         = gimp_layer_alpha_changed;
   drawable_class->estimate_memsize      = gimp_layer_estimate_memsize;
   drawable_class->convert_type          = gimp_layer_convert_type;
   drawable_class->invalidate_boundary   = gimp_layer_invalidate_boundary;
@@ -1021,6 +1023,19 @@ gimp_layer_to_selection (GimpItem       *item,
                              feather, feather_radius_x, feather_radius_y);
 }
 
+static void
+gimp_layer_alpha_changed (GimpDrawable *drawable)
+{
+  if (GIMP_DRAWABLE_CLASS (parent_class)->alpha_changed)
+    GIMP_DRAWABLE_CLASS (parent_class)->alpha_changed (drawable);
+
+  /* When we add/remove alpha, whatever cached color transforms in
+   * view renderers need to be recreated because they cache the wrong
+   * lcms formats. See bug 478528.
+   */
+  gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (drawable));
+}
+
 static gint64
 gimp_layer_estimate_memsize (const GimpDrawable *drawable,
                              GimpComponentType   component_type,


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