[gimp] app: remove the legacy projection construction code



commit d294cfb8b22bf84feb28e40ac0e852b02c277ccf
Author: Michael Natterer <mitch gimp org>
Date:   Sat May 19 00:06:03 2012 +0200

    app: remove the legacy projection construction code

 app/actions/view-actions.c          |   15 +---
 app/actions/view-commands.c         |   35 --------
 app/actions/view-commands.h         |    3 -
 app/core/Makefile.am                |    4 -
 app/core/gimpchannel-project.c      |   84 -------------------
 app/core/gimpchannel-project.h      |   33 --------
 app/core/gimpchannel.c              |    2 -
 app/core/gimpdrawable.c             |  123 ---------------------------
 app/core/gimpdrawable.h             |   21 -----
 app/core/gimpgrouplayer.c           |    3 -
 app/core/gimplayer-project.c        |  155 -----------------------------------
 app/core/gimplayer-project.h        |   33 --------
 app/core/gimplayer.c                |    2 -
 app/core/gimpprojection-construct.c |  149 ++-------------------------------
 app/core/gimpprojection.c           |    1 -
 app/core/gimpprojection.h           |    2 -
 menus/image-menu.xml.in             |    1 -
 17 files changed, 11 insertions(+), 655 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index c74f7f6..7e272cb 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -32,7 +32,6 @@
 #include "core/gimp.h"
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
-#include "core/gimpprojection.h"
 
 #include "widgets/gimpactiongroup.h"
 #include "widgets/gimprender.h"
@@ -232,14 +231,7 @@ static const GimpToggleActionEntry view_toggle_actions[] =
     NC_("view-action", "Toggle fullscreen view"),
     G_CALLBACK (view_fullscreen_cmd_callback),
     FALSE,
-    GIMP_HELP_VIEW_FULLSCREEN },
-
-  { "view-use-gegl", GIMP_STOCK_GEGL,
-    NC_("view-action", "Use GEGL"), NULL,
-    NC_("view-action", "Use GEGL to create this window's projection"),
-    G_CALLBACK (view_use_gegl_cmd_callback),
-    FALSE,
-    NULL }
+    GIMP_HELP_VIEW_FULLSCREEN }
 };
 
 static const GimpEnumActionEntry view_zoom_actions[] =
@@ -576,7 +568,6 @@ view_actions_update (GimpActionGroup *group,
   gchar              *label          = NULL;
   gboolean            fullscreen     = FALSE;
   gboolean            revert_enabled = FALSE;   /* able to revert zoom? */
-  gboolean            use_gegl       = FALSE;
 
   if (display)
     {
@@ -594,9 +585,6 @@ view_actions_update (GimpActionGroup *group,
                  shell->no_image_options);
 
       revert_enabled = gimp_display_shell_scale_can_revert (shell);
-
-      if (image)
-        use_gegl = gimp_image_get_projection (image)->use_gegl;
     }
 
 #define SET_ACTIVE(action,condition) \
@@ -702,7 +690,6 @@ view_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("view-shrink-wrap", image);
   SET_ACTIVE    ("view-fullscreen",  display && fullscreen);
-  SET_ACTIVE    ("view-use-gegl",    use_gegl);
 
   if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
       GIMP_IS_GIMP (group->user_data))
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index fbd291d..97b1228 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -32,7 +32,6 @@
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
 #include "core/gimpgrouplayer.h"
-#include "core/gimpprojection.h"
 
 #include "widgets/gimpactiongroup.h"
 #include "widgets/gimpcolordialog.h"
@@ -656,40 +655,6 @@ view_fullscreen_cmd_callback (GtkAction *action,
     }
 }
 
-void
-view_use_gegl_cmd_callback (GtkAction *action,
-                            gpointer   data)
-{
-  GimpImage        *image;
-  GimpDisplayShell *shell;
-  GList            *layers;
-  GList            *list;
-  gboolean          active;
-  return_if_no_image (image, data);
-  return_if_no_shell (shell, data);
-
-  active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
-  gimp_image_get_projection (image)->use_gegl = active;
-
-  layers = gimp_image_get_layer_list (image);
-
-  for (list = layers; list; list = g_list_next (list))
-    {
-      GimpLayer *layer = list->data;
-
-      if (GIMP_IS_GROUP_LAYER (layer))
-        gimp_group_layer_get_projection (GIMP_GROUP_LAYER (layer))->use_gegl = active;
-    }
-
-  g_list_free (layers);
-
-  gimp_image_invalidate (image, 0, 0,
-                         gimp_image_get_width  (image),
-                         gimp_image_get_height (image));
-  gimp_image_flush (image);
-}
-
 
 /*  private functions  */
 
diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h
index 614ad36..3c68a3e 100644
--- a/app/actions/view-commands.h
+++ b/app/actions/view-commands.h
@@ -86,8 +86,5 @@ void   view_shrink_wrap_cmd_callback           (GtkAction *action,
 void   view_fullscreen_cmd_callback            (GtkAction *action,
                                                 gpointer   data);
 
-void   view_use_gegl_cmd_callback              (GtkAction *action,
-                                                gpointer   data);
-
 
 #endif /* __VIEW_COMMANDS_H__ */
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 519e362..a2d2ae7 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -86,8 +86,6 @@ libappcore_a_sources = \
 	gimpchannel.h				\
 	gimpchannel-combine.c			\
 	gimpchannel-combine.h			\
-	gimpchannel-project.c			\
-	gimpchannel-project.h			\
 	gimpchannel-select.c			\
 	gimpchannel-select.h			\
 	gimpchannelpropundo.c			\
@@ -272,8 +270,6 @@ libappcore_a_sources = \
 	gimplayer.h				\
 	gimplayer-floating-sel.c		\
 	gimplayer-floating-sel.h		\
-	gimplayer-project.c			\
-	gimplayer-project.h			\
 	gimplayermask.c				\
 	gimplayermask.h				\
 	gimplayermaskpropundo.c			\
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 8a44de7..9e0a0e0 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -45,7 +45,6 @@
 #include "gimpimage-undo.h"
 #include "gimpimage-undo-push.h"
 #include "gimpchannel.h"
-#include "gimpchannel-project.h"
 #include "gimpchannel-select.h"
 #include "gimpcontext.h"
 #include "gimpdrawable-operation.h"
@@ -290,7 +289,6 @@ gimp_channel_class_init (GimpChannelClass *klass)
   drawable_class->get_active_mask       = gimp_channel_get_active_mask;
   drawable_class->apply_buffer          = gimp_channel_apply_buffer;
   drawable_class->replace_buffer        = gimp_channel_replace_buffer;
-  drawable_class->project_region        = gimp_channel_project_region;
   drawable_class->set_buffer            = gimp_channel_set_buffer;
   drawable_class->swap_pixels           = gimp_channel_swap_pixels;
 
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index b4cb768..2574bea 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -27,8 +27,6 @@
 
 #include "core-types.h"
 
-#include "base/pixel-region.h"
-
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-nodes.h"
 #include "gegl/gimp-gegl-utils.h"
@@ -1237,127 +1235,6 @@ gimp_drawable_replace_buffer (GimpDrawable        *drawable,
                                                       x, y);
 }
 
-void
-gimp_drawable_project_region (GimpDrawable *drawable,
-                              gint          x,
-                              gint          y,
-                              gint          width,
-                              gint          height,
-                              PixelRegion  *projPR,
-                              gboolean      combine)
-{
-  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-  g_return_if_fail (projPR != NULL);
-
-  GIMP_DRAWABLE_GET_CLASS (drawable)->project_region (drawable,
-                                                      x, y, width, height,
-                                                      projPR, combine);
-}
-
-void
-gimp_drawable_init_src_region (GimpDrawable  *drawable,
-                               PixelRegion   *srcPR,
-                               gint           x,
-                               gint           y,
-                               gint           width,
-                               gint           height,
-                               GeglBuffer   **temp_buffer)
-{
-  GeglBuffer *buffer;
-  GimpLayer  *fs;
-
-  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-  g_return_if_fail (srcPR != NULL);
-  g_return_if_fail (temp_buffer != NULL);
-
-  fs = gimp_drawable_get_floating_sel (drawable);
-
-  if (fs)
-    {
-      gint off_x, off_y;
-      gint fs_off_x, fs_off_y;
-      gint combine_x, combine_y;
-      gint combine_width, combine_height;
-
-      gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
-      gimp_item_get_offset (GIMP_ITEM (fs), &fs_off_x, &fs_off_y);
-
-      if (gimp_item_get_visible (GIMP_ITEM (fs)) &&
-          gimp_rectangle_intersect (x + off_x, y + off_y,
-                                    width, height,
-                                    fs_off_x, fs_off_y,
-                                    gimp_item_get_width  (GIMP_ITEM (fs)),
-                                    gimp_item_get_height (GIMP_ITEM (fs)),
-                                    &combine_x, &combine_y,
-                                    &combine_width, &combine_height))
-        {
-          gboolean lock_alpha = FALSE;
-
-          /*  a temporary buffer for the compisition of the drawable and
-           *  its floating selection
-           */
-          *temp_buffer = gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
-                                                               width, height),
-                                               gimp_drawable_get_format (drawable));
-
-          gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
-                            GEGL_RECTANGLE (x, y, width, height),
-                            *temp_buffer,
-                            GEGL_RECTANGLE (0, 0, 0, 0));
-
-          /*  then, apply the floating selection onto the buffer just as
-           *  we apply it onto the drawable when anchoring the floating
-           *  selection
-           */
-
-          lock_alpha = (GIMP_IS_LAYER (drawable) &&
-                        gimp_layer_get_lock_alpha (GIMP_LAYER (drawable)));
-
-          if (lock_alpha)
-            gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), FALSE, FALSE);
-
-          gimp_drawable_apply_buffer (drawable,
-                                      gimp_drawable_get_buffer (GIMP_DRAWABLE (fs)),
-                                      GEGL_RECTANGLE (combine_x - fs_off_x,
-                                                      combine_y - fs_off_y,
-                                                      combine_width,
-                                                      combine_height),
-                                      FALSE, NULL,
-                                      gimp_layer_get_opacity (fs),
-                                      gimp_layer_get_mode (fs),
-                                      NULL,
-                                      combine_x - off_x,
-                                      combine_y - off_y,
-                                      *temp_buffer,
-                                      combine_x - x - off_x,
-                                      combine_y - y - off_y);
-
-          gimp_gegl_buffer_refetch_tiles (*temp_buffer);
-
-          if (lock_alpha)
-            gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), TRUE, FALSE);
-
-          /*  finally, return a PixelRegion on the composited buffer instead
-           *  of the drawable's tiles
-           */
-          pixel_region_init (srcPR, gimp_gegl_buffer_get_tiles (*temp_buffer),
-                             0, 0, width, height,
-                             FALSE);
-
-          return;
-       }
-    }
-
-  buffer = gimp_drawable_get_buffer (drawable);
-
-  pixel_region_init (srcPR, gimp_gegl_buffer_get_tiles (buffer),
-                     x, y, width, height,
-                     FALSE);
-  *temp_buffer = NULL;
-}
-
 GeglBuffer *
 gimp_drawable_get_buffer (GimpDrawable *drawable)
 {
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index ebeb35f..0d81a81 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -88,13 +88,6 @@ struct _GimpDrawableClass
                                            const GeglRectangle  *mask_region,
                                            gint                  x,
                                            gint                  y);
-  void           (* project_region)       (GimpDrawable         *drawable,
-                                           gint                  x,
-                                           gint                  y,
-                                           gint                  width,
-                                           gint                  height,
-                                           PixelRegion          *projPR,
-                                           gboolean              combine);
   GeglBuffer  * (* get_buffer)            (GimpDrawable         *drawable);
   void          (* set_buffer)            (GimpDrawable         *drawable,
                                            gboolean              push_undo,
@@ -172,20 +165,6 @@ void            gimp_drawable_replace_buffer     (GimpDrawable        *drawable,
                                                   const GeglRectangle *mask_region,
                                                   gint                 x,
                                                   gint                 y);
-void            gimp_drawable_project_region     (GimpDrawable       *drawable,
-                                                  gint                x,
-                                                  gint                y,
-                                                  gint                width,
-                                                  gint                height,
-                                                  PixelRegion        *projPR,
-                                                  gboolean            combine);
-void            gimp_drawable_init_src_region    (GimpDrawable       *drawable,
-                                                  PixelRegion        *srcPR,
-                                                  gint                x,
-                                                  gint                y,
-                                                  gint                width,
-                                                  gint                height,
-                                                  GeglBuffer        **temp_buffer);
 
 GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable);
 void            gimp_drawable_set_buffer         (GimpDrawable       *drawable,
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 6281b43..60a8dd8 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -984,9 +984,6 @@ gimp_group_layer_new (GimpImage *image)
                                                0, 0, 1, 1,
                                                format));
 
