gimp r27537 - in trunk: . app/core app/pdb app/text app/vectors app/widgets app/xcf tools/pdbgen/pdb



Author: mitch
Date: Mon Nov  3 21:17:50 2008
New Revision: 27537
URL: http://svn.gnome.org/viewvc/gimp?rev=27537&view=rev

Log:
2008-11-03  Michael Natterer  <mitch gimp org>

	* app/core/gimp-edit.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpdrawable.c
	* app/core/gimpdrawablemodundo.c
	* app/core/gimplayer.c
	* app/core/gimplayermask.c
	* app/core/gimpselection.c
	* app/text/gimptext-compat.c
	* app/text/gimptextlayer-xcf.c
	* app/vectors/gimpvectorsmodundo.c
	* app/widgets/gimpviewrendererdrawable.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/layer.pdb: use accessors for item->offset_x,y.
	Some minor unrelated cleanups.

	* app/pdb/layer-cmds.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimp-edit.c
   trunk/app/core/gimpchannel.c
   trunk/app/core/gimpdrawable-transform.c
   trunk/app/core/gimpdrawable.c
   trunk/app/core/gimpdrawablemodundo.c
   trunk/app/core/gimplayer.c
   trunk/app/core/gimplayermask.c
   trunk/app/core/gimpselection.c
   trunk/app/pdb/layer-cmds.c
   trunk/app/text/gimptext-compat.c
   trunk/app/text/gimptextlayer-xcf.c
   trunk/app/vectors/gimpvectorsmodundo.c
   trunk/app/widgets/gimpviewrendererdrawable.c
   trunk/app/xcf/xcf-load.c
   trunk/app/xcf/xcf-save.c
   trunk/tools/pdbgen/pdb/layer.pdb

Modified: trunk/app/core/gimp-edit.c
==============================================================================
--- trunk/app/core/gimp-edit.c	(original)
+++ trunk/app/core/gimp-edit.c	Mon Nov  3 21:17:50 2008
@@ -254,8 +254,7 @@
   offset_x = MAX (offset_x, 0);
   offset_y = MAX (offset_y, 0);
 
-  GIMP_ITEM (layer)->offset_x = offset_x;
-  GIMP_ITEM (layer)->offset_y = offset_y;
+  gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
 
   /*  Start a group undo  */
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,

Modified: trunk/app/core/gimpchannel.c
==============================================================================
--- trunk/app/core/gimpchannel.c	(original)
+++ trunk/app/core/gimpchannel.c	Mon Nov  3 21:17:50 2008
@@ -431,7 +431,7 @@
       if (gimp_drawable_has_alpha (drawable))
         new_type = GIMP_IMAGE_TYPE_WITH_ALPHA (new_type);
 
-      new_tiles = tile_manager_new (gimp_item_get_width (item),
+      new_tiles = tile_manager_new (gimp_item_get_width  (item),
                                     gimp_item_get_height (item),
                                     GIMP_IMAGE_TYPE_BYTES (new_type));
 
@@ -455,7 +455,7 @@
 
       pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
                          0, 0,
-                         gimp_item_get_width (item),
+                         gimp_item_get_width  (item),
                          gimp_item_get_height (item),
                          FALSE);
       pixel_region_init (&destPR, new_tiles,
@@ -478,8 +478,7 @@
       gint width  = gimp_image_get_width  (dest_image);
       gint height = gimp_image_get_height (dest_image);
 
-      item->offset_x = 0;
-      item->offset_y = 0;
+      gimp_item_set_offset (item, 0, 0);
 
       if (gimp_item_get_width  (item) != width ||
           gimp_item_get_height (item) != height)
@@ -640,8 +639,7 @@
 
   if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
     {
-      item->offset_x = 0;
-      item->offset_y = 0;
+      gimp_item_set_offset (item, 0, 0);
     }
 }
 

