gimp r27547 - in trunk: . app/actions app/core app/display app/paint app/pdb tools/pdbgen/pdb



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

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

	* app/core/gimpprojection.[ch]: remove public functions
	get_tiles(), get_image(), get_image_type() and get_bytes().

	* app/actions/debug-commands.c
	* app/actions/layers-commands.c
	* app/core/gimpprojection-construct.c
	* app/display/gimpdisplayshell-render.c
	* app/paint/gimppaintcore.c
	* tools/pdbgen/pdb/layer.pdb: use the GimpPickable API insatead.

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



Modified:
   trunk/ChangeLog
   trunk/app/actions/debug-commands.c
   trunk/app/actions/layers-commands.c
   trunk/app/core/gimpprojection-construct.c
   trunk/app/core/gimpprojection.c
   trunk/app/core/gimpprojection.h
   trunk/app/display/gimpdisplayshell-render.c
   trunk/app/paint/gimppaintcore.c
   trunk/app/pdb/layer-cmds.c
   trunk/tools/pdbgen/pdb/layer.pdb

Modified: trunk/app/actions/debug-commands.c
==============================================================================
--- trunk/app/actions/debug-commands.c	(original)
+++ trunk/app/actions/debug-commands.c	Tue Nov  4 12:07:17 2008
@@ -33,6 +33,7 @@
 #include "core/gimp.h"
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
+#include "core/gimppickable.h"
 #include "core/gimpprojection.h"
 
 #include "widgets/gimpmenufactory.h"
@@ -85,7 +86,7 @@
   return_if_no_image (image, data);
 
   projection = gimp_image_get_projection (image);
-  tiles      = gimp_projection_get_tiles (projection);
+  tiles      = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
   timer      = g_timer_new ();
 
   if (projection && tiles && timer)

Modified: trunk/app/actions/layers-commands.c
==============================================================================
--- trunk/app/actions/layers-commands.c	(original)
+++ trunk/app/actions/layers-commands.c	Tue Nov  4 12:07:17 2008
@@ -42,7 +42,7 @@
 #include "core/gimplayer.h"
 #include "core/gimplayer-floating-sel.h"
 #include "core/gimplayermask.h"
-#include "core/gimpprojection.h"
+#include "core/gimppickable.h"
 #include "core/gimptoolinfo.h"
 #include "core/gimpundostack.h"
 #include "core/gimpprogress.h"
@@ -340,14 +340,14 @@
 layers_new_from_visible_cmd_callback (GtkAction *action,
                                       gpointer   data)
 {
-  GimpImage      *image;
-  GimpLayer      *layer;
-  GimpProjection *projection;
+  GimpImage    *image;
+  GimpLayer    *layer;
+  GimpPickable *pickable;
   return_if_no_image (image, data);
 
-  projection = gimp_image_get_projection (image);
+  pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
 
-  layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection),
+  layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
                                      image,
                                      gimp_image_base_type_with_alpha (image),
                                      _("Visible"),

Modified: trunk/app/core/gimpprojection-construct.c
==============================================================================
--- trunk/app/core/gimpprojection-construct.c	(original)
+++ trunk/app/core/gimpprojection-construct.c	Tue Nov  4 12:07:17 2008
@@ -34,6 +34,7 @@
 #include "gimplayer.h"
 #include "gimplayer-floating-sel.h"
 #include "gimplayermask.h"
+#include "gimppickable.h"
 #include "gimpprojection.h"
 #include "gimpprojection-construct.h"
 
@@ -125,9 +126,11 @@
 
               g_printerr ("cow-projection!");
 
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (layer),
+              pixel_region_init (&srcPR,
+                                 gimp_drawable_get_tiles (layer),
                                  x, y, w,h, FALSE);
