[gimp] Fix loading of layer trees when there is a floating selection
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Fix loading of layer trees when there is a floating selection
- Date: Mon, 31 Aug 2009 13:18:00 +0000 (UTC)
commit cdbb8e169706c5cf08ea6454d69bb510f583a5d9
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 31 15:15:30 2009 +0200
Fix loading of layer trees when there is a floating selection
A floating selection is always the first layer in the image, but on
XCF loading it is attached *after* all layers are loaded, so the item
paths for child layers read from the XCF are off-by-one in their
toplevel index. Adjust them so everything loads as it should.
app/xcf/xcf-load.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 21ccf8f..86b6887 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -210,6 +210,22 @@ xcf_load_image (Gimp *gimp,
if (item_path)
{
+ if (info->floating_sel)
+ {
+ /* there is a floating selection, but it will get
+ * added after all layers are loaded, so toplevel
+ * layer indices are off-by-one. Adjust item paths
+ * accordingly:
+ */
+ gint toplevel_index;
+
+ toplevel_index = GPOINTER_TO_UINT (item_path->data);
+
+ toplevel_index--;
+
+ item_path->data = GUINT_TO_POINTER (toplevel_index);
+ }
+
parent = GIMP_LAYER
(gimp_item_stack_get_parent_by_path (GIMP_ITEM_STACK (layers),
item_path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]