[gimp] Bug 758597 - gimp-drawable-get-pixel fails, assertion error in BABL



commit b3239f58dfffe9bb290786976f8102bff69d34eb
Author: Michael Natterer <mitch gimp org>
Date:   Wed Nov 25 00:00:44 2015 +0100

    Bug 758597 - gimp-drawable-get-pixel fails, assertion error in BABL
    
    The code that actually allocates the returned pixel got lost when
    porting this to GEGL.

 app/pdb/drawable-cmds.c       |    3 +++
 tools/pdbgen/pdb/drawable.pdb |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c
index ca1f080..6c2c8ea 100644
--- a/app/pdb/drawable-cmds.c
+++ b/app/pdb/drawable-cmds.c
@@ -624,6 +624,9 @@ drawable_get_pixel_invoker (GimpProcedure         *procedure,
       if (x_coord < gimp_item_get_width  (GIMP_ITEM (drawable)) &&
           y_coord < gimp_item_get_height (GIMP_ITEM (drawable)))
         {
+          num_channels = babl_format_get_bytes_per_pixel (format);
+          pixel = g_new0 (guint8, num_channels);
+
           gegl_buffer_sample (gimp_drawable_get_buffer (drawable),
                               x_coord, y_coord, NULL, pixel, format,
                               GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb
index dc73d75..a9f0ee7 100644
--- a/tools/pdbgen/pdb/drawable.pdb
+++ b/tools/pdbgen/pdb/drawable.pdb
@@ -635,6 +635,9 @@ HELP
   if (x_coord < gimp_item_get_width  (GIMP_ITEM (drawable)) &&
       y_coord < gimp_item_get_height (GIMP_ITEM (drawable)))
     {
+      num_channels = babl_format_get_bytes_per_pixel (format);
+      pixel = g_new0 (guint8, num_channels);
+
       gegl_buffer_sample (gimp_drawable_get_buffer (drawable),
                           x_coord, y_coord, NULL, pixel, format,
                           GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);


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