gimp r27528 - in trunk: . app/core



Author: martinn
Date: Sun Nov  2 22:44:33 2008
New Revision: 27528
URL: http://svn.gnome.org/viewvc/gimp?rev=27528&view=rev

Log:
* app/core/gimpitem.c (gimp_item_set_offsets): New function that
sets the offset of the item and also keeps the offset_node in
sync.

* app/core/gimpdrawable.c (gimp_drawable_real_set_tiles): Use the
function instead of setting the offsets directly. Fixes corrupted
display when cropping images with GEGL enabled for the projection.


Modified:
   trunk/ChangeLog
   trunk/app/core/gimpdrawable.c
   trunk/app/core/gimpitem.c
   trunk/app/core/gimpitem.h

Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c	(original)
+++ trunk/app/core/gimpdrawable.c	Sun Nov  2 22:44:33 2008
@@ -748,8 +748,7 @@
   drawable->bytes     = tile_manager_bpp (tiles);
   drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
 
-  item->offset_x = offset_x;
-  item->offset_y = offset_y;
+  gimp_item_set_offsets (item, offset_x, offset_y);
 
   if (gimp_item_width  (item) != tile_manager_width (tiles) ||
       gimp_item_height (item) != tile_manager_height (tiles))

Modified: trunk/app/core/gimpitem.c
==============================================================================
--- trunk/app/core/gimpitem.c	(original)
+++ trunk/app/core/gimpitem.c	Sun Nov  2 22:44:33 2008
@@ -106,6 +106,7 @@
                                                gint           offset_x,
                                                gint           offset_y);
 static GeglNode * gimp_item_real_get_node     (GimpItem      *item);
+static void       gimp_item_sync_offset_node  (GimpItem      *item);
 
 
 G_DEFINE_TYPE (GimpItem, gimp_item, GIMP_TYPE_VIEWABLE)
@@ -410,11 +411,7 @@
   item->offset_x += offset_x;
   item->offset_y += offset_y;
 
-  if (item->offset_node)
-    gegl_node_set (item->offset_node,
-                   "x", (gdouble) item->offset_x,
-                   "y", (gdouble) item->offset_y,
-                   NULL);
+  gimp_item_sync_offset_node (item);
 }
 
 static void
@@ -465,6 +462,16 @@
   return item->node;
 }
 
+static void
+gimp_item_sync_offset_node (GimpItem *item)
+{
+  if (item->offset_node)
+    gegl_node_set (item->offset_node,
+                   "x", (gdouble) item->offset_x,
+                   "y", (gdouble) item->offset_y,
+                   NULL);
+}
+
 /**
  * gimp_item_remove:
  * @item: the #GimpItem to remove.
@@ -704,6 +711,19 @@
   if (offset_y) *offset_y = item->offset_y;
 }
 
+void
+gimp_item_set_offsets (GimpItem *item,
+                       gint      offset_x,
+                       gint      offset_y)
+{
+  g_return_if_fail (GIMP_IS_ITEM (item));
+
+  item->offset_x = offset_x;
+  item->offset_y = offset_y;
+
+  gimp_item_sync_offset_node (item);
+}
+
 /**
  * gimp_item_translate:
  * @item:      The #GimpItem to move.

Modified: trunk/app/core/gimpitem.h
==============================================================================
--- trunk/app/core/gimpitem.h	(original)
+++ trunk/app/core/gimpitem.h	Sun Nov  2 22:44:33 2008
@@ -162,6 +162,9 @@
 void            gimp_item_offsets          (const GimpItem     *item,
                                             gint               *offset_x,
                                             gint               *offset_y);
+void            gimp_item_set_offsets      (GimpItem           *item,
+                                            gint                offset_x,
+                                            gint                offset_y);
 
 void            gimp_item_translate        (GimpItem           *item,
                                             gint                offset_x,



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