From 5f52d2d515efeaef98aff6267cb4b438f1a8d487 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 31 May 2005 14:49:01 +0000 Subject: [PATCH] code cleanup. 2005-05-31 Sven Neumann * app/core/gimpprojection-construct.c: code cleanup. --- ChangeLog | 4 +++ app/core/gimpprojection-construct.c | 45 ++++++++++++++++------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57011797b9..75810ee1e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-05-31 Sven Neumann + + * app/core/gimpprojection-construct.c: code cleanup. + 2005-05-31 Michael Natterer * app/display/gimpstatusbar.c (gimp_statusbar_init): enable diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index bba03cff0b..bd2b2a1987 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -102,6 +102,7 @@ gimp_projection_construct (GimpProjection *proj, layer = GIMP_DRAWABLE (gimp_container_get_child_by_index (gimage->layers, 0)); + if (gimp_drawable_has_alpha (layer) && (gimp_item_get_visible (GIMP_ITEM (layer))) && (gimp_item_width (GIMP_ITEM (layer)) == gimage->width) && @@ -163,14 +164,12 @@ gimp_projection_construct_layers (GimpProjection *proj, gint w, gint h) { - GimpLayer *layer; - gint x1, y1, x2, y2; - PixelRegion src1PR, src2PR, maskPR; - PixelRegion * mask; - GList *list; - GList *reverse_list; - gint off_x; - gint off_y; + GimpLayer *layer; + GList *list; + GList *reverse_list; + gint x1, y1, x2, y2; + gint off_x; + gint off_y; /* composite the floating selection if it exists */ if ((layer = gimp_image_floating_sel (proj->gimage))) @@ -182,7 +181,7 @@ gimp_projection_construct_layers (GimpProjection *proj, list; list = g_list_next (list)) { - layer = (GimpLayer *) list->data; + layer = list->data; /* only add layers that are visible and not floating selections * to the list @@ -196,7 +195,11 @@ gimp_projection_construct_layers (GimpProjection *proj, for (list = reverse_list; list; list = g_list_next (list)) { - layer = (GimpLayer *) list->data; + PixelRegion src1PR; + PixelRegion src2PR; + PixelRegion maskPR; + + layer = list->data; gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y); @@ -223,6 +226,8 @@ gimp_projection_construct_layers (GimpProjection *proj, /* Otherwise, normal */ else { + PixelRegion *mask = NULL; + pixel_region_init (&src2PR, gimp_drawable_data (GIMP_DRAWABLE (layer)), (x1 - off_x), (y1 - off_y), @@ -236,20 +241,20 @@ gimp_projection_construct_layers (GimpProjection *proj, (x2 - x1), (y2 - y1), FALSE); mask = &maskPR; } - else - mask = NULL; /* Based on the type of the layer, project the layer onto the * projection image... */ switch (gimp_drawable_type (GIMP_DRAWABLE (layer))) { - case GIMP_RGB_IMAGE: case GIMP_GRAY_IMAGE: + case GIMP_RGB_IMAGE: + case GIMP_GRAY_IMAGE: /* no mask possible */ project_intensity (proj, layer, &src2PR, &src1PR, mask); break; - case GIMP_RGBA_IMAGE: case GIMP_GRAYA_IMAGE: + case GIMP_RGBA_IMAGE: + case GIMP_GRAYA_IMAGE: project_intensity_alpha (proj, layer, &src2PR, &src1PR, mask); break; @@ -280,11 +285,8 @@ gimp_projection_construct_channels (GimpProjection *proj, gint w, gint h) { - GimpChannel *channel; - PixelRegion src1PR; - PixelRegion src2PR; - GList *list; - GList *reverse_list = NULL; + GList *list; + GList *reverse_list = NULL; /* reverse the channel list */ for (list = GIMP_LIST (proj->gimage->channels)->list; @@ -296,10 +298,13 @@ gimp_projection_construct_channels (GimpProjection *proj, for (list = reverse_list; list; list = g_list_next (list)) { - channel = (GimpChannel *) list->data; + GimpChannel *channel = list->data; if (gimp_item_get_visible (GIMP_ITEM (channel))) { + PixelRegion src1PR; + PixelRegion src2PR; + /* configure the pixel regions */ pixel_region_init (&src1PR, gimp_projection_get_tiles (proj),