gimp r27553 - in trunk: . app/core



Author: mitch
Date: Tue Nov  4 20:13:12 2008
New Revision: 27553
URL: http://svn.gnome.org/viewvc/gimp?rev=27553&view=rev

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

	* app/core/gimpprojectable.[ch]: add vitrual function
	invalidate_preview().

	* app/core/gimpimage.c: implement it and redirect to
	gimp_viewable_invalidate_preview().

	* app/core/gimpprojection.c: call the new API instead of
	gimp_viewable_invalidate_preview(). Some cleanup in the disabled
	cow-projection code.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpimage.c
   trunk/app/core/gimpprojectable.c
   trunk/app/core/gimpprojectable.h
   trunk/app/core/gimpprojection-construct.c
   trunk/app/core/gimpprojection.c

Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c	(original)
+++ trunk/app/core/gimpimage.c	Tue Nov  4 20:13:12 2008
@@ -560,9 +560,10 @@
 static void
 gimp_projectable_iface_init (GimpProjectableInterface *iface)
 {
-  iface->flush     = gimp_image_projectable_flush;
-  iface->get_image = gimp_image_get_image;
-  iface->get_graph = gimp_image_get_graph;
+  iface->flush              = gimp_image_projectable_flush;
+  iface->get_image          = gimp_image_get_image;
+  iface->get_graph          = gimp_image_get_graph;
+  iface->invalidate_preview = (void (*) (GimpProjectable *p)) gimp_viewable_invalidate_preview;
 }
 
 static void

Modified: trunk/app/core/gimpprojectable.c
==============================================================================
--- trunk/app/core/gimpprojectable.c	(original)
+++ trunk/app/core/gimpprojectable.c	Tue Nov  4 20:13:12 2008
@@ -161,3 +161,16 @@
 
   return NULL;
 }
+
+void
+gimp_projectable_invalidate_preview (GimpProjectable *projectable)
+{
+  GimpProjectableInterface *iface;
+
+  g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
+
+  iface = GIMP_PROJECTABLE_GET_INTERFACE (projectable);
+
+  if (iface->invalidate_preview)
+    iface->invalidate_preview (projectable);
+}

Modified: trunk/app/core/gimpprojectable.h
==============================================================================
--- trunk/app/core/gimpprojectable.h	(original)
+++ trunk/app/core/gimpprojectable.h	Tue Nov  4 20:13:12 2008
@@ -36,17 +36,18 @@
   GTypeInterface base_iface;
 
   /*  signals  */
-  void        (* update)    (GimpProjectable *projectable,
-                             gint             x,
-                             gint             y,
-                             gint             width,
-                             gint             height);
-  void        (* flush)     (GimpProjectable *projectable,
-                             gboolean         invalidate_preview);
+  void        (* update)             (GimpProjectable *projectable,
+                                      gint             x,
+                                      gint             y,
+                                      gint             width,
+                                      gint             height);
+  void        (* flush)              (GimpProjectable *projectable,
+                                      gboolean         invalidate_preview);
 
   /*  virtual functions  */
-  GimpImage * (* get_image) (GimpProjectable *projectable);
-  GeglNode  * (* get_graph) (GimpProjectable *projectable);
+  GimpImage * (* get_image)          (GimpProjectable *projectable);
+  GeglNode  * (* get_graph)          (GimpProjectable *projectable);
+  void        (* invalidate_preview) (GimpProjectable *projectable);
 };
 
 
@@ -62,6 +63,7 @@
 
 GimpImage * gimp_projectable_get_image          (GimpProjectable *projectable);
 GeglNode  * gimp_projectable_get_graph          (GimpProjectable *projectable);
+void        gimp_projectable_invalidate_preview (GimpProjectable *projectable);
 
 
 #endif  /* __GIMP_PROJECTABLE_H__ */