-              pixel_region_init (&destPR, gimp_projection_get_tiles (proj),
+              pixel_region_init (&destPR,
+                                 gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
                                  x, y, w,h, TRUE);
 
               copy_region (&srcPR, &destPR);
@@ -247,7 +250,8 @@
       y2 = CLAMP (off_y + gimp_item_get_height (GIMP_ITEM (layer)), y, y + h);
 
       /* configure the pixel regions  */
-      pixel_region_init (&src1PR, gimp_projection_get_tiles (proj),
+      pixel_region_init (&src1PR,
+                         gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
                          x1, y1, (x2 - x1), (y2 - y1),
                          TRUE);
 
@@ -346,7 +350,7 @@
 
           /* configure the pixel regions  */
           pixel_region_init (&src1PR,
-                             gimp_projection_get_tiles (proj),
+                             gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
                              x, y, w, h,
                              TRUE);
           pixel_region_init (&src2PR,
@@ -415,7 +419,8 @@
       PixelRegion region;
 
       pixel_region_init (&region,
-                         gimp_projection_get_tiles (proj), x, y, w, h, TRUE);
+                         gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
+                         x, y, w, h, TRUE);
       clear_region (&region);
     }
 }

Modified: trunk/app/core/gimpprojection.c
==============================================================================
--- trunk/app/core/gimpprojection.c	(original)
+++ trunk/app/core/gimpprojection.c	Tue Nov  4 12:07:17 2008
@@ -55,59 +55,63 @@
 
 /*  local function prototypes  */
 
-static void   gimp_projection_pickable_iface_init (GimpPickableInterface *iface);
+static void   gimp_projection_pickable_iface_init (GimpPickableInterface  *iface);
 
-static void       gimp_projection_finalize              (GObject        *object);
+static void        gimp_projection_finalize              (GObject         *object);
 
-static gint64     gimp_projection_get_memsize           (GimpObject     *object,
-                                                         gint64         *gui_size);
+static gint64      gimp_projection_get_memsize           (GimpObject      *object,
+                                                          gint64          *gui_size);
 