Modified: trunk/app/core/gimpdrawable-transform.c
==============================================================================
--- trunk/app/core/gimpdrawable-transform.c	(original)
+++ trunk/app/core/gimpdrawable-transform.c	Mon Nov  3 21:17:50 2008
@@ -856,8 +856,7 @@
                                    _("Transformation"),
                                    GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
 
-      GIMP_ITEM (layer)->offset_x = offset_x;
-      GIMP_ITEM (layer)->offset_y = offset_y;
+      gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
 
       floating_sel_attach (layer, drawable);
     }

Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c	(original)
+++ trunk/app/core/gimpdrawable.c	Mon Nov  3 21:17:50 2008
@@ -379,11 +379,15 @@
       GimpDrawable  *new_drawable = GIMP_DRAWABLE (new_item);
       PixelRegion    srcPR;
       PixelRegion    destPR;
+      gint           offset_x;
+      gint           offset_y;
+
+      gimp_item_get_offset (item, &offset_x, &offset_y);
 
       gimp_drawable_configure (new_drawable,
                                gimp_item_get_image (item),
-                               item->offset_x,
-                               item->offset_y,
+                               offset_x,
+                               offset_y,
                                gimp_item_get_width  (item),
                                gimp_item_get_height (item),
                                gimp_drawable_type (drawable),
@@ -1088,8 +1092,8 @@
 
   if (gimp_item_get_width  (item) != tile_manager_width (tiles)  ||
       gimp_item_get_height (item) != tile_manager_height (tiles) ||
-      item->offset_x          != offset_x                    ||
-      item->offset_y          != offset_y)
+      item->offset_x              != offset_x                    ||
+      item->offset_y              != offset_y)
     {
       gimp_drawable_update (drawable,
                             0, 0,

Modified: trunk/app/core/gimpdrawablemodundo.c
==============================================================================
--- trunk/app/core/gimpdrawablemodundo.c	(original)
+++ trunk/app/core/gimpdrawablemodundo.c	Mon Nov  3 21:17:50 2008
@@ -85,10 +85,12 @@
 
   drawable = GIMP_DRAWABLE (GIMP_ITEM_UNDO (object)->item);
 
-  drawable_mod_undo->tiles    = tile_manager_ref (gimp_drawable_get_tiles (drawable));
-  drawable_mod_undo->type     = drawable->type;
-  drawable_mod_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
-  drawable_mod_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
+  drawable_mod_undo->tiles = tile_manager_ref (gimp_drawable_get_tiles (drawable));
+  drawable_mod_undo->type  = gimp_drawable_type (drawable);
+
+  gimp_item_get_offset (GIMP_ITEM (drawable),
+                        &drawable_mod_undo->offset_x,
+                        &drawable_mod_undo->offset_y);
 
   return object;
 }
@@ -115,7 +117,8 @@
   GimpDrawable        *drawable          = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
   TileManager         *tiles;
   GimpImageType        type;
-  gint                 offset_x, offset_y;
+  gint                 offset_x;
+  gint                 offset_y;
 
   GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
@@ -124,10 +127,12 @@
   offset_x = drawable_mod_undo->offset_x;
   offset_y = drawable_mod_undo->offset_y;
 
-  drawable_mod_undo->tiles    = tile_manager_ref (gimp_drawable_get_tiles (drawable));
-  drawable_mod_undo->type     = drawable->type;
-  drawable_mod_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
-  drawable_mod_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
+  drawable_mod_undo->tiles = tile_manager_ref (gimp_drawable_get_tiles (drawable));
+  drawable_mod_undo->type  = drawable->type;
+
+  gimp_item_get_offset (GIMP_ITEM (drawable),
+                        &drawable_mod_undo->offset_x,
+                        &drawable_mod_undo->offset_y);
 
   gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
                                 tiles, type, offset_x, offset_y);