-  if (gimp_image_get_projection (image)->use_gegl)
-    GET_PRIVATE (group)->projection->use_gegl = TRUE;
-
   return GIMP_LAYER (group);
 }
 
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 64541a8..cc0c444 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -45,7 +45,6 @@
 #include "gimpimage.h"
 #include "gimplayer-floating-sel.h"
 #include "gimplayer.h"
-#include "gimplayer-project.h"
 #include "gimplayermask.h"
 #include "gimpmarshal.h"
 #include "gimppickable.h"
@@ -309,7 +308,6 @@ gimp_layer_class_init (GimpLayerClass *klass)
   drawable_class->invalidate_boundary   = gimp_layer_invalidate_boundary;
   drawable_class->get_active_components = gimp_layer_get_active_components;
   drawable_class->get_active_mask       = gimp_layer_get_active_mask;
-  drawable_class->project_region        = gimp_layer_project_region;
 
   klass->opacity_changed              = NULL;
   klass->mode_changed                 = NULL;
diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c
index ada1b81..8909298 100644
--- a/app/core/gimpprojection-construct.c
+++ b/app/core/gimpprojection-construct.c
@@ -21,12 +21,9 @@
 
 #include "core-types.h"
 
-#include "base/pixel-region.h"
-
 #include "gegl/gimp-gegl-utils.h"
 
 #include "gimplayer.h"
-#include "gimppickable.h"
 #include "gimpprojectable.h"
 #include "gimpprojection.h"
 #include "gimpprojection-construct.h"
@@ -34,21 +31,11 @@
 
 /*  local function prototypes  */
 
-static void   gimp_projection_construct_gegl   (GimpProjection *proj,
-                                                gint            x,
-                                                gint            y,
-                                                gint            w,
-                                                gint            h);
-static void   gimp_projection_construct_legacy (GimpProjection *proj,
-                                                gint            x,
-                                                gint            y,
-                                                gint            w,
-                                                gint            h);
-static void   gimp_projection_initialize       (GimpProjection *proj,
-                                                gint            x,
-                                                gint            y,
-                                                gint            w,
-                                                gint            h);
+static void   gimp_projection_initialize (GimpProjection *proj,
+                                          gint            x,
+                                          gint            y,
+                                          gint            w,
+                                          gint            h);
 
 
 /*  public functions  */
