Move "preview" to GimpImagePrivate

This commit is contained in:
Michael Natterer 2010-02-04 21:09:19 +01:00
parent 09c897262e
commit 0f0853ca86
4 changed files with 24 additions and 23 deletions

View File

@ -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;

View File

@ -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) \

View File

@ -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;
}
}

View File

@ -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;
};