[gimp/goat-invasion: 126/608] app: stop using gegl_color_set_pixel() with hand-transformed pixels



commit 79106dd4c1c5cf24e12a6a4dfcf5fd8c6eeb842e
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 18 16:52:07 2012 +0100

    app: stop using gegl_color_set_pixel() with hand-transformed pixels
    
    instead, simply use rgb values and rely on the subsequent
    gegl_buffer_set_color() to do the right thing because the buffer know
    their indexed format now.

 app/core/gimpdrawable.c    |    9 +++++----
 app/core/gimpimage-merge.c |    8 +++-----
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index e890c82..f665d1f 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -591,15 +591,16 @@ gimp_drawable_resize (GimpItem    *item,
     {
       /*  Clear the new tiles if needed  */
 
+      GimpRGB    bg;
       GeglColor *col;
-      guchar     bg[MAX_CHANNELS] = { 0, };
 
       if (! gimp_drawable_has_alpha (drawable) && ! GIMP_IS_CHANNEL (drawable))
-        gimp_image_get_background (gimp_item_get_image (item), context,
-                                   gimp_drawable_type (drawable), bg);
+        gimp_context_get_background (context, &bg);
+      else
+        gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
 
       col = gegl_color_new (NULL);
-      gegl_color_set_pixel (col, gimp_drawable_get_format (drawable), bg);
+      gimp_gegl_color_set_rgba (col, &bg);
 
       gegl_buffer_set_color (dest_buffer, NULL, col);
 
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 5679bba..705daca 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -524,7 +524,7 @@ gimp_image_merge_layers (GimpImage     *image,
       GeglColor     *color;
       GeglRectangle  rect = { 0, };
       GimpImageType  type;
-      guchar         bg[4] = { 0, 0, 0, 0 };
+      GimpRGB        bg;
 
       type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
 
@@ -541,15 +541,13 @@ gimp_image_merge_layers (GimpImage     *image,
       gimp_item_set_offset (GIMP_ITEM (merge_layer), x1, y1);
 
       /*  get the background for compositing  */
-      gimp_image_get_background (image, context,
-                                 gimp_drawable_type (GIMP_DRAWABLE (merge_layer)),
-                                 bg);
+      gimp_context_get_background (context, &bg);
 
       rect.width  = x2 - x1;
       rect.height = y2 - y1;
 
       color = gegl_color_new (NULL);
-      gegl_color_set_pixel (color, gimp_drawable_get_format (GIMP_DRAWABLE (merge_layer)), bg);
+      gimp_gegl_color_set_rgba (color, &bg);
 
       gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (merge_layer)),
                              &rect, color);



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