@@ -60,6 +47,8 @@ gimp_projection_construct (GimpProjection *proj,
                            gint            w,
                            gint            h)
 {
+  GeglRectangle  rect = { x, y, w, h };
+
   g_return_if_fail (GIMP_IS_PROJECTION (proj));
 
   /*  First, determine if the projection image needs to be
@@ -69,33 +58,6 @@ gimp_projection_construct (GimpProjection *proj,
    */
   gimp_projection_initialize (proj, x, y, w, h);
 
-  /*  call functions which process the list of layers and
-   *  the list of channels
-   */
-  if (proj->use_gegl)
-    {
-      gimp_projection_construct_gegl (proj, x, y, w, h);
-    }
-  else
-    {
-      proj->construct_flag = FALSE;
-
-      gimp_projection_construct_legacy (proj, x, y, w, h);
-    }
-}
-
-
-/*  private functions  */
-
-static void
-gimp_projection_construct_gegl (GimpProjection *proj,
-                                gint            x,
-                                gint            y,
-                                gint            w,
-                                gint            h)
-{
-  GeglRectangle  rect = { x, y, w, h };
-
   if (! proj->processor)
     {
       GeglNode *sink = gimp_projection_get_sink_node (proj);
@@ -110,89 +72,6 @@ gimp_projection_construct_gegl (GimpProjection *proj,
   while (gegl_processor_work (proj->processor, NULL));
 }
 
-static void
-gimp_projection_construct_legacy (GimpProjection *proj,
-                                  gint            x,
-                                  gint            y,
-                                  gint            w,
-                                  gint            h)
-{
-  GList *list;
-  GList *reverse_list = NULL;
-  gint   proj_off_x;
-  gint   proj_off_y;
-
-  for (list = gimp_projectable_get_channels (proj->projectable);
-       list;
-       list = g_list_next (list))
-    {
-      if (gimp_item_get_visible (GIMP_ITEM (list->data)))
-        {
-          reverse_list = g_list_prepend (reverse_list, list->data);
-        }
-    }
-
-  for (list = gimp_projectable_get_layers (proj->projectable);
-       list;
-       list = g_list_next (list))
-    {
-      GimpLayer *layer = list->data;
-
-      if (! gimp_layer_is_floating_sel (layer) &&
-          gimp_item_get_visible (GIMP_ITEM (layer)))
-        {
-          /*  only add layers that are visible and not floating selections
-           *  to the list
-           */
-          reverse_list = g_list_prepend (reverse_list, layer);
-        }
-    }
-
-  gimp_projectable_get_offset (proj->projectable, &proj_off_x, &proj_off_y);
-
-  for (list = reverse_list; list; list = g_list_next (list))
-    {
-      GimpItem    *item = list->data;
-      GeglBuffer  *proj_buffer;
-      PixelRegion  projPR;
-      gint         x1, y1;
-      gint         x2, y2;
-      gint         off_x;
-      gint         off_y;
-
-      gimp_item_get_offset (item, &off_x, &off_y);
-
-      /*  subtract the projectable's offsets because the list of
-       *  update areas is in tile-pyramid coordinates, but our
-       *  external API is always in terms of image coordinates.
-       */
-      off_x -= proj_off_x;
-      off_y -= proj_off_y;
-
-      x1 = CLAMP (off_x,                               x, x + w);
-      y1 = CLAMP (off_y,                               y, y + h);
-      x2 = CLAMP (off_x + gimp_item_get_width  (item), x, x + w);
-      y2 = CLAMP (off_y + gimp_item_get_height (item), y, y + h);
-
-      proj_buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
-
-      pixel_region_init (&projPR,
-                         gimp_gegl_buffer_get_tiles (proj_buffer),
-                         x1, y1, x2 - x1, y2 - y1,
-                         TRUE);
-
-      gimp_drawable_project_region (GIMP_DRAWABLE (item),
-                                    x1 - off_x, y1 - off_y,
-                                    x2 - x1,    y2 - y1,
-                                    &projPR,
-                                    proj->construct_flag);
-
-      proj->construct_flag = TRUE;  /*  something was projected  */
-    }
-
-  g_list_free (reverse_list);
-}
-
 /**
  * gimp_projection_initialize:
  * @proj: A #GimpProjection.
@@ -256,17 +135,9 @@ gimp_projection_initialize (GimpProjection *proj,
     {
       GeglBuffer *buffer;
 
-      if (proj->use_gegl)
-        {
-          /* GEGL should really do this for us... */
-          gegl_node_get (gimp_projection_get_sink_node (proj),
-                         "buffer", &buffer, NULL);
-        }
-      else
-        {
-          buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
-          g_object_ref (buffer);
-        }
+      /* GEGL should really do this for us... */
+      gegl_node_get (gimp_projection_get_sink_node (proj),
+                     "buffer", &buffer, NULL);
 
       gegl_buffer_clear (buffer, GEGL_RECTANGLE (x, y, w, h));
       g_object_unref (buffer);
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 6dc2610..629f681 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -154,7 +154,6 @@ gimp_projection_init (GimpProjection *proj)
   proj->idle_render.idle_id      = 0;
   proj->idle_render.update_areas = NULL;
   proj->construct_flag           = FALSE;
-  proj->use_gegl                 = TRUE;
 }
 
 static void
diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h
index c367cd9..74835d0 100644
--- a/app/core/gimpprojection.h
+++ b/app/core/gimpprojection.h
@@ -66,8 +66,6 @@ struct _GimpProjection
 
   gboolean                  construct_flag;
   gboolean                  invalidate_preview;
-
-  gboolean                  use_gegl;
 };
 
 struct _GimpProjectionClass
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 64cf7e1..8f6c995 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -305,7 +305,6 @@
       <menuitem action="view-show-scrollbars" />
       <menuitem action="view-show-statusbar" />
       <separator />
-      <menuitem action="view-use-gegl" />
     </menu>
 
     <menu action="image-menu" name="Image">



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