-static void       gimp_projection_pickable_flush        (GimpPickable   *pickable);
-static gboolean   gimp_projection_get_pixel_at          (GimpPickable   *pickable,
-                                                         gint            x,
-                                                         gint            y,
-                                                         guchar         *pixel);
-static gint       gimp_projection_get_opacity_at        (GimpPickable   *pickable,
-                                                         gint            x,
-                                                         gint            y);
-
-static void       gimp_projection_add_update_area       (GimpProjection *proj,
-                                                         gint            x,
-                                                         gint            y,
-                                                         gint            w,
-                                                         gint            h);
-static void       gimp_projection_flush_whenever        (GimpProjection *proj,
-                                                         gboolean        now);
-static void       gimp_projection_idle_render_init      (GimpProjection *proj);
-static gboolean   gimp_projection_idle_render_callback  (gpointer        data);
-static gboolean   gimp_projection_idle_render_next_area (GimpProjection *proj);
-static void       gimp_projection_paint_area            (GimpProjection *proj,
-                                                         gboolean        now,
-                                                         gint            x,
-                                                         gint            y,
-                                                         gint            w,
-                                                         gint            h);
-static void       gimp_projection_invalidate            (GimpProjection *proj,
-                                                         guint           x,
-                                                         guint           y,
-                                                         guint           w,
-                                                         guint           h);
-static void       gimp_projection_validate_tile         (TileManager    *tm,
-                                                         Tile           *tile,
-                                                         GimpProjection *proj);
-static void       gimp_projection_image_update          (GimpImage      *image,
-                                                         gint            x,
-                                                         gint            y,
-                                                         gint            w,
-                                                         gint            h,
-                                                         GimpProjection *proj);
-static void       gimp_projection_image_size_changed    (GimpImage      *image,
-                                                         GimpProjection *proj);
-static void       gimp_projection_image_mode_changed    (GimpImage      *image,
-                                                         GimpProjection *proj);
-static void       gimp_projection_image_flush           (GimpImage      *image,
-                                                         gboolean        invalidate_preview,
-                                                         GimpProjection *proj);
+static void        gimp_projection_pickable_flush        (GimpPickable    *pickable);
+static GimpImage * gimp_projection_get_image             (GimpPickable    *pickable);
+static GimpImageType gimp_projection_get_image_type      (GimpPickable    *pickable);
+static gint        gimp_projection_get_bytes             (GimpPickable    *pickable);
+static TileManager * gimp_projection_get_tiles           (GimpPickable    *pickable);
+static gboolean    gimp_projection_get_pixel_at          (GimpPickable    *pickable,
+                                                          gint             x,
+                                                          gint             y,
+                                                          guchar          *pixel);
+static gint        gimp_projection_get_opacity_at        (GimpPickable    *pickable,
+                                                          gint             x,
+                                                          gint             y);
+
+static void        gimp_projection_add_update_area       (GimpProjection  *proj,
+                                                          gint             x,
+                                                          gint             y,
+                                                          gint             w,
+                                                          gint             h);
+static void        gimp_projection_flush_whenever        (GimpProjection  *proj,
+                                                          gboolean         now);
+static void        gimp_projection_idle_render_init      (GimpProjection  *proj);
+static gboolean    gimp_projection_idle_render_callback  (gpointer         data);
+static gboolean    gimp_projection_idle_render_next_area (GimpProjection  *proj);
+static void        gimp_projection_paint_area            (GimpProjection  *proj,
+                                                          gboolean         now,
+                                                          gint             x,
+                                                          gint             y,
+                                                          gint             w,
+                                                          gint             h);
+static void        gimp_projection_invalidate            (GimpProjection  *proj,
+                                                          guint            x,
+                                                          guint            y,
+                                                          guint            w,
+                                                          guint            h);
+static void        gimp_projection_validate_tile         (TileManager     *tm,
+                                                          Tile            *tile,
+                                                          GimpProjection  *proj);
+static void        gimp_projection_image_update          (GimpImage       *image,
+                                                          gint             x,
+                                                          gint             y,
+                                                          gint             w,
+                                                          gint             h,
+                                                          GimpProjection  *proj);
+static void        gimp_projection_image_size_changed    (GimpImage       *image,
+                                                          GimpProjection  *proj);
+static void        gimp_projection_image_mode_changed    (GimpImage       *image,
+                                                          GimpProjection  *proj);
+static void        gimp_projection_image_flush           (GimpImage       *image,
+                                                          gboolean         invalidate_preview,
+                                                          GimpProjection  *proj);
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpProjection, gimp_projection, GIMP_TYPE_OBJECT,
@@ -161,10 +165,10 @@
 gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
 {
   iface->flush          = gimp_projection_pickable_flush;
-  iface->get_image      = (GimpImage     * (*) (GimpPickable *pickable)) gimp_projection_get_image;
-  iface->get_image_type = (GimpImageType   (*) (GimpPickable *pickable)) gimp_projection_get_image_type;
-  iface->get_bytes      = (gint            (*) (GimpPickable *pickable)) gimp_projection_get_bytes;
-  iface->get_tiles      = (TileManager   * (*) (GimpPickable *pickable)) gimp_projection_get_tiles;
+  iface->get_image      = gimp_projection_get_image;
+  iface->get_image_type = gimp_projection_get_image_type;
+  iface->get_bytes      = gimp_projection_get_bytes;
+  iface->get_tiles      = gimp_projection_get_tiles;
   iface->get_pixel_at   = gimp_projection_get_pixel_at;
   iface->get_opacity_at = gimp_projection_get_opacity_at;
 }
@@ -270,6 +274,46 @@
     }
 }
 