Modified: trunk/app/core/gimpprojection-construct.c
==============================================================================
--- trunk/app/core/gimpprojection-construct.c	(original)
+++ trunk/app/core/gimpprojection-construct.c	Tue Nov  4 20:13:12 2008
@@ -103,45 +103,42 @@
 #if 0
   GimpImage *image = gimp_projectable_get_image (proj->projectable);
 
-  if ((gimp_container_num_children (image->layers) == 1)) /* a single layer */
+  if (gimp_container_num_children (image->layers) == 1) /* a single layer */
     {
       GimpDrawable *layer;
+      gint          off_x, off_y;
 
       layer = GIMP_DRAWABLE (gimp_image_get_layer_by_index (image, 0));
 
-      if (gimp_drawable_has_alpha (layer)                             &&
-          (gimp_item_get_visible (GIMP_ITEM (layer)))                 &&
-          (gimp_item_get_width  (GIMP_ITEM (layer)) == image->width)  &&
-          (gimp_item_get_height (GIMP_ITEM (layer)) == image->height) &&
-          (! gimp_drawable_is_indexed (layer))                        &&
-          (gimp_layer_get_opacity (GIMP_LAYER (layer)) == GIMP_OPACITY_OPAQUE))
-        {
-          gint xoff;
-          gint yoff;
-
-          gimp_item_get_offset (GIMP_ITEM (layer), &xoff, &yoff);
+      gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
 
-          if (xoff == 0 && yoff == 0)
-            {
-              PixelRegion srcPR, destPR;
+      if (gimp_drawable_has_alpha (layer)                                    &&
+          gimp_item_get_visible (GIMP_ITEM (layer))                          &&
+          gimp_item_get_width  (GIMP_ITEM (layer)) == image->width           &&
+          gimp_item_get_height (GIMP_ITEM (layer)) == image->height          &&
+          ! gimp_drawable_is_indexed (layer)                                 &&
+          gimp_layer_get_opacity (GIMP_LAYER (layer)) == GIMP_OPACITY_OPAQUE &&
+          off_x == 0                                                         &&
+          off_y == 0)
+        {
+          PixelRegion srcPR, destPR;
 
-              g_printerr ("cow-projection!");
+          g_printerr ("cow-projection!");
 
-              pixel_region_init (&srcPR,
-                                 gimp_drawable_get_tiles (layer),
-                                 x, y, w,h, FALSE);
-              pixel_region_init (&destPR,
-                                 gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
-                                 x, y, w,h, TRUE);
+          pixel_region_init (&srcPR,
+                             gimp_drawable_get_tiles (layer),
+                             x, y, w,h, FALSE);
+          pixel_region_init (&destPR,
+                             gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
+                             x, y, w,h, TRUE);
 
-              copy_region (&srcPR, &destPR);
+          copy_region (&srcPR, &destPR);
 
-              proj->construct_flag = TRUE;
+          proj->construct_flag = TRUE;
 
-              gimp_projection_construct_channels (proj, x, y, w, h);
+          gimp_projection_construct_channels (proj, x, y, w, h);
 
-              return;
-            }
+          return;
         }
     }
 #endif

Modified: trunk/app/core/gimpprojection.c
==============================================================================
--- trunk/app/core/gimpprojection.c	(original)
+++ trunk/app/core/gimpprojection.c	Tue Nov  4 20:13:12 2008
@@ -270,7 +270,7 @@
        */
       proj->invalidate_preview = FALSE;
 
-      gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
+      gimp_projectable_invalidate_preview (proj->projectable);
     }
 }
 
@@ -561,7 +561,7 @@
        */
       proj->invalidate_preview = FALSE;
 
-      gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
+      gimp_projectable_invalidate_preview (proj->projectable);
     }
 }
 
@@ -678,7 +678,7 @@
                    */
                   proj->invalidate_preview = FALSE;
 
-                  gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
+                  gimp_projectable_invalidate_preview (proj->projectable);
                 }
 
               return FALSE;



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