Modified: trunk/app/core/gimplayer.c
==============================================================================
--- trunk/app/core/gimplayer.c	(original)
+++ trunk/app/core/gimplayer.c	Mon Nov  3 21:17:50 2008
@@ -766,8 +766,10 @@
 
   if (layer->mask)
     {
-      GIMP_ITEM (layer->mask)->offset_x = item->offset_x;
-      GIMP_ITEM (layer->mask)->offset_y = item->offset_y;
+      gint off_x, off_y;
+
+      gimp_item_get_offset (item, &off_x, &off_y);
+      gimp_item_set_offset (GIMP_ITEM (layer->mask), off_x, off_y);
 
       gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer->mask));
     }
@@ -1496,6 +1498,7 @@
     case GIMP_ADD_CHANNEL_MASK:
       {
         gboolean channel_empty;
+        gint     offset_x, offset_y;
         gint     copy_x, copy_y;
         gint     copy_width, copy_height;
 
@@ -1504,10 +1507,12 @@
 
         channel_empty = gimp_channel_is_empty (channel);
 
+        gimp_item_get_offset (item, &offset_x, &offset_y);
+
         gimp_rectangle_intersect (0, 0,
                                   gimp_image_get_width  (image),
                                   gimp_image_get_height (image),
-                                  item->offset_x, item->offset_y,
+                                  offset_x, offset_y,
                                   gimp_item_get_width  (item),
                                   gimp_item_get_height (item),
                                   &copy_x, &copy_y,
@@ -1527,7 +1532,7 @@
                                FALSE);
             pixel_region_init (&destPR,
                                gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
-                               copy_x - item->offset_x, copy_y - item->offset_y,
+                               copy_x - offset_x, copy_y - offset_y,
                                copy_width, copy_height,
                                TRUE);
 
@@ -1709,6 +1714,7 @@
 gimp_layer_add_alpha (GimpLayer *layer)
 {
   GimpItem      *item;
+  GimpDrawable  *drawable;
   PixelRegion    srcPR, destPR;
   TileManager   *new_tiles;
   GimpImageType  new_type;
@@ -1718,9 +1724,10 @@
   if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
     return;
 
-  item = GIMP_ITEM (layer);
+  item     = GIMP_ITEM (layer);
+  drawable = GIMP_DRAWABLE (layer);
 
-  new_type = gimp_drawable_type_with_alpha (GIMP_DRAWABLE (layer));
+  new_type = gimp_drawable_type_with_alpha (drawable);
 
   /*  Allocate the new tiles  */
   new_tiles = tile_manager_new (gimp_item_get_width  (item),
@@ -1728,7 +1735,7 @@
                                 GIMP_IMAGE_TYPE_BYTES (new_type));
 
   /*  Configure the pixel regions  */
-  pixel_region_init (&srcPR, gimp_drawable_get_tiles (GIMP_DRAWABLE (layer)),
+  pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
                      0, 0,
                      gimp_item_get_width  (item),
                      gimp_item_get_height (item),
@@ -1755,6 +1762,7 @@
                     GimpContext *context)
 {
   GimpItem      *item;
+  GimpDrawable  *drawable;
   PixelRegion    srcPR, destPR;
   TileManager   *new_tiles;
   GimpImageType  new_type;
@@ -1766,12 +1774,13 @@
   if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
     return;
 
-  item = GIMP_ITEM (layer);
+  item     = GIMP_ITEM (layer);
+  drawable = GIMP_DRAWABLE (layer);
 
-  new_type = gimp_drawable_type_without_alpha (GIMP_DRAWABLE (layer));
+  new_type = gimp_drawable_type_without_alpha (drawable);
 
-  gimp_image_get_background (gimp_item_get_image (GIMP_ITEM (layer)), context,
-                             gimp_drawable_type (GIMP_DRAWABLE (layer)),
+  gimp_image_get_background (gimp_item_get_image (item), context,
+                             gimp_drawable_type (drawable),
                              bg);
 
   /*  Allocate the new tiles  */
@@ -1780,7 +1789,7 @@
                                 GIMP_IMAGE_TYPE_BYTES (new_type));
 
   /*  Configure the pixel regions  */
-  pixel_region_init (&srcPR, gimp_drawable_get_tiles (GIMP_DRAWABLE (layer)),
+  pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
                      0, 0,
                      gimp_item_get_width  (item),
                      gimp_item_get_height (item),
@@ -1834,6 +1843,8 @@
 {
   GimpItem *item;
   BoundSeg *new_segs;
+  gint      offset_x;
+  gint      offset_y;
 
   g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
 
@@ -1864,28 +1875,30 @@
         }
     }
 
-  new_segs[0].x1   = item->offset_x;
-  new_segs[0].y1   = item->offset_y;
-  new_segs[0].x2   = item->offset_x;
-  new_segs[0].y2   = item->offset_y + gimp_item_get_height (item);
+  gimp_item_get_offset (item, &offset_x, &offset_y);
+
+  new_segs[0].x1   = offset_x;
+  new_segs[0].y1   = offset_y;
+  new_segs[0].x2   = offset_x;
+  new_segs[0].y2   = offset_y + gimp_item_get_height (item);
   new_segs[0].open = 1;
 
-  new_segs[1].x1   = item->offset_x;
-  new_segs[1].y1   = item->offset_y;
-  new_segs[1].x2   = item->offset_x + gimp_item_get_width (item);
-  new_segs[1].y2   = item->offset_y;
+  new_segs[1].x1   = offset_x;
+  new_segs[1].y1   = offset_y;
+  new_segs[1].x2   = offset_x + gimp_item_get_width (item);
+  new_segs[1].y2   = offset_y;
   new_segs[1].open = 1;
 
-  new_segs[2].x1   = item->offset_x + gimp_item_get_width (item);
-  new_segs[2].y1   = item->offset_y;
-  new_segs[2].x2   = item->offset_x + gimp_item_get_width  (item);
-  new_segs[2].y2   = item->offset_y + gimp_item_get_height (item);
+  new_segs[2].x1   = offset_x + gimp_item_get_width (item);
+  new_segs[2].y1   = offset_y;
+  new_segs[2].x2   = offset_x + gimp_item_get_width  (item);
+  new_segs[2].y2   = offset_y + gimp_item_get_height (item);
   new_segs[2].open = 0;
 
-  new_segs[3].x1   = item->offset_x;
-  new_segs[3].y1   = item->offset_y + gimp_item_get_height (item);
-  new_segs[3].x2   = item->offset_x + gimp_item_get_width  (item);
-  new_segs[3].y2   = item->offset_y + gimp_item_get_height (item);
+  new_segs[3].x1   = offset_x;
+  new_segs[3].y1   = offset_y + gimp_item_get_height (item);
+  new_segs[3].x2   = offset_x + gimp_item_get_width  (item);
+  new_segs[3].y2   = offset_y + gimp_item_get_height (item);
   new_segs[3].open = 0;
 
   return new_segs;

Modified: trunk/app/core/gimplayermask.c
==============================================================================
--- trunk/app/core/gimplayermask.c	(original)
+++ trunk/app/core/gimplayermask.c	Mon Nov  3 21:17:50 2008
@@ -201,9 +201,11 @@
   if (layer)
     {
       gchar *mask_name;
+      gint   offset_x;
+      gint   offset_y;
 
-      GIMP_ITEM (layer_mask)->offset_x = GIMP_ITEM (layer)->offset_x;
-      GIMP_ITEM (layer_mask)->offset_y = GIMP_ITEM (layer)->offset_y;
+      gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+      gimp_item_set_offset (GIMP_ITEM (layer_mask), offset_x, offset_y);
 
       mask_name = g_strdup_printf (_("%s mask"),
                                    gimp_object_get_name (GIMP_OBJECT (layer)));

Modified: trunk/app/core/gimpselection.c
==============================================================================
--- trunk/app/core/gimpselection.c	(original)
+++ trunk/app/core/gimpselection.c	Mon Nov  3 21:17:50 2008
@@ -60,8 +60,8 @@
                                                 GimpContext       *context,
                                                 gint               new_width,
                                                 gint               new_height,
-                                                gint               off_x,
-                                                gint               off_y);
+                                                gint               offset_x,
+                                                gint               offset_y);
 static void       gimp_selection_flip          (GimpItem          *item,
                                                 GimpContext       *context,
                                                 GimpOrientationType flip_type,
@@ -211,8 +211,7 @@
                                          new_offset_x, new_offset_y,
                                          interp_type, progress);
 
-  item->offset_x = 0;
-  item->offset_y = 0;
+  gimp_item_set_offset (item, 0, 0);
 }
 
 static void
@@ -220,14 +219,13 @@
                        GimpContext *context,
                        gint         new_width,
                        gint         new_height,
-                       gint         off_x,
-                       gint         off_y)
+                       gint         offset_x,
+                       gint         offset_y)
 {
   GIMP_ITEM_CLASS (parent_class)->resize (item, context, new_width, new_height,
-                                          off_x, off_y);
+                                          offset_x, offset_y);
 