+static GimpImage *
+gimp_projection_get_image (GimpPickable *pickable)
+{
+  GimpProjection *proj = GIMP_PROJECTION (pickable);
+
+  return proj->image;
+}
+
+static GimpImageType
+gimp_projection_get_image_type (GimpPickable *pickable)
+{
+  switch (gimp_image_base_type (gimp_projection_get_image (pickable)))
+    {
+    case GIMP_RGB:
+    case GIMP_INDEXED:
+      return GIMP_RGBA_IMAGE;
+
+    case GIMP_GRAY:
+      return GIMP_GRAYA_IMAGE;
+    }
+
+  g_assert_not_reached ();
+
+  return 0;
+}
+
+static gint
+gimp_projection_get_bytes (GimpPickable *pickable)
+{
+  return GIMP_IMAGE_TYPE_BYTES (gimp_projection_get_image_type (pickable));
+}
+
+static TileManager *
+gimp_projection_get_tiles (GimpPickable *pickable)
+{
+  return gimp_projection_get_tiles_at_level (GIMP_PROJECTION (pickable),
+                                             0, NULL);
+
+}
+
 static gboolean
 gimp_projection_get_pixel_at (GimpPickable *pickable,
                               gint          x,
@@ -284,7 +328,7 @@
       y >= gimp_image_get_height (proj->image))
     return FALSE;
 
-  read_pixel_data_1 (gimp_projection_get_tiles (proj), x, y, pixel);
+  read_pixel_data_1 (gimp_projection_get_tiles (pickable), x, y, pixel);
 
   return TRUE;
 }
@@ -324,13 +368,6 @@
   return proj;
 }
 
-TileManager *
-gimp_projection_get_tiles (GimpProjection *proj)
-{
-  return gimp_projection_get_tiles_at_level (proj, 0, NULL);
-
-}
-
 GeglNode *
 gimp_projection_get_sink_node (GimpProjection *proj)
 {
@@ -353,7 +390,7 @@
   proj->sink_node =
     gegl_node_new_child (proj->graph,
                          "operation",    "gimp:tilemanager-sink",
-                         "tile-manager", gimp_projection_get_tiles (proj),
+                         "tile-manager", gimp_projection_get_tiles (GIMP_PICKABLE (proj)),
                          "linear",       TRUE,
                          NULL);
 
@@ -372,7 +409,7 @@
 
   if (! proj->pyramid)
     {
-      proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
+      proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (GIMP_PICKABLE (proj)),
                                         gimp_image_get_width  (proj->image),
                                         gimp_image_get_height (proj->image));
 
@@ -413,42 +450,6 @@
                                  MAX (scale_x, scale_y));
 }
 
-GimpImage *
-gimp_projection_get_image (const GimpProjection *proj)
-{
-  g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL);
-
-  return proj->image;
-}
-
-GimpImageType
-gimp_projection_get_image_type (const GimpProjection *proj)
-{
-  g_return_val_if_fail (GIMP_IS_PROJECTION (proj), -1);
-
-  switch (gimp_image_base_type (proj->image))
-    {
-    case GIMP_RGB:
-    case GIMP_INDEXED:
-      return GIMP_RGBA_IMAGE;
-
-    case GIMP_GRAY:
-      return GIMP_GRAYA_IMAGE;
-    }
-
-  g_assert_not_reached ();
-
-  return 0;
-}
-
-gint
-gimp_projection_get_bytes (const GimpProjection *proj)
-{
-  g_return_val_if_fail (GIMP_IS_PROJECTION (proj), 0);
-
-  return GIMP_IMAGE_TYPE_BYTES (gimp_projection_get_image_type (proj));
-}
-
 void
 gimp_projection_flush (GimpProjection *proj)
 {

Modified: trunk/app/core/gimpprojection.h
==============================================================================
--- trunk/app/core/gimpprojection.h	(original)
+++ trunk/app/core/gimpprojection.h	Tue Nov  4 12:07:17 2008
@@ -85,7 +85,6 @@
 
 GimpProjection * gimp_projection_new              (GimpImage            *image);
 
-TileManager    * gimp_projection_get_tiles        (GimpProjection       *proj);
 GeglNode       * gimp_projection_get_sink_node    (GimpProjection       *proj);
 
 TileManager    * gimp_projection_get_tiles_at_level
@@ -96,10 +95,6 @@
                                                    gdouble               scale_x,
                                                    gdouble               scale_y);
 
