[gimp] Move "floating_sel" and "selection_mask" to GimpImagePrivate
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Move "floating_sel" and "selection_mask" to GimpImagePrivate
- Date: Wed, 3 Feb 2010 22:24:43 +0000 (UTC)
commit 4a247e9182b07d33ddbff7184c9440cb2ec56bfb
Author: Michael Natterer <mitch gimp org>
Date: Wed Feb 3 23:24:18 2010 +0100
Move "floating_sel" and "selection_mask" to GimpImagePrivate
app/core/gimpimage-duplicate.c | 15 +++++++++------
app/core/gimpimage-private.h | 3 +++
app/core/gimpimage.c | 34 +++++++++++++++++++---------------
app/core/gimpimage.h | 3 ---
app/xcf/xcf-load.c | 5 +++--
5 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c
index b53a9f7..e967451 100644
--- a/app/core/gimpimage-duplicate.c
+++ b/app/core/gimpimage-duplicate.c
@@ -325,14 +325,17 @@ static void
gimp_image_duplicate_mask (GimpImage *image,
GimpImage *new_image)
{
+ GimpChannel *mask;
+ GimpChannel *new_mask;
TileManager *src_tiles;
TileManager *dest_tiles;
PixelRegion srcPR, destPR;
- src_tiles =
- gimp_drawable_get_tiles (GIMP_DRAWABLE (gimp_image_get_mask (image)));
- dest_tiles =
- gimp_drawable_get_tiles (GIMP_DRAWABLE (gimp_image_get_mask (new_image)));
+ mask = gimp_image_get_mask (image);
+ new_mask = gimp_image_get_mask (new_image);
+
+ src_tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (mask));
+ dest_tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (new_mask));
pixel_region_init (&srcPR, src_tiles,
0, 0,
@@ -347,8 +350,8 @@ gimp_image_duplicate_mask (GimpImage *image,
copy_region (&srcPR, &destPR);
- new_image->selection_mask->bounds_known = FALSE;
- new_image->selection_mask->boundary_known = FALSE;
+ new_mask->bounds_known = FALSE;
+ new_mask->boundary_known = FALSE;
}
static void
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 4f5c0ae..a8a680f 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -70,6 +70,9 @@ struct _GimpImagePrivate
GimpLayer *active_layer; /* the active layer */
GimpChannel *active_channel; /* the active channel */
GimpVectors *active_vectors; /* the active vectors */
+
+ GimpLayer *floating_sel; /* the FS layer */
+ GimpChannel *selection_mask; /* the selection mask channel */
};
#define GIMP_IMAGE_GET_PRIVATE(image) \
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index e752adb..6a87464 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -656,8 +656,8 @@ gimp_image_init (GimpImage *image)
private->active_channel = NULL;
private->active_vectors = NULL;
- image->floating_sel = NULL;
- image->selection_mask = NULL;
+ private->floating_sel = NULL;
+ private->selection_mask = NULL;
image->parasites = gimp_parasite_list_new ();
@@ -738,12 +738,12 @@ gimp_image_constructor (GType type,
}
/* create the selection mask */
- image->selection_mask = gimp_selection_new (image,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
- g_object_ref_sink (image->selection_mask);
+ private->selection_mask = gimp_selection_new (image,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
+ g_object_ref_sink (private->selection_mask);
- g_signal_connect (image->selection_mask, "update",
+ g_signal_connect (private->selection_mask, "update",
G_CALLBACK (gimp_image_mask_update),
image);
@@ -909,10 +909,10 @@ gimp_image_finalize (GObject *object)
private->layer_stack = NULL;
}
- if (image->selection_mask)
+ if (private->selection_mask)
{
- g_object_unref (image->selection_mask);
- image->selection_mask = NULL;
+ g_object_unref (private->selection_mask);
+ private->selection_mask = NULL;
}
if (image->preview)
@@ -1031,7 +1031,7 @@ gimp_image_get_memsize (GimpObject *object,
memsize += gimp_g_slist_get_memsize (private->layer_stack, 0);
- memsize += gimp_object_get_memsize (GIMP_OBJECT (image->selection_mask),
+ memsize += gimp_object_get_memsize (GIMP_OBJECT (private->selection_mask),
gui_size);
memsize += gimp_object_get_memsize (GIMP_OBJECT (image->parasites),
@@ -1680,12 +1680,16 @@ void
gimp_image_set_floating_selection (GimpImage *image,
GimpLayer *floating_sel)
{
+ GimpImagePrivate *private;
+
g_return_if_fail (GIMP_IS_IMAGE (image));
g_return_if_fail (floating_sel == NULL || GIMP_IS_LAYER (floating_sel));
- if (image->floating_sel != floating_sel)
+ private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ if (private->floating_sel != floating_sel)
{
- image->floating_sel = floating_sel;
+ private->floating_sel = floating_sel;
image->flush_accum.floating_selection_changed = TRUE;
}
@@ -1696,7 +1700,7 @@ gimp_image_get_floating_selection (const GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- return image->floating_sel;
+ return GIMP_IMAGE_GET_PRIVATE (image)->floating_sel;
}
void
@@ -1712,7 +1716,7 @@ gimp_image_get_mask (const GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- return image->selection_mask;
+ return GIMP_IMAGE_GET_PRIVATE (image)->selection_mask;
}
void
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 8c6e3cb..4e65821 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*/
- GimpLayer *floating_sel; /* the FS layer */
- GimpChannel *selection_mask; /* the selection mask channel */
-
GimpParasiteList *parasites; /* Plug-in parasite data */
gboolean visible[MAX_CHANNELS]; /* visible channels */
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index c1cdb5c..8c46ed4 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -920,11 +920,12 @@ xcf_load_channel_props (XcfInfo *info,
case PROP_SELECTION:
{
- GimpChannel *mask;
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+ GimpChannel *mask;
g_object_unref (gimp_image_get_mask (image));
- mask = image->selection_mask =
+ mask = private->selection_mask =
gimp_selection_new (image,
gimp_item_get_width (GIMP_ITEM (*channel)),
gimp_item_get_height (GIMP_ITEM (*channel)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]