[gimp] app: move all GimpFillOptions members to private
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move all GimpFillOptions members to private
- Date: Sat, 5 Mar 2011 19:27:04 +0000 (UTC)
commit 5ad45dae039e348700f92db378c206d2ed82e0b5
Author: Michael Natterer <mitch gimp org>
Date: Sat Mar 5 20:26:41 2011 +0100
app: move all GimpFillOptions members to private
app/core/gimpdrawable-stroke.c | 16 +++++++----
app/core/gimpfilloptions.c | 56 ++++++++++++++++++++++++++++++++-------
app/core/gimpfilloptions.h | 18 +++++--------
3 files changed, 63 insertions(+), 27 deletions(-)
---
diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c
index 44a782e..f91f495 100644
--- a/app/core/gimpdrawable-stroke.c
+++ b/app/core/gimpdrawable-stroke.c
@@ -86,7 +86,8 @@ gimp_drawable_fill_boundary (GimpDrawable *drawable,
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options));
g_return_if_fail (bound_segs == NULL || n_bound_segs != 0);
- g_return_if_fail (options->style != GIMP_FILL_STYLE_PATTERN ||
+ g_return_if_fail (gimp_fill_options_get_style (options) !=
+ GIMP_FILL_STYLE_PATTERN ||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
scan_convert = gimp_drawable_render_boundary (drawable,
@@ -116,7 +117,8 @@ gimp_drawable_stroke_boundary (GimpDrawable *drawable,
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options));
g_return_if_fail (bound_segs == NULL || n_bound_segs != 0);
- g_return_if_fail (GIMP_FILL_OPTIONS (options)->style != GIMP_FILL_STYLE_PATTERN ||
+ g_return_if_fail (gimp_fill_options_get_style (GIMP_FILL_OPTIONS (options)) !=
+ GIMP_FILL_STYLE_PATTERN ||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
scan_convert = gimp_drawable_render_boundary (drawable,
@@ -144,7 +146,8 @@ gimp_drawable_fill_vectors (GimpDrawable *drawable,
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
- g_return_val_if_fail (options->style != GIMP_FILL_STYLE_PATTERN ||
+ g_return_val_if_fail (gimp_fill_options_get_style (options) !=
+ GIMP_FILL_STYLE_PATTERN ||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL,
FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -176,7 +179,8 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (GIMP_IS_STROKE_OPTIONS (options), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
- g_return_val_if_fail (GIMP_FILL_OPTIONS (options)->style != GIMP_FILL_STYLE_PATTERN ||
+ g_return_val_if_fail (gimp_fill_options_get_style (GIMP_FILL_OPTIONS (options)) !=
+ GIMP_FILL_STYLE_PATTERN ||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL,
FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -402,7 +406,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
gimp_scan_convert_render (scan_convert, mask,
x + off_x, y + off_y,
- GIMP_FILL_OPTIONS (options)->antialias);
+ gimp_fill_options_get_antialias (GIMP_FILL_OPTIONS (options)));
bytes = gimp_drawable_bytes_with_alpha (drawable);
@@ -410,7 +414,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
pixel_region_init (&basePR, base, 0, 0, w, h, TRUE);
pixel_region_init (&maskPR, mask, 0, 0, w, h, FALSE);
- switch (options->style)
+ switch (gimp_fill_options_get_style (options))
{
case GIMP_FILL_STYLE_SOLID:
{
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index 4465d55..67470d9 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -42,6 +42,24 @@ enum
};
+typedef struct _GimpFillOptionsPrivate GimpFillOptionsPrivate;
+
+struct _GimpFillOptionsPrivate
+{
+ GimpFillStyle style;
+
+ gboolean antialias;
+
+ GimpViewType pattern_view_type;
+ GimpViewSize pattern_view_size;
+};
+
+#define GET_PRIVATE(options) \
+ G_TYPE_INSTANCE_GET_PRIVATE (options, \
+ GIMP_TYPE_FILL_OPTIONS, \
+ GimpFillOptionsPrivate)
+
+
static void gimp_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -90,6 +108,8 @@ gimp_fill_options_class_init (GimpFillOptionsClass *klass)
GIMP_VIEW_SIZE_SMALL,
G_PARAM_CONSTRUCT |
GIMP_PARAM_READWRITE));
+
+ g_type_class_add_private (klass, sizeof (GimpFillOptionsPrivate));
}
static void
@@ -103,22 +123,22 @@ gimp_fill_options_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GimpFillOptions *options = GIMP_FILL_OPTIONS (object);
+ GimpFillOptionsPrivate *private = GET_PRIVATE (object);
switch (property_id)
{
case PROP_STYLE:
- options->style = g_value_get_enum (value);
+ private->style = g_value_get_enum (value);
break;
case PROP_ANTIALIAS:
- options->antialias = g_value_get_boolean (value);
+ private->antialias = g_value_get_boolean (value);
break;
case PROP_PATTERN_VIEW_TYPE:
- options->pattern_view_type = g_value_get_enum (value);
+ private->pattern_view_type = g_value_get_enum (value);
break;
case PROP_PATTERN_VIEW_SIZE:
- options->pattern_view_size = g_value_get_int (value);
+ private->pattern_view_size = g_value_get_int (value);
break;
default:
@@ -133,22 +153,22 @@ gimp_fill_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GimpFillOptions *options = GIMP_FILL_OPTIONS (object);
+ GimpFillOptionsPrivate *private = GET_PRIVATE (object);
switch (property_id)
{
case PROP_STYLE:
- g_value_set_enum (value, options->style);
+ g_value_set_enum (value, private->style);
break;
case PROP_ANTIALIAS:
- g_value_set_boolean (value, options->antialias);
+ g_value_set_boolean (value, private->antialias);
break;
case PROP_PATTERN_VIEW_TYPE:
- g_value_set_enum (value, options->pattern_view_type);
+ g_value_set_enum (value, private->pattern_view_type);
break;
case PROP_PATTERN_VIEW_SIZE:
- g_value_set_int (value, options->pattern_view_size);
+ g_value_set_int (value, private->pattern_view_size);
break;
default:
@@ -169,3 +189,19 @@ gimp_fill_options_new (Gimp *gimp)
"gimp", gimp,
NULL);
}
+
+GimpFillStyle
+gimp_fill_options_get_style (GimpFillOptions *options)
+{
+ g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), GIMP_FILL_STYLE_SOLID);
+
+ return GET_PRIVATE (options)->style;
+}
+
+gboolean
+gimp_fill_options_get_antialias (GimpFillOptions *options)
+{
+ g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
+
+ return GET_PRIVATE (options)->antialias;
+}
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index df18706..31e72c2 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -37,25 +37,21 @@ typedef struct _GimpFillOptionsClass GimpFillOptionsClass;
struct _GimpFillOptions
{
- GimpContext parent_instance;
-
- GimpFillStyle style;
-
- gboolean antialias;
-
- GimpViewType pattern_view_type;
- GimpViewSize pattern_view_size;
+ GimpContext parent_instance;
};
struct _GimpFillOptionsClass
{
- GimpContextClass parent_class;
+ GimpContextClass parent_class;
};
-GType gimp_fill_options_get_type (void) G_GNUC_CONST;
+GType gimp_fill_options_get_type (void) G_GNUC_CONST;
+
+GimpFillOptions * gimp_fill_options_new (Gimp *gimp);
-GimpFillOptions * gimp_fill_options_new (Gimp *gimp);
+GimpFillStyle gimp_fill_options_get_style (GimpFillOptions *options);
+gboolean gimp_fill_options_get_antialias (GimpFillOptions *options);
#endif /* __GIMP_FILL_OPTIONS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]