[gimp] Move variables to local scopes and some minor cleanup
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Move variables to local scopes and some minor cleanup
- Date: Tue, 22 Sep 2009 19:41:50 +0000 (UTC)
commit 01bafc6ea8f1354fef32a1a0f1656de3a6b67a56
Author: Michael Natterer <mitch gimp org>
Date: Tue Sep 22 21:41:24 2009 +0200
Move variables to local scopes and some minor cleanup
app/core/gimpimage-merge.c | 51 ++++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 25 deletions(-)
---
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 3a79541..d07d2a6 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -299,13 +299,9 @@ GimpVectors *
gimp_image_merge_visible_vectors (GimpImage *image,
GError **error)
{
- GList *list = NULL;
- GSList *merge_list = NULL;
- GSList *cur_item = NULL;
- GimpVectors *vectors = NULL;
- GimpVectors *target_vectors = NULL;
- gchar *name = NULL;
- gint pos = 0;
+ GList *list;
+ GList *merge_list = NULL;
+ GimpVectors *vectors;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -317,38 +313,44 @@ gimp_image_merge_visible_vectors (GimpImage *image,
vectors = list->data;
if (gimp_item_get_visible (GIMP_ITEM (vectors)))
- merge_list = g_slist_append (merge_list, vectors);
+ merge_list = g_list_prepend (merge_list, vectors);
}
+ merge_list = g_list_reverse (merge_list);
+
if (merge_list && merge_list->next)
{
+ GimpVectors *target_vectors;
+ gchar *name;
+ gint pos;
+
gimp_set_busy (image->gimp);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE,
_("Merge Visible Paths"));
- cur_item = merge_list;
- vectors = GIMP_VECTORS (cur_item->data);
+ vectors = GIMP_VECTORS (merge_list->data);
name = g_strdup (gimp_object_get_name (vectors));
+ pos = gimp_item_get_index (GIMP_ITEM (vectors));
+
target_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
GIMP_TYPE_VECTORS));
- pos = gimp_item_get_index (GIMP_ITEM (vectors));
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
- cur_item = cur_item->next;
- while (cur_item)
+ for (list = g_list_next (merge_list);
+ list;
+ list = g_list_next (list))
{
- vectors = GIMP_VECTORS (cur_item->data);
+ vectors = list->data;
+
gimp_vectors_add_strokes (vectors, target_vectors);
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
-
- cur_item = g_slist_next (cur_item);
}
gimp_object_take_name (GIMP_OBJECT (target_vectors), name);
- g_slist_free (merge_list);
+ g_list_free (merge_list);
/* FIXME tree */
gimp_image_add_vectors (image, target_vectors, NULL, pos, TRUE);
@@ -395,14 +397,10 @@ gimp_image_merge_layers (GimpImage *image,
GimpLayer *merge_layer;
GimpLayer *layer;
GimpLayer *bottom_layer;
- GimpImageType type;
gint count;
gint x1, y1, x2, y2;
- gint x3, y3, x4, y4;
- CombinationMode operation;
- gint position;
- gboolean active[MAX_CHANNELS] = { TRUE, TRUE, TRUE, TRUE };
gint off_x, off_y;
+ gint position;
gchar *name;
GimpLayer *parent;
@@ -410,7 +408,6 @@ gimp_image_merge_layers (GimpImage *image,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
layer = NULL;
- type = GIMP_RGBA_IMAGE;
x1 = y1 = 0;
x2 = y2 = 0;
bottom_layer = NULL;
@@ -496,7 +493,8 @@ gimp_image_merge_layers (GimpImage *image,
if (merge_type == GIMP_FLATTEN_IMAGE ||
gimp_drawable_type (GIMP_DRAWABLE (layer)) == GIMP_INDEXED_IMAGE)
{
- guchar bg[4] = { 0, 0, 0, 0 };
+ GimpImageType type;
+ guchar bg[4] = { 0, 0, 0, 0 };
type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
@@ -578,7 +576,10 @@ gimp_image_merge_layers (GimpImage *image,
while (reverse_list)
{
- GimpLayerModeEffects mode;
+ CombinationMode operation;
+ GimpLayerModeEffects mode;
+ gint x3, y3, x4, y4;
+ gboolean active[MAX_CHANNELS] = { TRUE, TRUE, TRUE, TRUE };
layer = reverse_list->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]