[gimp] Move "projection" and "graph" to GimpImagePrivate
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Move "projection" and "graph" to GimpImagePrivate
- Date: Wed, 3 Feb 2010 20:46:35 +0000 (UTC)
commit 2005fd1a682c29367d5f42c571c378a34a0c99be
Author: Michael Natterer <mitch gimp org>
Date: Wed Feb 3 21:46:09 2010 +0100
Move "projection" and "graph" to GimpImagePrivate
app/actions/view-actions.c | 6 +++-
app/actions/view-commands.c | 2 +-
app/core/gimp-edit.c | 14 ++++++--
app/core/gimpchannel.c | 27 +++++++++-------
app/core/gimpimage-contiguous-region.c | 4 +-
app/core/gimpimage-crop.c | 2 +-
app/core/gimpimage-pick-color.c | 2 +-
app/core/gimpimage-preview.c | 21 ++++++-------
app/core/gimpimage-private.h | 3 ++
app/core/gimpimage.c | 50 ++++++++++++++++---------------
app/core/gimpimage.h | 3 --
app/core/gimpimagefile.c | 2 +-
app/core/gimppalette-import.c | 13 +++++---
13 files changed, 83 insertions(+), 66 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index b245653..c6b0551 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -547,6 +547,7 @@ 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)
{
@@ -564,6 +565,9 @@ 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) \
@@ -670,7 +674,7 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-shrink-wrap", image);
SET_SENSITIVE ("view-fullscreen", image);
SET_ACTIVE ("view-fullscreen", display && fullscreen);
- SET_ACTIVE ("view-use-gegl", image && image->projection->use_gegl);
+ 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 ace7806..a0b687a 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -721,7 +721,7 @@ view_use_gegl_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- image->projection->use_gegl = active;
+ gimp_image_get_projection (image)->use_gegl = active;
layers = gimp_image_get_layer_list (image);
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 442e469..e87e099 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -131,13 +131,16 @@ gimp_edit_copy_visible (GimpImage *image,
GimpContext *context,
GError **error)
{
- GimpBuffer *buffer;
+ GimpProjection *projection;
+ GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- buffer = gimp_edit_extract (image, GIMP_PICKABLE (image->projection),
+ projection = gimp_image_get_projection (image);
+
+ buffer = gimp_edit_extract (image, GIMP_PICKABLE (projection),
context, FALSE, error);
if (buffer)
@@ -405,14 +408,17 @@ gimp_edit_named_copy_visible (GimpImage *image,
GimpContext *context,
GError **error)
{
- GimpBuffer *buffer;
+ GimpProjection *projection;
+ GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- buffer = gimp_edit_extract (image, GIMP_PICKABLE (image->projection),
+ projection = gimp_image_get_projection (image);
+
+ buffer = gimp_edit_extract (image, GIMP_PICKABLE (projection),
context, FALSE, error);
if (buffer)
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 16f72ce..1d75e9e 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1647,13 +1647,14 @@ gimp_channel_new_from_component (GimpImage *image,
const gchar *name,
const GimpRGB *color)
{
- GimpChannel *channel;
- TileManager *projection;
- PixelRegion src;
- PixelRegion dest;
- gint width;
- gint height;
- gint pixel;
+ GimpProjection *projection;
+ GimpChannel *channel;
+ TileManager *proj_tiles;
+ PixelRegion src;
+ PixelRegion dest;
+ gint width;
+ gint height;
+ gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
@@ -1661,15 +1662,17 @@ gimp_channel_new_from_component (GimpImage *image,
g_return_val_if_fail (pixel != -1, NULL);
- gimp_pickable_flush (GIMP_PICKABLE (image->projection));
+ projection = gimp_image_get_projection (image);
+
+ gimp_pickable_flush (GIMP_PICKABLE (projection));
- projection = gimp_pickable_get_tiles (GIMP_PICKABLE (image->projection));
- width = tile_manager_width (projection);
- height = tile_manager_height (projection);
+ proj_tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
+ width = tile_manager_width (proj_tiles);
+ height = tile_manager_height (proj_tiles);
channel = gimp_channel_new (image, width, height, name, color);
- pixel_region_init (&src, projection,
+ pixel_region_init (&src, proj_tiles,
0, 0, width, height, FALSE);
pixel_region_init (&dest,
gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
diff --git a/app/core/gimpimage-contiguous-region.c b/app/core/gimpimage-contiguous-region.c
index ab0f417..7ff166d 100644
--- a/app/core/gimpimage-contiguous-region.c
+++ b/app/core/gimpimage-contiguous-region.c
@@ -127,7 +127,7 @@ gimp_image_contiguous_region_by_seed (GimpImage *image,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (sample_merged)
- pickable = GIMP_PICKABLE (image->projection);
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
else
pickable = GIMP_PICKABLE (drawable);
@@ -234,7 +234,7 @@ gimp_image_contiguous_region_by_color (GimpImage *image,
cont.color + 3);
if (sample_merged)
- pickable = GIMP_PICKABLE (image->projection);
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
else
pickable = GIMP_PICKABLE (drawable);
diff --git a/app/core/gimpimage-crop.c b/app/core/gimpimage-crop.c
index 3138afe..948bf3e 100644
--- a/app/core/gimpimage-crop.c
+++ b/app/core/gimpimage-crop.c
@@ -345,7 +345,7 @@ gimp_image_crop_auto_shrink (GimpImage *image,
}
else
{
- pickable = GIMP_PICKABLE (image->projection);
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
}
gimp_pickable_flush (pickable);
diff --git a/app/core/gimpimage-pick-color.c b/app/core/gimpimage-pick-color.c
index 4cdaa7c..963f784 100644
--- a/app/core/gimpimage-pick-color.c
+++ b/app/core/gimpimage-pick-color.c
@@ -58,7 +58,7 @@ gimp_image_pick_color (GimpImage *image,
if (sample_merged)
{
- pickable = GIMP_PICKABLE (image->projection);
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
}
else
{
diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c
index 9748d19..364b5ec 100644
--- a/app/core/gimpimage-preview.c
+++ b/app/core/gimpimage-preview.c
@@ -125,21 +125,20 @@ gimp_image_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
{
- GimpImage *image = GIMP_IMAGE (viewable);
- TempBuf *buf;
- TileManager *tiles;
- gdouble scale_x;
- gdouble scale_y;
- gint level;
- gboolean is_premult;
+ GimpImage *image = GIMP_IMAGE (viewable);
+ GimpProjection *projection = gimp_image_get_projection (image);
+ TempBuf *buf;
+ TileManager *tiles;
+ gdouble scale_x;
+ gdouble scale_y;
+ gint level;
+ gboolean is_premult;
scale_x = (gdouble) width / (gdouble) gimp_image_get_width (image);
scale_y = (gdouble) height / (gdouble) gimp_image_get_height (image);
- level = gimp_projection_get_level (image->projection, scale_x, scale_y);
-
- tiles = gimp_projection_get_tiles_at_level (image->projection, level,
- &is_premult);
+ level = gimp_projection_get_level (projection, scale_x, scale_y);
+ tiles = gimp_projection_get_tiles_at_level (projection, level, &is_premult);
buf = tile_manager_get_preview (tiles, width, height);
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 5789701..6d55860 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -49,6 +49,9 @@ struct _GimpImagePrivate
gint disp_count; /* number of displays */
GimpTattoo tattoo_state; /* the last used tattoo */
+
+ GimpProjection *projection; /* projection layers & channels */
+ GeglNode *graph; /* GEGL projection graph */
};
#define GIMP_IMAGE_GET_PRIVATE(image) \
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 0897300..794b2a1 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -612,7 +612,7 @@ gimp_image_init (GimpImage *image)
private->tattoo_state = 0;
- image->projection = gimp_projection_new (GIMP_PROJECTABLE (image));
+ private->projection = gimp_projection_new (GIMP_PROJECTABLE (image));
image->guides = NULL;
image->grid = NULL;
@@ -869,16 +869,16 @@ gimp_image_finalize (GObject *object)
GimpImage *image = GIMP_IMAGE (object);
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
- if (image->projection)
+ if (private->projection)
{
- g_object_unref (image->projection);
- image->projection = NULL;
+ g_object_unref (private->projection);
+ private->projection = NULL;
}
- if (image->graph)
+ if (private->graph)
{
- g_object_unref (image->graph);
- image->graph = NULL;
+ g_object_unref (private->graph);
+ private->graph = NULL;
}
if (private->colormap)
@@ -1003,13 +1003,14 @@ static gint64
gimp_image_get_memsize (GimpObject *object,
gint64 *gui_size)
{
- GimpImage *image = GIMP_IMAGE (object);
- gint64 memsize = 0;
+ GimpImage *image = GIMP_IMAGE (object);
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+ gint64 memsize = 0;
if (gimp_image_get_colormap (image))
memsize += GIMP_IMAGE_COLORMAP_SIZE;
- memsize += gimp_object_get_memsize (GIMP_OBJECT (image->projection),
+ memsize += gimp_object_get_memsize (GIMP_OBJECT (private->projection),
gui_size);
memsize += gimp_g_list_get_memsize (gimp_image_get_guides (image),
@@ -1238,28 +1239,29 @@ gimp_image_get_image_type (GimpProjectable *projectable)
static GeglNode *
gimp_image_get_graph (GimpProjectable *projectable)
{
- GimpImage *image = GIMP_IMAGE (projectable);
- GeglNode *layers_node;
- GeglNode *channels_node;
- GeglNode *blend_node;
- GeglNode *output;
+ GimpImage *image = GIMP_IMAGE (projectable);
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+ GeglNode *layers_node;
+ GeglNode *channels_node;
+ GeglNode *blend_node;
+ GeglNode *output;
- if (image->graph)
- return image->graph;
+ if (private->graph)
+ return private->graph;
- image->graph = gegl_node_new ();
+ private->graph = gegl_node_new ();
layers_node =
gimp_drawable_stack_get_graph (GIMP_DRAWABLE_STACK (image->layers));
- gegl_node_add_child (image->graph, layers_node);
+ gegl_node_add_child (private->graph, layers_node);
channels_node =
gimp_drawable_stack_get_graph (GIMP_DRAWABLE_STACK (image->channels));
- gegl_node_add_child (image->graph, channels_node);
+ gegl_node_add_child (private->graph, channels_node);
- blend_node = gegl_node_new_child (image->graph,
+ blend_node = gegl_node_new_child (private->graph,
"operation", "gegl:over",
NULL);
@@ -1268,12 +1270,12 @@ gimp_image_get_graph (GimpProjectable *projectable)
gegl_node_connect_to (channels_node, "output",
blend_node, "aux");
- output = gegl_node_get_output_proxy (image->graph, "output");
+ output = gegl_node_get_output_proxy (private->graph, "output");
gegl_node_connect_to (blend_node, "output",
output, "input");
- return image->graph;
+ return private->graph;
}
static void
@@ -2743,7 +2745,7 @@ gimp_image_get_projection (const GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- return image->projection;
+ return GIMP_IMAGE_GET_PRIVATE (image)->projection;
}
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 90c6d42..109f68f 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*/
- GimpProjection *projection; /* projection layers & channels */
- GeglNode *graph; /* GEGL projection graph */
-
GList *guides; /* guides */
GimpGrid *grid; /* grid */
GList *sample_points; /* color sample points */
diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c
index 8f70df3..fc9a4d1 100644
--- a/app/core/gimpimagefile.c
+++ b/app/core/gimpimagefile.c
@@ -770,7 +770,7 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
}
/* we need the projection constructed NOW, not some time later */
- gimp_pickable_flush (GIMP_PICKABLE (image->projection));
+ gimp_pickable_flush (GIMP_PICKABLE (gimp_image_get_projection (image)));
pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image),
/* random context, unused */
diff --git a/app/core/gimppalette-import.c b/app/core/gimppalette-import.c
index 1f63935..0fb9504 100644
--- a/app/core/gimppalette-import.c
+++ b/app/core/gimppalette-import.c
@@ -361,16 +361,19 @@ gimp_palette_import_from_image (GimpImage *image,
gint threshold,
gboolean selection_only)
{
- GHashTable *colors;
- gint x, y;
- gint width, height;
+ GimpProjection *projection;
+ GHashTable *colors;
+ gint x, y;
+ gint width, height;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (palette_name != NULL, NULL);
g_return_val_if_fail (n_colors > 1, NULL);
g_return_val_if_fail (threshold > 0, NULL);
- gimp_pickable_flush (GIMP_PICKABLE (image->projection));
+ projection = gimp_image_get_projection (image);
+
+ gimp_pickable_flush (GIMP_PICKABLE (projection));
if (selection_only)
{
@@ -389,7 +392,7 @@ gimp_palette_import_from_image (GimpImage *image,
}
colors = gimp_palette_import_extract (image,
- GIMP_PICKABLE (image->projection),
+ GIMP_PICKABLE (projection),
0, 0,
selection_only,
x, y, width, height,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]