[gimp] app: fix pass-through group histograms (proactively)



commit 084cbc310221f547ec0859372a1e3cce302e2723
Author: Ell <ell_se yahoo com>
Date:   Tue May 8 03:34:32 2018 -0400

    app: fix pass-through group histograms (proactively)
    
    In gimp_drawable_calculate_histogram(), when including the
    drawable's filters in the histogram (i.e., when calculating the
    histogram of the drawable's source node, rather than its buffer),
    if the drawable is a projectable, call
    gimp_projectable_{begin,end}_render() before/after calculating the
    histogram, respectively.  This is necessary for pass-through
    groups, whose {begin,end}_render() functions disconnect/reconnect
    the group's backdrop from/to the group's layer stack.  If we fail
    to do this, the backdrop is erroneously included in the histogram.
    
    Note that currently layer groups can't have any filters applied to
    them, so we never run into this situation, but once we have non-
    destructive editing we probably will.

 app/core/gimpdrawable-histogram.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpdrawable-histogram.c b/app/core/gimpdrawable-histogram.c
index b7b86b0..8b36de0 100644
--- a/app/core/gimpdrawable-histogram.c
+++ b/app/core/gimpdrawable-histogram.c
@@ -33,6 +33,7 @@
 #include "gimpdrawable-histogram.h"
 #include "gimphistogram.h"
 #include "gimpimage.h"
+#include "gimpprojectable.h"
 
 
 void
@@ -110,7 +111,8 @@ gimp_drawable_calculate_histogram (GimpDrawable  *drawable,
     }
   else
     {
-      GeglBuffer *buffer = gimp_drawable_get_buffer (drawable);
+      GeglBuffer      *buffer      = gimp_drawable_get_buffer (drawable);
+      GimpProjectable *projectable = NULL;
 
       if (with_filters && gimp_drawable_has_filters (drawable))
         {
@@ -141,12 +143,18 @@ gimp_drawable_calculate_histogram (GimpDrawable  *drawable,
                                    G_CALLBACK (gimp_tile_handler_validate_invalidate),
                                    validate, G_CONNECT_SWAPPED);
 #endif
+
+          if (GIMP_IS_PROJECTABLE (drawable))
+            projectable = GIMP_PROJECTABLE (drawable);
         }
       else
         {
           g_object_ref (buffer);
         }
 
+      if (projectable)
+        gimp_projectable_begin_render (projectable);
+
       if (! gimp_channel_is_empty (mask))
         {
           gint off_x, off_y;
@@ -166,6 +174,9 @@ gimp_drawable_calculate_histogram (GimpDrawable  *drawable,
                                     NULL, NULL);
         }
 
+      if (projectable)
+        gimp_projectable_end_render (projectable);
+
       g_object_unref (buffer);
     }
 }


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