removed ClutterSmoothstep type; renamed clutter_smoothstep_func to clutter_smoothstep_inc_func; added clutter_smoothstep_dec_func

This commit is contained in:
Tomas Frydrych 2007-05-30 10:52:06 +00:00
parent 6e39efb9aa
commit 5b0e0dbcbe
8 changed files with 98 additions and 170 deletions

View File

@ -1,3 +1,13 @@
2007-05-30 Tomas Frydrych <tf@openedhand.com>
* 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 <tf@openedhand.com>
* clutter/clutter-fixed.h:

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,13 @@
2007-05-30 Tomas Frydrych <tf@openedhand.com>
* 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 <tf@openedhand.com>
* clutter-sections.txt:

View File

@ -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

View File

@ -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:

View File

@ -123,34 +123,6 @@ transforming the current position in the timeline.
@Returns:
<!-- ##### STRUCT ClutterSmoothstep ##### -->
<para>
Represents minimum and maximum thresholds for the smoothstep function. The
thresholds are values from &lt;0,1&gt; 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.
</para>
@min: lower threshold; a #ClutterFixed value from &lt;0,1&gt;
@max: upper threshold; a #ClutterFixed value from &lt;0,1&gt;
<!-- ##### FUNCTION clutter_smoothstep_copy ##### -->
<para>
</para>
@smoothstep:
@Returns:
<!-- ##### FUNCTION clutter_smoothstep_free ##### -->
<para>
</para>
@smoothstep:
<!-- ##### MACRO CLUTTER_ALPHA_RAMP_INC ##### -->
<para>
Symbolic name for passing clutter_ramp_inc_func().
@ -287,23 +259,6 @@ Symbolic name for passing clutter_sine_func().
@Returns:
<!-- ##### MACRO CLUTTER_ALPHA_SMOOTHSTEP ##### -->
<para>
</para>
<!-- ##### FUNCTION clutter_smoothstep_func ##### -->
<para>
</para>
@alpha:
@data:
@Returns:
<!-- ##### MACRO CLUTTER_ALPHA_EXP_INC ##### -->
<para>

View File

@ -23,6 +23,21 @@ clutter-media
</para>
<!-- ##### SIGNAL ClutterMedia::eos ##### -->
<para>
</para>
@cluttermedia: the object which received the signal.
<!-- ##### SIGNAL ClutterMedia::error ##### -->
<para>
</para>
@cluttermedia: the object which received the signal.
@arg1:
<!-- ##### ARG ClutterMedia:buffer-percent ##### -->
<para>