-  item->offset_x = 0;
-  item->offset_y = 0;
+  gimp_item_set_offset (item, 0, 0);
 }
 
 static void
@@ -374,15 +372,16 @@
 
       gint x1, y1;
       gint x2, y2;
-      gint off_x, off_y;
+      gint offset_x;
+      gint offset_y;
 
-      gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
+      gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
 
-      x1 = CLAMP (off_x, 0, gimp_image_get_width  (image));
-      y1 = CLAMP (off_y, 0, gimp_image_get_height (image));
-      x2 = CLAMP (off_x + gimp_item_get_width (GIMP_ITEM (layer)),
+      x1 = CLAMP (offset_x, 0, gimp_image_get_width  (image));
+      y1 = CLAMP (offset_y, 0, gimp_image_get_height (image));
+      x2 = CLAMP (offset_x + gimp_item_get_width (GIMP_ITEM (layer)),
                   0, gimp_image_get_width (image));
-      y2 = CLAMP (off_y + gimp_item_get_height (GIMP_ITEM (layer)),
+      y2 = CLAMP (offset_y + gimp_item_get_height (GIMP_ITEM (layer)),
                   0, gimp_image_get_height (image));
 
       return GIMP_CHANNEL_CLASS (parent_class)->boundary (channel,
@@ -866,8 +865,7 @@
   /*  Set the offsets  */
   tile_manager_get_offsets (tiles, &x1, &y1);
 
-  GIMP_ITEM (layer)->offset_x = x1 + off_x;
-  GIMP_ITEM (layer)->offset_y = y1 + off_y;
+  gimp_item_set_offset (GIMP_ITEM (layer), x1 + off_x, y1 + off_y);
 
   /*  Free the temp buffer  */
   tile_manager_unref (tiles);

Modified: trunk/app/pdb/layer-cmds.c
==============================================================================
--- trunk/app/pdb/layer-cmds.c	(original)
+++ trunk/app/pdb/layer-cmds.c	Mon Nov  3 21:17:50 2008
@@ -465,12 +465,15 @@
   if (success)
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+      gint       offset_x;
+      gint       offset_y;
 
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
                                    _("Move Layer"));
 
-      offx -= GIMP_ITEM (layer)->offset_x;
-      offy -= GIMP_ITEM (layer)->offset_y;
+      gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+      offx -= offset_x;
+      offy -= offset_y;
 
       gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
 

Modified: trunk/app/text/gimptext-compat.c
==============================================================================
--- trunk/app/text/gimptext-compat.c	(original)
+++ trunk/app/text/gimptext-compat.c	Mon Nov  3 21:17:50 2008
@@ -108,8 +108,7 @@
                                _("Add Text Layer"));
 
   /*  Set the layer offsets  */
-  GIMP_ITEM (layer)->offset_x = text_x;
-  GIMP_ITEM (layer)->offset_y = text_y;
+  gimp_item_set_offset (GIMP_ITEM (layer), text_x, text_y);
 
   /*  If there is a selection mask clear it--
    *  this might not always be desired, but in general,

Modified: trunk/app/text/gimptextlayer-xcf.c
==============================================================================
--- trunk/app/text/gimptextlayer-xcf.c	(original)
+++ trunk/app/text/gimptextlayer-xcf.c	Mon Nov  3 21:17:50 2008
@@ -177,6 +177,8 @@
   GimpTextLayer *text_layer;
   GimpItem      *item;
   GimpDrawable  *drawable;
+  gint           offset_x;
+  gint           offset_y;
 
   g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
   g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
@@ -205,7 +207,8 @@
   item->width  = gimp_item_get_width (GIMP_ITEM (layer));
   item->height = gimp_item_get_height (GIMP_ITEM (layer));
 
-  gimp_item_get_offset (GIMP_ITEM (layer), &item->offset_x, &item->offset_y);
+  gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+  gimp_item_set_offset (item, offset_x, offset_y);
 
   gimp_item_set_visible (item, gimp_item_get_visible (GIMP_ITEM (layer)), FALSE);
   gimp_item_set_linked  (item, gimp_item_get_linked  (GIMP_ITEM (layer)), FALSE);

Modified: trunk/app/vectors/gimpvectorsmodundo.c
==============================================================================
--- trunk/app/vectors/gimpvectorsmodundo.c	(original)
+++ trunk/app/vectors/gimpvectorsmodundo.c	Mon Nov  3 21:17:50 2008
@@ -111,6 +111,8 @@
   GimpVectorsModUndo *vectors_mod_undo = GIMP_VECTORS_MOD_UNDO (undo);
   GimpVectors        *vectors          = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
   GimpVectors        *temp;
+  gint                offset_x;
+  gint                offset_y;
 
   GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
@@ -124,10 +126,11 @@
 
   gimp_vectors_copy_strokes (temp, vectors);
 
-  GIMP_ITEM (vectors)->width    = gimp_item_get_width  (GIMP_ITEM (temp));
-  GIMP_ITEM (vectors)->height   = gimp_item_get_height (GIMP_ITEM (temp));
-  GIMP_ITEM (vectors)->offset_x = GIMP_ITEM (temp)->offset_x;
-  GIMP_ITEM (vectors)->offset_y = GIMP_ITEM (temp)->offset_y;
+  GIMP_ITEM (vectors)->width  = gimp_item_get_width  (GIMP_ITEM (temp));
+  GIMP_ITEM (vectors)->height = gimp_item_get_height (GIMP_ITEM (temp));
+
+  gimp_item_get_offset (GIMP_ITEM (temp), &offset_x, &offset_y);
+  gimp_item_set_offset (GIMP_ITEM (vectors), offset_x, offset_y);
 
   g_object_unref (temp);
 

Modified: trunk/app/widgets/gimpviewrendererdrawable.c
==============================================================================
--- trunk/app/widgets/gimpviewrendererdrawable.c	(original)
+++ trunk/app/widgets/gimpviewrendererdrawable.c	Mon Nov  3 21:17:50 2008
@@ -68,6 +68,8 @@
   GimpDrawable *drawable;
   GimpItem     *item;
   GimpImage    *image;
+  gint          offset_x;
+  gint          offset_y;
   gint          width;
   gint          height;
   gint          view_width;
@@ -79,7 +81,9 @@
 
   drawable = GIMP_DRAWABLE (renderer->viewable);
   item     = GIMP_ITEM (drawable);
-  image   = gimp_item_get_image (item);
+  image    = gimp_item_get_image (item);
+
+  gimp_item_get_offset (item, &offset_x, &offset_y);
 
   width  = renderer->width;
   height = renderer->height;
@@ -135,7 +139,7 @@
           if (gimp_rectangle_intersect (0, 0,
                                         gimp_item_get_width  (item),
                                         gimp_item_get_height (item),
-                                        -item->offset_x, -item->offset_y,
+                                        -offset_x, -offset_y,
                                         gimp_image_get_width  (image),
                                         gimp_image_get_height (image),
                                         &src_x, &src_y,
@@ -196,17 +200,17 @@
     {
       if (image && ! renderer->is_popup)
         {
-          if (item->offset_x != 0)
+          if (offset_x != 0)
             render_buf->x =
               ROUND ((((gdouble) renderer->width /
                        (gdouble) gimp_image_get_width (image)) *
-                      (gdouble) item->offset_x));
+                      (gdouble) offset_x));
 
-          if (item->offset_y != 0)
+          if (offset_y != 0)
             render_buf->y =
               ROUND ((((gdouble) renderer->height /
                        (gdouble) gimp_image_get_height (image)) *
-                      (gdouble) item->offset_y));
+                      (gdouble) offset_y));
 
           if (scaling_up)
             {

Modified: trunk/app/xcf/xcf-load.c
==============================================================================
--- trunk/app/xcf/xcf-load.c	(original)
+++ trunk/app/xcf/xcf-load.c	Mon Nov  3 21:17:50 2008
@@ -689,12 +689,15 @@
           break;
 
         case PROP_OFFSETS:
-          info->cp +=
-            xcf_read_int32 (info->fp,
-                            (guint32 *) &GIMP_ITEM (layer)->offset_x, 1);
-          info->cp +=
-            xcf_read_int32 (info->fp,
-                            (guint32 *) &GIMP_ITEM (layer)->offset_y, 1);
+          {
+            guint32 offset_x;
+            guint32 offset_y;
+
+            info->cp += xcf_read_int32 (info->fp, &offset_x, 1);
+            info->cp += xcf_read_int32 (info->fp, &offset_y, 1);
+
+            gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
+          }
           break;
 
         case PROP_MODE:

Modified: trunk/app/xcf/xcf-save.c
==============================================================================
--- trunk/app/xcf/xcf-save.c	(original)
+++ trunk/app/xcf/xcf-save.c	Mon Nov  3 21:17:50 2008
@@ -468,6 +468,8 @@
                       GError    **error)
 {
   GimpParasite *parasite = NULL;
+  gint          offset_x;
+  gint          offset_y;
 
   if (layer == gimp_image_get_active_layer (image))
     xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_LAYER, error));
@@ -509,9 +511,10 @@
                                       FALSE));
     }
 
+  gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+
   xcf_check_error (xcf_save_prop (info, image, PROP_OFFSETS, error,
-                                  GIMP_ITEM (layer)->offset_x,
-                                  GIMP_ITEM (layer)->offset_y));
+                                  offset_x, offset_y));
   xcf_check_error (xcf_save_prop (info, image, PROP_MODE, error,
                                   gimp_layer_get_mode (layer)));
   xcf_check_error (xcf_save_prop (info, image, PROP_TATTOO, error,

Modified: trunk/tools/pdbgen/pdb/layer.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/layer.pdb	(original)
+++ trunk/tools/pdbgen/pdb/layer.pdb	Mon Nov  3 21:17:50 2008
@@ -605,12 +605,15 @@
 	code => <<'CODE'
 {
   GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+  gint       offset_x;
+  gint       offset_y;
 
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
                                _("Move Layer"));
 
-  offx -= GIMP_ITEM (layer)->offset_x;
-  offy -= GIMP_ITEM (layer)->offset_y;
+  gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+  offx -= offset_x;
+  offy -= offset_y;
 
   gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
 



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