code cleanup.

2005-05-31  Sven Neumann  <sven@gimp.org>

	* app/core/gimpprojection-construct.c: code cleanup.
This commit is contained in:
Sven Neumann 2005-05-31 14:49:01 +00:00 committed by Sven Neumann
parent 228762e1f2
commit 5f52d2d515
2 changed files with 29 additions and 20 deletions

View File

@ -1,3 +1,7 @@
2005-05-31 Sven Neumann <sven@gimp.org>
* app/core/gimpprojection-construct.c: code cleanup.
2005-05-31 Michael Natterer <mitch@gimp.org> 2005-05-31 Michael Natterer <mitch@gimp.org>
* app/display/gimpstatusbar.c (gimp_statusbar_init): enable * app/display/gimpstatusbar.c (gimp_statusbar_init): enable

View File

@ -102,6 +102,7 @@ gimp_projection_construct (GimpProjection *proj,
layer = GIMP_DRAWABLE (gimp_container_get_child_by_index (gimage->layers, layer = GIMP_DRAWABLE (gimp_container_get_child_by_index (gimage->layers,
0)); 0));
if (gimp_drawable_has_alpha (layer) && if (gimp_drawable_has_alpha (layer) &&
(gimp_item_get_visible (GIMP_ITEM (layer))) && (gimp_item_get_visible (GIMP_ITEM (layer))) &&
(gimp_item_width (GIMP_ITEM (layer)) == gimage->width) && (gimp_item_width (GIMP_ITEM (layer)) == gimage->width) &&
@ -163,14 +164,12 @@ gimp_projection_construct_layers (GimpProjection *proj,
gint w, gint w,
gint h) gint h)
{ {
GimpLayer *layer; GimpLayer *layer;
gint x1, y1, x2, y2; GList *list;
PixelRegion src1PR, src2PR, maskPR; GList *reverse_list;
PixelRegion * mask; gint x1, y1, x2, y2;
GList *list; gint off_x;
GList *reverse_list; gint off_y;
gint off_x;
gint off_y;
/* composite the floating selection if it exists */ /* composite the floating selection if it exists */
if ((layer = gimp_image_floating_sel (proj->gimage))) if ((layer = gimp_image_floating_sel (proj->gimage)))
@ -182,7 +181,7 @@ gimp_projection_construct_layers (GimpProjection *proj,
list; list;
list = g_list_next (list)) list = g_list_next (list))
{ {
layer = (GimpLayer *) list->data; layer = list->data;
/* only add layers that are visible and not floating selections /* only add layers that are visible and not floating selections
* to the list * to the list
@ -196,7 +195,11 @@ gimp_projection_construct_layers (GimpProjection *proj,
for (list = reverse_list; list; list = g_list_next (list)) 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); gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
@ -223,6 +226,8 @@ gimp_projection_construct_layers (GimpProjection *proj,
/* Otherwise, normal */ /* Otherwise, normal */
else else
{ {
PixelRegion *mask = NULL;
pixel_region_init (&src2PR, pixel_region_init (&src2PR,
gimp_drawable_data (GIMP_DRAWABLE (layer)), gimp_drawable_data (GIMP_DRAWABLE (layer)),
(x1 - off_x), (y1 - off_y), (x1 - off_x), (y1 - off_y),
@ -236,20 +241,20 @@ gimp_projection_construct_layers (GimpProjection *proj,
(x2 - x1), (y2 - y1), FALSE); (x2 - x1), (y2 - y1), FALSE);
mask = &maskPR; mask = &maskPR;
} }
else
mask = NULL;
/* Based on the type of the layer, project the layer onto the /* Based on the type of the layer, project the layer onto the
* projection image... * projection image...
*/ */
switch (gimp_drawable_type (GIMP_DRAWABLE (layer))) 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 */ /* no mask possible */
project_intensity (proj, layer, &src2PR, &src1PR, mask); project_intensity (proj, layer, &src2PR, &src1PR, mask);
break; 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); project_intensity_alpha (proj, layer, &src2PR, &src1PR, mask);
break; break;
@ -280,11 +285,8 @@ gimp_projection_construct_channels (GimpProjection *proj,
gint w, gint w,
gint h) gint h)
{ {
GimpChannel *channel; GList *list;
PixelRegion src1PR; GList *reverse_list = NULL;
PixelRegion src2PR;
GList *list;
GList *reverse_list = NULL;
/* reverse the channel list */ /* reverse the channel list */
for (list = GIMP_LIST (proj->gimage->channels)->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)) 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))) if (gimp_item_get_visible (GIMP_ITEM (channel)))
{ {
PixelRegion src1PR;
PixelRegion src2PR;
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, pixel_region_init (&src1PR,
gimp_projection_get_tiles (proj), gimp_projection_get_tiles (proj),