[gimp] app: remove GimpImage's cached preview



commit daad966b8ff3da7c951cdcfcf9b65229836a5be0
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 25 00:23:07 2012 +0200

    app: remove GimpImage's cached preview
    
    because GimpViewable already implements exactly the same.

 app/core/gimpimage-preview.c |   28 ----------------------------
 app/core/gimpimage-preview.h |    4 ----
 app/core/gimpimage-private.h |    3 ---
 app/core/gimpimage.c         |   27 ---------------------------
 4 files changed, 0 insertions(+), 62 deletions(-)
---
diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c
index 3df9287..1fb73c4 100644
--- a/app/core/gimpimage-preview.c
+++ b/app/core/gimpimage-preview.c
@@ -95,34 +95,6 @@ gimp_image_get_popup_size (GimpViewable *viewable,
 }
 
 GimpTempBuf *
-gimp_image_get_preview (GimpViewable *viewable,
-                        GimpContext  *context,
-                        gint          width,
-                        gint          height)
-{
-  GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (viewable);
-
-  if (private->preview                                     &&
-      gimp_temp_buf_get_width  (private->preview) == width &&
-      gimp_temp_buf_get_height (private->preview) == height)
-    {
-      /*  The easy way  */
-      return private->preview;
-    }
-  else
-    {
-      /*  The hard way  */
-      if (private->preview)
-        gimp_temp_buf_unref (private->preview);
-
-      private->preview = gimp_image_get_new_preview (viewable, context,
-                                                     width, height);
-
-      return private->preview;
-    }
-}
-
-GimpTempBuf *
 gimp_image_get_new_preview (GimpViewable *viewable,
                             GimpContext  *context,
                             gint          width,
diff --git a/app/core/gimpimage-preview.h b/app/core/gimpimage-preview.h
index e4252ea..283e4b3 100644
--- a/app/core/gimpimage-preview.h
+++ b/app/core/gimpimage-preview.h
@@ -35,10 +35,6 @@ gboolean      gimp_image_get_popup_size   (GimpViewable *viewable,
                                            gboolean      dot_for_dot,
                                            gint         *popup_width,
                                            gint         *popup_height);
-GimpTempBuf * gimp_image_get_preview      (GimpViewable *viewable,
-                                           GimpContext  *context,
-                                           gint          width,
-                                           gint          height);
 GimpTempBuf * gimp_image_get_new_preview  (GimpViewable *viewable,
                                            GimpContext  *context,
                                            gint          width,
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 9daf1c8..1293849 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -100,9 +100,6 @@ struct _GimpImagePrivate
   gint               group_count;           /*  nested undo groups           */
   GimpUndoType       pushing_undo_group;    /*  undo group status flag       */
 
-  /*  Preview  */
-  GimpTempBuf       *preview;               /*  the projection preview       */
-
   /*  Signal emmision accumulator  */
   GimpImageFlushAccumulator  flush_accum;
 };
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index a9ad5e5..6237e60 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -157,7 +157,6 @@ static gint64   gimp_image_get_memsize           (GimpObject        *object,
 static gboolean gimp_image_get_size              (GimpViewable      *viewable,
                                                   gint              *width,
                                                   gint              *height);
-static void     gimp_image_invalidate_preview    (GimpViewable      *viewable);
 static void     gimp_image_size_changed          (GimpViewable      *viewable);
 static gchar  * gimp_image_get_description       (GimpViewable      *viewable,
                                                   gchar            **tooltip);
@@ -522,11 +521,9 @@ gimp_image_class_init (GimpImageClass *klass)
 
   viewable_class->default_stock_id    = "gimp-image";
   viewable_class->get_size            = gimp_image_get_size;
-  viewable_class->invalidate_preview  = gimp_image_invalidate_preview;
   viewable_class->size_changed        = gimp_image_size_changed;
   viewable_class->get_preview_size    = gimp_image_get_preview_size;
   viewable_class->get_popup_size      = gimp_image_get_popup_size;
-  viewable_class->get_preview         = gimp_image_get_preview;
   viewable_class->get_new_preview     = gimp_image_get_new_preview;
   viewable_class->get_description     = gimp_image_get_description;
 
@@ -728,8 +725,6 @@ gimp_image_init (GimpImage *image)
   private->group_count         = 0;
   private->pushing_undo_group  = GIMP_UNDO_GROUP_NONE;
 
-  private->preview             = NULL;
-
   private->flush_accum.alpha_changed              = FALSE;
   private->flush_accum.mask_changed               = FALSE;
   private->flush_accum.floating_selection_changed = FALSE;
@@ -947,12 +942,6 @@ gimp_image_finalize (GObject *object)
       private->selection_mask = NULL;
     }
 
-  if (private->preview)
-    {
-      gimp_temp_buf_unref (private->preview);
-      private->preview = NULL;
-    }
-
   if (private->parasites)
     {
       g_object_unref (private->parasites);
@@ -1074,8 +1063,6 @@ gimp_image_get_memsize (GimpObject *object,
   memsize += gimp_object_get_memsize (GIMP_OBJECT (private->redo_stack),
                                       gui_size);
 
-  *gui_size += gimp_temp_buf_get_memsize (private->preview);
-
   return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
                                                                   gui_size);
 }
@@ -1094,20 +1081,6 @@ gimp_image_get_size (GimpViewable *viewable,
 }
 
 static void
-gimp_image_invalidate_preview (GimpViewable *viewable)
-{
-  GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (viewable);
-
-  GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview (viewable);
-
-  if (private->preview)
-    {
-      gimp_temp_buf_unref (private->preview);
-      private->preview = NULL;
-    }
-}
-
-static void
 gimp_image_size_changed (GimpViewable *viewable)
 {
   GimpImage *image = GIMP_IMAGE (viewable);



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