[gimp] Move "preview" to GimpImagePrivate



commit 0f0853ca86cfbcc316e88390f5c57d280485e849
Author: Michael Natterer <mitch gimp org>
Date:   Thu Feb 4 21:09:19 2010 +0100

    Move "preview" to GimpImagePrivate

 app/core/gimpimage-preview.c |   23 ++++++++++++-----------
 app/core/gimpimage-private.h |    3 +++
 app/core/gimpimage.c         |   18 +++++++++---------
 app/core/gimpimage.h         |    3 ---
 4 files changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c
index 364b5ec..8e77c0e 100644
--- a/app/core/gimpimage-preview.c
+++ b/app/core/gimpimage-preview.c
@@ -26,6 +26,7 @@
 
 #include "gimpimage.h"
 #include "gimpimage-preview.h"
+#include "gimpimage-private.h"
 #include "gimpprojection.h"
 
 
@@ -97,25 +98,25 @@ gimp_image_get_preview (GimpViewable *viewable,
                         gint          width,
                         gint          height)
 {
-  GimpImage *image = GIMP_IMAGE (viewable);
+  GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (viewable);
 
-  if (image->preview                  &&
-      image->preview->width  == width &&
-      image->preview->height == height)
+  if (private->preview                  &&
+      private->preview->width  == width &&
+      private->preview->height == height)
     {
       /*  The easy way  */
-      return image->preview;
+      return private->preview;
     }
   else
     {
       /*  The hard way  */
-      if (image->preview)
-        temp_buf_free (image->preview);
+      if (private->preview)
+        temp_buf_free (private->preview);
 
-      image->preview = gimp_image_get_new_preview (viewable, context,
-                                                   width, height);
+      private->preview = gimp_image_get_new_preview (viewable, context,
+                                                     width, height);
 
-      return image->preview;
+      return private->preview;
     }
 }
 
@@ -125,7 +126,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
                             gint          width,
                             gint          height)
 {
-  GimpImage      *image = GIMP_IMAGE (viewable);
+  GimpImage      *image      = GIMP_IMAGE (viewable);
   GimpProjection *projection = gimp_image_get_projection (image);
   TempBuf        *buf;
   TileManager    *tiles;
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index cc3cea5..d63e979 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -88,6 +88,9 @@ struct _GimpImagePrivate
   GimpUndoStack     *redo_stack;            /*  stack for redo operations    */
   gint               group_count;           /*  nested undo groups           */
   GimpUndoType       pushing_undo_group;    /*  undo group status flag       */
+
+  /*  Preview  */
+  TempBuf           *preview;               /*  the projection preview       */
 };
 
 #define GIMP_IMAGE_GET_PRIVATE(image) \
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 4b43f34..004b455 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -676,7 +676,7 @@ gimp_image_init (GimpImage *image)
   private->group_count         = 0;
   private->pushing_undo_group  = GIMP_UNDO_GROUP_NONE;
 
-  image->preview               = NULL;
+  private->preview             = NULL;
 
   image->flush_accum.alpha_changed              = FALSE;
   image->flush_accum.mask_changed               = FALSE;
@@ -915,10 +915,10 @@ gimp_image_finalize (GObject *object)
       private->selection_mask = NULL;
     }
 
-  if (image->preview)
+  if (private->preview)
     {
-      temp_buf_free (image->preview);
-      image->preview = NULL;
+      temp_buf_free (private->preview);
+      private->preview = NULL;
     }
 
   if (private->parasites)
@@ -1042,7 +1042,7 @@ gimp_image_get_memsize (GimpObject *object,
   memsize += gimp_object_get_memsize (GIMP_OBJECT (private->redo_stack),
                                       gui_size);
 
-  *gui_size += temp_buf_get_memsize (image->preview);
+  *gui_size += temp_buf_get_memsize (private->preview);
 
   return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
                                                                   gui_size);
@@ -1064,14 +1064,14 @@ gimp_image_get_size (GimpViewable *viewable,
 static void
 gimp_image_invalidate_preview (GimpViewable *viewable)
 {
-  GimpImage *image = GIMP_IMAGE (viewable);
+  GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (viewable);
 
   GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview (viewable);
 
-  if (image->preview)
+  if (private->preview)
     {
-      temp_buf_free (image->preview);
-      image->preview = NULL;
+      temp_buf_free (private->preview);
+      private->preview = NULL;
     }
 }
 
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 9385eb6..4bd2da0 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -105,9 +105,6 @@ struct _GimpImage
 
   Gimp              *gimp;                  /*  the GIMP the image belongs to*/
 
-  /*  Preview  */
-  TempBuf           *preview;               /*  the projection preview       */
-
   /*  Signal emmision accumulator  */
   GimpImageFlushAccumulator  flush_accum;
 };



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