Commit d2a716d3 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/core/gimpdrawable.h move the preview related members to the private

2009-02-05  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawable.h
	* app/core/gimpdrawable-preview.c: move the preview related
	members to the private struct.

	* app/core/gimpdrawable.c
	* app/core/gimpdrawable-private.h
	* app/core/gimpselection.c: changed accordingly.


svn path=/trunk/; revision=27986
parent b0f519d5
2009-02-05 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.h
* app/core/gimpdrawable-preview.c: move the preview related
members to the private struct.
* app/core/gimpdrawable.c
* app/core/gimpdrawable-private.h
* app/core/gimpselection.c: changed accordingly.
2009-02-05 Michael Natterer <mitch@gimp.org>
* app/core/core-types.h: sort the types by inheritence again, but
......
......@@ -37,6 +37,7 @@
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimpdrawable-preview.h"
#include "gimpdrawable-private.h"
#include "gimplayer.h"
#include "gimppreviewcache.h"
......@@ -74,7 +75,7 @@ gimp_drawable_get_preview (GimpViewable *viewable,
return NULL;
/* Ok prime the cache with a large preview if the cache is invalid */
if (! drawable->preview_valid &&
if (! drawable->private->preview_valid &&
width <= PREVIEW_CACHE_PRIME_WIDTH &&
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
image &&
......@@ -171,8 +172,8 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
{
TempBuf *ret_buf;
if (! drawable->preview_valid ||
! (ret_buf = gimp_preview_cache_get (&drawable->preview_cache,
if (! drawable->private->preview_valid ||
! (ret_buf = gimp_preview_cache_get (&drawable->private->preview_cache,
width, height)))
{
GimpItem *item = GIMP_ITEM (drawable);
......@@ -184,12 +185,12 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
width,
height);
if (! drawable->preview_valid)
gimp_preview_cache_invalidate (&drawable->preview_cache);
if (! drawable->private->preview_valid)
gimp_preview_cache_invalidate (&drawable->private->preview_cache);
drawable->preview_valid = TRUE;
drawable->private->preview_valid = TRUE;
gimp_preview_cache_add (&drawable->preview_cache, ret_buf);
gimp_preview_cache_add (&drawable->private->preview_cache, ret_buf);
}
return ret_buf;
......
......@@ -30,6 +30,9 @@ struct _GimpDrawablePrivate
GeglNode *fs_mode_node;
GeglNode *mode_node;
GSList *preview_cache; /* preview caches of the channel */
gboolean preview_valid; /* is the preview valid? */
};
#endif /* __GIMP_DRAWABLE_PRIVATE_H__ */
......@@ -233,15 +233,13 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
static void
gimp_drawable_init (GimpDrawable *drawable)
{
drawable->private = G_TYPE_INSTANCE_GET_PRIVATE (drawable,
GIMP_TYPE_DRAWABLE,
GimpDrawablePrivate);
drawable->bytes = 0;
drawable->type = -1;
drawable->has_alpha = FALSE;
drawable->preview_cache = NULL;
drawable->preview_valid = FALSE;
drawable->private = G_TYPE_INSTANCE_GET_PRIVATE (drawable,
GIMP_TYPE_DRAWABLE,
GimpDrawablePrivate);
drawable->bytes = 0;
drawable->type = -1;
drawable->has_alpha = FALSE;
}
/* sorry for the evil casts */
......@@ -278,8 +276,8 @@ gimp_drawable_finalize (GObject *object)
drawable->private->source_node = NULL;
}
if (drawable->preview_cache)
gimp_preview_cache_invalidate (&drawable->preview_cache);
if (drawable->private->preview_cache)
gimp_preview_cache_invalidate (&drawable->private->preview_cache);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -295,7 +293,7 @@ gimp_drawable_get_memsize (GimpObject *object,
FALSE);
memsize += tile_manager_get_memsize (drawable->private->shadow, FALSE);
*gui_size += gimp_preview_cache_get_memsize (drawable->preview_cache);
*gui_size += gimp_preview_cache_get_memsize (drawable->private->preview_cache);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
......@@ -322,10 +320,10 @@ gimp_drawable_invalidate_preview (GimpViewable *viewable)
if (GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview)
GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview (viewable);
drawable->preview_valid = FALSE;
drawable->private->preview_valid = FALSE;
if (drawable->preview_cache)
gimp_preview_cache_invalidate (&drawable->preview_cache);
if (drawable->private->preview_cache)
gimp_preview_cache_invalidate (&drawable->private->preview_cache);
}
static void
......@@ -1080,8 +1078,8 @@ gimp_drawable_configure (GimpDrawable *drawable,
drawable->private->tiles = tile_manager_new (width, height, drawable->bytes);
/* preview variables */
drawable->preview_cache = NULL;
drawable->preview_valid = FALSE;
drawable->private->preview_cache = NULL;
drawable->private->preview_valid = FALSE;
gimp_drawable_update_tile_source_node (drawable);
}
......
......@@ -41,10 +41,6 @@ struct _GimpDrawable
GimpImageType type; /* type of drawable */
gboolean has_alpha; /* drawable has alpha */
/* Preview variables */
GSList *preview_cache; /* preview caches of the channel */
gboolean preview_valid; /* is the preview valid? */
GimpDrawablePrivate *private;
};
......
......@@ -31,6 +31,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpdrawable-private.h"
#include "gimperror.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
......@@ -311,7 +312,7 @@ gimp_selection_invalidate_boundary (GimpDrawable *drawable)
gimp_item_get_height (GIMP_ITEM (layer)));
/* invalidate the preview */
drawable->preview_valid = FALSE;
drawable->private->preview_valid = FALSE;
}
static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment