From 5b0e0dbcbe5f4dea43da4c4cc7327e6f95df998d Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 30 May 2007 10:52:06 +0000 Subject: [PATCH] removed ClutterSmoothstep type; renamed clutter_smoothstep_func to clutter_smoothstep_inc_func; added clutter_smoothstep_dec_func --- ChangeLog | 10 +++ clutter/clutter-alpha.c | 104 +++++++------------------- clutter/clutter-alpha.h | 81 +++++++++----------- doc/reference/ChangeLog | 10 +++ doc/reference/clutter.types | 1 - doc/reference/tmpl/clutter-actor.sgml | 2 +- doc/reference/tmpl/clutter-alpha.sgml | 45 ----------- doc/reference/tmpl/clutter-media.sgml | 15 ++++ 8 files changed, 98 insertions(+), 170 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78d4f5fb4..349f43da2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-05-30 Tomas Frydrych + + * clutter/clutter-alpha.h: + * clutter/clutter-alpha.c: + Removed ClutterSmoothstep struct + (clutter_smoothstep_inc_func): + Renamed to clutter_smoothstep_func. + (clutter_smoothstep_added_func): + Added. + 2007-05-29 Tomas Frydrych * clutter/clutter-fixed.h: diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c index 3f1e8dd5d..9850984b8 100644 --- a/clutter/clutter-alpha.c +++ b/clutter/clutter-alpha.c @@ -728,67 +728,11 @@ clutter_square_func (ClutterAlpha *alpha, : 0; } -/** - * clutter_smoothstep_copy: - * @smoothstep: a #ClutterSmoothstep - * - * Makes an allocated copy of a smoothstep. - * - * Return value: the copied smoothstep. - * - * Since: 0.4 - */ -ClutterSmoothstep * -clutter_smoothstep_copy (const ClutterSmoothstep *smoothstep) -{ - ClutterSmoothstep *copy; - - copy = g_slice_new0 (ClutterSmoothstep); - - *copy = *smoothstep; - - return copy; -} /** - * clutter_smoothstep_free: - * @smoothstep: a #ClutterSmoothstep - * - * Frees the memory of an allocated smoothstep. - * - * Since: 0.4 - */ -void -clutter_smoothstep_free (ClutterSmoothstep *smoothstep) -{ - if (G_LIKELY (smoothstep)) - { - g_slice_free (ClutterSmoothstep, smoothstep); - } -} - -GType -clutter_smoothstep_get_type (void) -{ - static GType our_type = 0; - - if (G_UNLIKELY (!our_type)) - { - our_type = - g_boxed_type_register_static ("ClutterSmoothstep", - (GBoxedCopyFunc) clutter_smoothstep_copy, - (GBoxedFreeFunc) clutter_smoothstep_free); - } - - return our_type; -} - -/** - * clutter_smoothstep_func: + * clutter_smoothstep_inc_func: * @alpha: a #ClutterAlpha - * @data: pointer to a #ClutterSmoothstep defining the minimum and - * maximum thresholds for the smoothstep as supplied to - * clutter_alpha_set_func(). + * @dummy: unused * * Convenience alpha function for a smoothstep curve. You can use this * function as the alpha function for clutter_alpha_set_func(). @@ -798,14 +742,13 @@ clutter_smoothstep_get_type (void) * Since: 0.4 */ guint32 -clutter_smoothstep_func (ClutterAlpha *alpha, - gpointer *data) +clutter_smoothstep_inc_func (ClutterAlpha *alpha, + gpointer *dummy) { - ClutterSmoothstep *smoothstep = (ClutterSmoothstep*)data; ClutterTimeline *timeline; gint frame; gint n_frames; - gint32 r; + gint32 r; gint32 x; /* @@ -814,28 +757,14 @@ clutter_smoothstep_func (ClutterAlpha *alpha, * The earlier operations involve division, which we cannot do in 8.24 for * numbers in <0,1> we use ClutterFixed. */ - - g_return_val_if_fail (data, 0); - timeline = clutter_alpha_get_timeline (alpha); frame = clutter_timeline_get_current_frame (timeline); n_frames = clutter_timeline_get_n_frames (timeline); - r = CFX_DIV (frame, n_frames); - - if (r <= smoothstep->min) - return 0; - - if (r >= smoothstep->max) - return CLUTTER_ALPHA_MAX_ALPHA; - /* - * Normalize x for the smoothstep polynomal. - * - * Convert result to 8.24 for next step. + * Convert x to 8.24 for next step. */ - x = CFX_DIV ((r - smoothstep->min), (smoothstep->max - smoothstep->min)) - << 8; + x = CFX_DIV (frame, n_frames) << 8; /* * f(x) = -2x^3 + 3x^2 @@ -852,6 +781,25 @@ clutter_smoothstep_func (ClutterAlpha *alpha, return CFX_INT (r * CLUTTER_ALPHA_MAX_ALPHA); } +/** + * clutter_smoothstep_dec_func: + * @alpha: a #ClutterAlpha + * @dummy: unused + * + * Convenience alpha function for a downward smoothstep curve. You can use + * this function as the alpha function for clutter_alpha_set_func(). + * + * Return value: an alpha value + * + * Since: 0.4 + */ +guint32 +clutter_smoothstep_dec_func (ClutterAlpha *alpha, + gpointer *dummy) +{ + return CLUTTER_ALPHA_MAX_ALPHA - clutter_smoothstep_inc_func (alpha, dummy); +} + /** * clutter_exp_inc_func: * @alpha: a #ClutterAlpha diff --git a/clutter/clutter-alpha.h b/clutter/clutter-alpha.h index bf69ba1fb..6af270098 100644 --- a/clutter/clutter-alpha.h +++ b/clutter/clutter-alpha.h @@ -102,54 +102,45 @@ void clutter_alpha_set_timeline (ClutterAlpha *alpha, ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha); /* convenience functions */ -#define CLUTTER_ALPHA_RAMP_INC clutter_ramp_inc_func -#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func -#define CLUTTER_ALPHA_RAMP clutter_ramp_func -#define CLUTTER_ALPHA_SINE clutter_sine_func -#define CLUTTER_ALPHA_SINE_INC clutter_sine_inc_func -#define CLUTTER_ALPHA_SINE_DEC clutter_sine_dec_func -#define CLUTTER_ALPHA_SINE_HALF clutter_sine_half_func -#define CLUTTER_ALPHA_SQUARE clutter_square_func -#define CLUTTER_ALPHA_SMOOTHSTEP clutter_smoothstep_func -#define CLUTTER_ALPHA_EXP_INC clutter_exp_inc_func -#define CLUTTER_ALPHA_EXP_DEC clutter_exp_dec_func +#define CLUTTER_ALPHA_RAMP_INC clutter_ramp_inc_func +#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func +#define CLUTTER_ALPHA_RAMP clutter_ramp_func +#define CLUTTER_ALPHA_SINE clutter_sine_func +#define CLUTTER_ALPHA_SINE_INC clutter_sine_inc_func +#define CLUTTER_ALPHA_SINE_DEC clutter_sine_dec_func +#define CLUTTER_ALPHA_SINE_HALF clutter_sine_half_func +#define CLUTTER_ALPHA_SQUARE clutter_square_func +#define CLUTTER_ALPHA_SMOOTHSTEP_INC clutter_smoothstep_inc_func +#define CLUTTER_ALPHA_SMOOTHSTEP_DEC clutter_smoothstep_dec_func +#define CLUTTER_ALPHA_EXP_INC clutter_exp_inc_func +#define CLUTTER_ALPHA_EXP_DEC clutter_exp_dec_func #define CLUTTER_TYPE_SMOOTHSTEP (clutter_smoothstep_get_type ()) -typedef struct _ClutterSmoothstep ClutterSmoothstep; - -struct _ClutterSmoothstep -{ - ClutterFixed min; - ClutterFixed max; -}; - -ClutterSmoothstep * clutter_smoothstep_copy (const ClutterSmoothstep *smoothstep); - -void clutter_smoothstep_free (ClutterSmoothstep *smoothstep); - -guint32 clutter_ramp_inc_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_ramp_dec_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_ramp_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_sine_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_sine_inc_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_sine_dec_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_sine_half_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_square_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_smoothstep_func (ClutterAlpha *alpha, - gpointer *data); -guint32 clutter_exp_inc_func (ClutterAlpha *alpha, - gpointer dummy); -guint32 clutter_exp_dec_func (ClutterAlpha *alpha, - gpointer dummy); +guint32 clutter_ramp_inc_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_ramp_dec_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_ramp_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_sine_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_sine_inc_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_sine_dec_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_sine_half_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_square_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_smoothstep_inc_func (ClutterAlpha *alpha, + gpointer *data); +guint32 clutter_smoothstep_dec_func (ClutterAlpha *alpha, + gpointer *data); +guint32 clutter_exp_inc_func (ClutterAlpha *alpha, + gpointer dummy); +guint32 clutter_exp_dec_func (ClutterAlpha *alpha, + gpointer dummy); G_END_DECLS diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index 57c5d485c..dfa49737b 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,13 @@ +2007-05-30 Tomas Frydrych + + * clutter.types: + removed clutter_smoothstep_get_type. + + * tmpl/clutter-alpha.sgml: + * tmpl/clutter-actor.sgml: + * tmpl/clutter-media.sgml: + Updated templates. + 2007-05-22 Tomas Frydrych * clutter-sections.txt: diff --git a/doc/reference/clutter.types b/doc/reference/clutter.types index 6039e4ca6..1d23a0f43 100644 --- a/doc/reference/clutter.types +++ b/doc/reference/clutter.types @@ -11,7 +11,6 @@ clutter_timeline_get_type clutter_media_get_type clutter_behaviour_get_type clutter_alpha_get_type -clutter_smoothstep_get_type clutter_behaviour_bspline_get_type clutter_behaviour_ellipse_get_type clutter_behaviour_opacity_get_type diff --git a/doc/reference/tmpl/clutter-actor.sgml b/doc/reference/tmpl/clutter-actor.sgml index 7b6de46a3..bcdcc43be 100644 --- a/doc/reference/tmpl/clutter-actor.sgml +++ b/doc/reference/tmpl/clutter-actor.sgml @@ -208,7 +208,7 @@ Base class for #ClutterActor @get_depth: @parent_set: @destroy: -@queue_redraw: +@pick: @_clutter_actor_1: @_clutter_actor_2: @_clutter_actor_3: diff --git a/doc/reference/tmpl/clutter-alpha.sgml b/doc/reference/tmpl/clutter-alpha.sgml index d6c12800c..1c1bb1913 100644 --- a/doc/reference/tmpl/clutter-alpha.sgml +++ b/doc/reference/tmpl/clutter-alpha.sgml @@ -123,34 +123,6 @@ transforming the current position in the timeline. @Returns: - - -Represents minimum and maximum thresholds for the smoothstep function. The -thresholds are values from <0,1> relative to the frame-length of the behaviour, -i.e., if the behaviour consists of 60 frames, threshold of 0.25 corresponds to -frame 15, and threshold of 1.0 to frame 60. - - -@min: lower threshold; a #ClutterFixed value from <0,1> -@max: upper threshold; a #ClutterFixed value from <0,1> - - - - - - -@smoothstep: -@Returns: - - - - - - - -@smoothstep: - - Symbolic name for passing clutter_ramp_inc_func(). @@ -287,23 +259,6 @@ Symbolic name for passing clutter_sine_func(). @Returns: - - - - - - - - - - - - -@alpha: -@data: -@Returns: - - diff --git a/doc/reference/tmpl/clutter-media.sgml b/doc/reference/tmpl/clutter-media.sgml index 5330021ec..3d85887af 100644 --- a/doc/reference/tmpl/clutter-media.sgml +++ b/doc/reference/tmpl/clutter-media.sgml @@ -23,6 +23,21 @@ clutter-media + + + + + +@cluttermedia: the object which received the signal. + + + + + + +@cluttermedia: the object which received the signal. +@arg1: +