[gimp/goat-invasion] app: hack badly to make gimp_channel_new_from_component() work



commit e57a8f8af646ecc219f60682db71e73b752eec90
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 16 00:44:06 2012 +0200

    app: hack badly to make gimp_channel_new_from_component() work
    
    insert an intermediate copy to work around an unclear bug that will go
    away once we use native GeglBuffers.

 app/core/gimpchannel.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 435d746..02b35dc 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1704,9 +1704,27 @@ gimp_channel_new_from_component (GimpImage       *image,
 
   dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
 
-  gegl_buffer_set_format (dest_buffer, format);
-  gegl_buffer_copy (src_buffer, NULL, dest_buffer, NULL);
-  gegl_buffer_set_format (dest_buffer, NULL);
+  if (TRUE)
+    {
+      GeglBuffer *temp;
+
+      temp = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
+                              gimp_drawable_get_format (GIMP_DRAWABLE (channel)));
+
+      gegl_buffer_set_format (temp, format);
+      gegl_buffer_copy (src_buffer, NULL, temp, NULL);
+      gegl_buffer_set_format (temp, NULL);
+
+      gegl_buffer_copy (temp, NULL, dest_buffer, NULL);
+
+      g_object_unref (temp);
+    }
+  else
+    {
+      gegl_buffer_set_format (dest_buffer, format);
+      gegl_buffer_copy (src_buffer, NULL, dest_buffer, NULL);
+      gegl_buffer_set_format (dest_buffer, NULL);
+    }
 
   return channel;
 }



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