-GimpImage      * gimp_projection_get_image        (const GimpProjection *proj);
-GimpImageType    gimp_projection_get_image_type   (const GimpProjection *proj);
-gint             gimp_projection_get_bytes        (const GimpProjection *proj);
-
 void             gimp_projection_flush            (GimpProjection       *proj);
 void             gimp_projection_flush_now        (GimpProjection       *proj);
 void             gimp_projection_finish_draw      (GimpProjection       *proj);

Modified: trunk/app/display/gimpdisplayshell-render.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-render.c	(original)
+++ trunk/app/display/gimpdisplayshell-render.c	Tue Nov  4 12:07:17 2008
@@ -38,6 +38,7 @@
 #include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-colormap.h"
+#include "core/gimppickable.h"
 #include "core/gimpprojection.h"
 
 #include "gimpcanvas.h"
@@ -278,7 +279,7 @@
   }
 
   /* Currently, only RGBA and GRAYA projection types are used. */
-  type = gimp_projection_get_image_type (projection);
+  type = gimp_pickable_get_image_type (GIMP_PICKABLE (projection));
 
   switch (type)
     {

Modified: trunk/app/paint/gimppaintcore.c
==============================================================================
--- trunk/app/paint/gimppaintcore.c	(original)
+++ trunk/app/paint/gimppaintcore.c	Tue Nov  4 12:07:17 2008
@@ -369,9 +369,9 @@
 
   if (core->use_saved_proj)
     {
-      GimpImage      *image      = gimp_item_get_image (item);
-      GimpProjection *projection = gimp_image_get_projection (image);
-      TileManager    *tiles      = gimp_projection_get_tiles (projection);
+      GimpImage    *image    = gimp_item_get_image (item);
+      GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
+      TileManager  *tiles    = gimp_pickable_get_tiles (pickable);
 
       core->saved_proj_tiles = tile_manager_new (tile_manager_width (tiles),
                                                  tile_manager_height (tiles),

Modified: trunk/app/pdb/layer-cmds.c
==============================================================================
--- trunk/app/pdb/layer-cmds.c	(original)
+++ trunk/app/pdb/layer-cmds.c	Tue Nov  4 12:07:17 2008
@@ -35,8 +35,8 @@
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "core/gimpparamspecs.h"
+#include "core/gimppickable.h"
 #include "core/gimpprogress.h"
-#include "core/gimpprojection.h"
 
 #include "gimppdb.h"
 #include "gimppdb-utils.h"
@@ -112,9 +112,9 @@
 
   if (success)
     {
-      GimpProjection *projection = gimp_image_get_projection (image);
+      GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
 
-      layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection),
+      layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
                                          dest_image,
                                          gimp_image_base_type_with_alpha (dest_image),
                                          name,

Modified: trunk/tools/pdbgen/pdb/layer.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/layer.pdb	(original)
+++ trunk/tools/pdbgen/pdb/layer.pdb	Tue Nov  4 12:07:17 2008
@@ -95,9 +95,9 @@
     %invoke = (
 	code => <<'CODE'
 {
-  GimpProjection *projection = gimp_image_get_projection (image);
+  GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
 
-  layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection),
+  layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
                                      dest_image,
                                      gimp_image_base_type_with_alpha (dest_image),
                                      name,
@@ -1062,8 +1062,8 @@
               "core/gimp.h"
               "core/gimpimage-undo.h"
               "core/gimpitem-linked.h"
+              "core/gimppickable.h"
               "core/gimpprogress.h"
-              "core/gimpprojection.h"
               "gimppdb-utils.h"
               "gimp-intl.h");
 



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