From 73cb96ddb98d692fc6226ad4d8d6f22bb7b63c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 9 Apr 2020 15:41:17 +0200 Subject: [PATCH] clutter: Remove 'ClutterAlpha' It was some kind of deprecated interpolation mechanism used in ClutterAnimation. We're not using it, and have non-deprecated replacement functionality, so lets drop it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1192 --- clutter/clutter/clutter-box-layout.c | 1 - clutter/clutter/clutter-deprecated.h | 1 - clutter/clutter/clutter-enums.h | 2 +- clutter/clutter/clutter-layout-manager.c | 1 - clutter/clutter/clutter-script-parser.c | 146 ---- clutter/clutter/clutter-script-private.h | 2 - clutter/clutter/clutter-script.c | 1 - clutter/clutter/clutter-types.h | 1 - clutter/clutter/deprecated/clutter-alpha.c | 819 ------------------ clutter/clutter/deprecated/clutter-alpha.h | 138 --- .../clutter/deprecated/clutter-animation.c | 237 +---- clutter/clutter/meson.build | 2 - src/tests/clutter/interactive/test-script.c | 8 +- 13 files changed, 20 insertions(+), 1339 deletions(-) delete mode 100644 clutter/clutter/deprecated/clutter-alpha.c delete mode 100644 clutter/clutter/deprecated/clutter-alpha.h diff --git a/clutter/clutter/clutter-box-layout.c b/clutter/clutter/clutter-box-layout.c index a3197f43f..c3dbe8e9e 100644 --- a/clutter/clutter/clutter-box-layout.c +++ b/clutter/clutter/clutter-box-layout.c @@ -54,7 +54,6 @@ #define CLUTTER_DISABLE_DEPRECATION_WARNINGS #include "deprecated/clutter-container.h" -#include "deprecated/clutter-alpha.h" #include "clutter-box-layout.h" diff --git a/clutter/clutter/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h index 1eb2d4ac8..4b6147324 100644 --- a/clutter/clutter/clutter-deprecated.h +++ b/clutter/clutter/clutter-deprecated.h @@ -4,7 +4,6 @@ #define __CLUTTER_DEPRECATED_H_INSIDE__ #include "deprecated/clutter-actor.h" -#include "deprecated/clutter-alpha.h" #include "deprecated/clutter-animation.h" #include "deprecated/clutter-box.h" #include "deprecated/clutter-container.h" diff --git a/clutter/clutter/clutter-enums.h b/clutter/clutter/clutter-enums.h index ed178762b..f7e8bc4c2 100644 --- a/clutter/clutter/clutter-enums.h +++ b/clutter/clutter/clutter-enums.h @@ -190,7 +190,7 @@ typedef enum /*< prefix=CLUTTER_REQUEST >*/ * @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for * registered global alpha functions * - * The animation modes used by #ClutterAlpha and #ClutterAnimation. This + * The animation modes used by #ClutterAnimation. This * enumeration can be expanded in later versions of Clutter. * *
diff --git a/clutter/clutter/clutter-layout-manager.c b/clutter/clutter/clutter-layout-manager.c index e1798cad4..6fb49b7a5 100644 --- a/clutter/clutter/clutter-layout-manager.c +++ b/clutter/clutter/clutter-layout-manager.c @@ -136,7 +136,6 @@ #define CLUTTER_DISABLE_DEPRECATION_WARNINGS #include "deprecated/clutter-container.h" -#include "deprecated/clutter-alpha.h" #include "clutter-debug.h" #include "clutter-layout-manager.h" diff --git a/clutter/clutter/clutter-script-parser.c b/clutter/clutter/clutter-script-parser.c index ea14b4166..c64289309 100644 --- a/clutter/clutter/clutter-script-parser.c +++ b/clutter/clutter/clutter-script-parser.c @@ -34,7 +34,6 @@ #define CLUTTER_DISABLE_DEPRECATION_WARNINGS #include "deprecated/clutter-container.h" -#include "deprecated/clutter-alpha.h" #include "clutter-actor.h" #include "clutter-debug.h" @@ -799,51 +798,6 @@ parse_signals (ClutterScript *script, return retval; } -static ClutterTimeline * -construct_timeline (ClutterScript *script, - JsonObject *object) -{ - ClutterTimeline *retval = NULL; - ObjectInfo *oinfo; - GList *members, *l; - - /* we fake an ObjectInfo so we can reuse clutter_script_construct_object() - * here; we do not save it inside the hash table, because if this had - * been a named object then we wouldn't have ended up here in the first - * place - */ - oinfo = g_slice_new0 (ObjectInfo); - oinfo->gtype = CLUTTER_TYPE_TIMELINE; - oinfo->id = g_strdup ("dummy"); - - members = json_object_get_members (object); - for (l = members; l != NULL; l = l->next) - { - const gchar *name = l->data; - JsonNode *node = json_object_get_member (object, name); - PropertyInfo *pinfo = g_slice_new0 (PropertyInfo); - - pinfo->name = g_strdelimit (g_strdup (name), G_STR_DELIMITERS, '-'); - pinfo->node = json_node_copy (node); - - oinfo->properties = g_list_prepend (oinfo->properties, pinfo); - } - - g_list_free (members); - - _clutter_script_construct_object (script, oinfo); - _clutter_script_apply_properties (script, oinfo); - retval = CLUTTER_TIMELINE (oinfo->object); - - /* we transfer ownership to the alpha function, so we ref before - * destroying the ObjectInfo to avoid the timeline going away - */ - g_object_ref (retval); - object_info_free (oinfo); - - return retval; -} - /* define the names of the animation modes to match the ones * that developers might be more accustomed to */ @@ -925,106 +879,6 @@ _clutter_script_resolve_animation_mode (JsonNode *node) return CLUTTER_CUSTOM_MODE; } -static ClutterAlphaFunc -resolve_alpha_func (const gchar *name) -{ - static GModule *module = NULL; - ClutterAlphaFunc func; - - CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name); - - if (G_UNLIKELY (!module)) - module = g_module_open (NULL, 0); - - if (g_module_symbol (module, name, (gpointer) &func)) - { - CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table", - name); - return func; - } - - return NULL; -} - -GObject * -_clutter_script_parse_alpha (ClutterScript *script, - JsonNode *node) -{ - GObject *retval = NULL; - JsonObject *object; - ClutterTimeline *timeline = NULL; - ClutterAlphaFunc alpha_func = NULL; - ClutterAnimationMode mode = CLUTTER_CUSTOM_MODE; - JsonNode *val; - gboolean unref_timeline = FALSE; - - if (JSON_NODE_TYPE (node) != JSON_NODE_OBJECT) - return NULL; - - object = json_node_get_object (node); - - val = json_object_get_member (object, "timeline"); - if (val) - { - if (JSON_NODE_TYPE (val) == JSON_NODE_VALUE && - json_node_get_string (val) != NULL) - { - const gchar *id_ = json_node_get_string (val); - - timeline = - CLUTTER_TIMELINE (clutter_script_get_object (script, id_)); - } - else if (JSON_NODE_TYPE (val) == JSON_NODE_OBJECT) - { - timeline = construct_timeline (script, json_node_get_object (val)); - unref_timeline = TRUE; - } - } - - val = json_object_get_member (object, "mode"); - if (val != NULL) - mode = _clutter_script_resolve_animation_mode (val); - - if (mode == CLUTTER_CUSTOM_MODE) - { - val = json_object_get_member (object, "function"); - if (val && json_node_get_string (val) != NULL) - { - alpha_func = resolve_alpha_func (json_node_get_string (val)); - if (!alpha_func) - { - g_warning ("Unable to find the function '%s' in the " - "Clutter alpha functions or the symbols table", - json_node_get_string (val)); - } - } - } - - CLUTTER_NOTE (SCRIPT, "Parsed alpha: %s timeline (%p) (mode:%d, func:%p)", - unref_timeline ? "implicit" : "explicit", - timeline ? timeline : 0x0, - mode != CLUTTER_CUSTOM_MODE ? mode : 0, - alpha_func ? alpha_func : 0x0); - - retval = g_object_new (CLUTTER_TYPE_ALPHA, NULL); - - if (mode != CLUTTER_CUSTOM_MODE) - clutter_alpha_set_mode (CLUTTER_ALPHA (retval), mode); - - if (alpha_func != NULL) - clutter_alpha_set_func (CLUTTER_ALPHA (retval), alpha_func, NULL, NULL); - - clutter_alpha_set_timeline (CLUTTER_ALPHA (retval), timeline); - - /* if we created an implicit timeline, the Alpha has full ownership - * of it now, since it won't be accessible from ClutterScript - */ - if (unref_timeline) - g_object_unref (timeline); - - return retval; -} - static void clutter_script_parser_object_end (JsonParser *json_parser, JsonObject *object) diff --git a/clutter/clutter/clutter-script-private.h b/clutter/clutter/clutter-script-private.h index 9c08d82d6..b17c04581 100644 --- a/clutter/clutter/clutter-script-private.h +++ b/clutter/clutter/clutter-script-private.h @@ -128,8 +128,6 @@ gboolean _clutter_script_parse_rect (ClutterScript *script, gboolean _clutter_script_parse_color (ClutterScript *script, JsonNode *node, ClutterColor *color); -GObject *_clutter_script_parse_alpha (ClutterScript *script, - JsonNode *node); gboolean _clutter_script_parse_point (ClutterScript *script, JsonNode *node, graphene_point_t *point); diff --git a/clutter/clutter/clutter-script.c b/clutter/clutter/clutter-script.c index 9c79f26c1..89dc166c9 100644 --- a/clutter/clutter/clutter-script.c +++ b/clutter/clutter/clutter-script.c @@ -141,7 +141,6 @@ #include "clutter-private.h" #include "clutter-debug.h" -#include "deprecated/clutter-alpha.h" #include "deprecated/clutter-container.h" enum diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h index cf6a3ced2..35cf5580b 100644 --- a/clutter/clutter/clutter-types.h +++ b/clutter/clutter/clutter-types.h @@ -79,7 +79,6 @@ typedef struct _ClutterKnot ClutterKnot; typedef struct _ClutterMargin ClutterMargin; typedef struct _ClutterPerspective ClutterPerspective; -typedef struct _ClutterAlpha ClutterAlpha; typedef struct _ClutterAnimation ClutterAnimation; typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool; diff --git a/clutter/clutter/deprecated/clutter-alpha.c b/clutter/clutter/deprecated/clutter-alpha.c deleted file mode 100644 index 9560c2ead..000000000 --- a/clutter/clutter/deprecated/clutter-alpha.c +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * Jorn Baayen - * Emmanuele Bassi - * Tomas Frydrych - * - * Copyright (C) 2006, 2007, 2008 OpenedHand - * Copyright (C) 2009, 2010 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -/** - * SECTION:clutter-alpha - * @short_description: A class for calculating a value as a function of time - * - * #ClutterAlpha is a class for calculating an floating point value - * dependent only on the position of a #ClutterTimeline. - * - * For newly written code, it is recommended to use the - * #ClutterTimeline:progress-mode property of #ClutterTimeline, or the - * clutter_timeline_set_progress_func() function instead of #ClutterAlpha. - * The #ClutterAlpha class will be deprecated in the future, and will not - * be available any more in the next major version of Clutter. - * - * A #ClutterAlpha binds a #ClutterTimeline to a progress function which - * translates the time T into an adimensional factor alpha. - * - * You should provide a #ClutterTimeline and bind it to the #ClutterAlpha - * instance using clutter_alpha_set_timeline(). You should also set an - * "animation mode", by using the #ClutterAnimationMode values that - * Clutter provides. - * - * Instead of a #ClutterAnimationMode you may provide a function returning - * the alpha value depending on the progress of the timeline, using - * clutter_alpha_set_func() or clutter_alpha_set_closure(). The alpha - * function will be executed each time a new frame in the #ClutterTimeline - * is reached. - * - * Since the alpha function is controlled by the timeline instance, you can - * pause, stop or resume the #ClutterAlpha from calling the alpha function by - * using the appropriate functions of the #ClutterTimeline object. - * - * #ClutterAlpha is available since Clutter 0.2. - * - * #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and - * the #ClutterTimeline:progress-mode property replace this whole class. - * - * ## ClutterAlpha custom properties for #ClutterScript - * - * #ClutterAlpha defines a custom `function` property for - * #ClutterScript which allows to reference a custom alpha function - * available in the source code. Setting the `function` property - * is equivalent to calling clutter_alpha_set_func() with the - * specified function name. No user data or #GDestroyNotify is - * available to be passed. - * - * The following JSON fragment defines a #ClutterAlpha - * using a #ClutterTimeline with id "sine-timeline" and an alpha - * function called `my_sine_alpha`. - * - * |[ - * { - * "id" : "sine-alpha", - * "timeline" : { - * "id" : "sine-timeline", - * "duration" : 500, - * "loop" : true - * }, - * "function" : "my_sine_alpha" - * } - * ]| - */ - -#include "clutter-build-config.h" - -#include - -#include - -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS - -#include "clutter-alpha.h" -#include "clutter-debug.h" -#include "clutter-enum-types.h" -#include "clutter-easing.h" -#include "clutter-main.h" -#include "clutter-marshal.h" -#include "clutter-private.h" -#include "clutter-scriptable.h" -#include "clutter-script-private.h" - -struct _ClutterAlphaPrivate -{ - ClutterTimeline *timeline; - guint timeline_new_frame_id; - - gdouble alpha; - - GClosure *closure; - - ClutterAlphaFunc func; - gpointer user_data; - GDestroyNotify notify; - - gulong mode; -}; - -enum -{ - PROP_0, - - PROP_TIMELINE, - PROP_ALPHA, - PROP_MODE, - - PROP_LAST -}; - -static GParamSpec *obj_props[PROP_LAST]; - -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterAlpha, - clutter_alpha, - G_TYPE_INITIALLY_UNOWNED, - G_ADD_PRIVATE (ClutterAlpha) - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - -static void -timeline_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - ClutterAlpha *alpha) -{ - ClutterAlphaPrivate *priv = alpha->priv; - - /* Update alpha value and notify */ - priv->alpha = clutter_alpha_get_alpha (alpha); - g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_ALPHA]); -} - -static void -clutter_alpha_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - ClutterAlpha *alpha = CLUTTER_ALPHA (object); - - switch (prop_id) - { - case PROP_TIMELINE: - clutter_alpha_set_timeline (alpha, g_value_get_object (value)); - break; - - case PROP_MODE: - clutter_alpha_set_mode (alpha, g_value_get_ulong (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -clutter_alpha_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv; - - switch (prop_id) - { - case PROP_TIMELINE: - g_value_set_object (value, priv->timeline); - break; - - case PROP_ALPHA: - g_value_set_double (value, priv->alpha); - break; - - case PROP_MODE: - g_value_set_ulong (value, priv->mode); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -clutter_alpha_finalize (GObject *object) -{ - ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv; - - if (priv->notify != NULL) - priv->notify (priv->user_data); - else if (priv->closure != NULL) - g_closure_unref (priv->closure); - - G_OBJECT_CLASS (clutter_alpha_parent_class)->finalize (object); -} - -static void -clutter_alpha_dispose (GObject *object) -{ - ClutterAlpha *self = CLUTTER_ALPHA(object); - - clutter_alpha_set_timeline (self, NULL); - - G_OBJECT_CLASS (clutter_alpha_parent_class)->dispose (object); -} - -static ClutterAlphaFunc -resolve_alpha_func (const gchar *name) -{ - static GModule *module = NULL; - ClutterAlphaFunc func; - - CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name); - - if (G_UNLIKELY (module == NULL)) - module = g_module_open (NULL, 0); - - if (g_module_symbol (module, name, (gpointer) &func)) - { - CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table", - name); - return func; - } - - return NULL; -} - -static void -clutter_alpha_set_custom_property (ClutterScriptable *scriptable, - ClutterScript *script, - const gchar *name, - const GValue *value) -{ - if (strncmp (name, "function", 8) == 0) - { - g_assert (G_VALUE_HOLDS (value, G_TYPE_POINTER)); - if (g_value_get_pointer (value) != NULL) - { - clutter_alpha_set_func (CLUTTER_ALPHA (scriptable), - g_value_get_pointer (value), - NULL, NULL); - } - } - else - g_object_set_property (G_OBJECT (scriptable), name, value); -} - -static gboolean -clutter_alpha_parse_custom_node (ClutterScriptable *scriptable, - ClutterScript *script, - GValue *value, - const gchar *name, - JsonNode *node) -{ - if (strncmp (name, "function", 8) == 0) - { - const gchar *func_name = json_node_get_string (node); - - g_value_init (value, G_TYPE_POINTER); - g_value_set_pointer (value, resolve_alpha_func (func_name)); - - return TRUE; - } - - /* we need to do this because we use gulong in place - * of ClutterAnimationMode for ClutterAlpha:mode - */ - if (strncmp (name, "mode", 4) == 0) - { - gulong mode; - - mode = _clutter_script_resolve_animation_mode (node); - - g_value_init (value, G_TYPE_ULONG); - g_value_set_ulong (value, mode); - - return TRUE; - } - - return FALSE; -} - -static void -clutter_scriptable_iface_init (ClutterScriptableIface *iface) -{ - iface->parse_custom_node = clutter_alpha_parse_custom_node; - iface->set_custom_property = clutter_alpha_set_custom_property; -} - -static void -clutter_alpha_class_init (ClutterAlphaClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->set_property = clutter_alpha_set_property; - object_class->get_property = clutter_alpha_get_property; - object_class->finalize = clutter_alpha_finalize; - object_class->dispose = clutter_alpha_dispose; - - /** - * ClutterAlpha:timeline: - * - * A #ClutterTimeline instance used to drive the alpha function. - * - * Since: 0.2 - * - * Deprecated: 1.12 - */ - obj_props[PROP_TIMELINE] = - g_param_spec_object ("timeline", - P_("Timeline"), - P_("Timeline used by the alpha"), - CLUTTER_TYPE_TIMELINE, - CLUTTER_PARAM_READWRITE); - - /** - * ClutterAlpha:alpha: - * - * The alpha value as computed by the alpha function. The linear - * interval is 0.0 to 1.0, but the Alpha allows overshooting by - * one unit in each direction, so the valid interval is -1.0 to 2.0. - * - * Since: 0.2 - * Deprecated: 1.12: Use #ClutterTimeline::new-frame and - * clutter_timeline_get_progress() instead - */ - obj_props[PROP_ALPHA] = - g_param_spec_double ("alpha", - P_("Alpha value"), - P_("Alpha value as computed by the alpha"), - -1.0, 2.0, - 0.0, - CLUTTER_PARAM_READABLE); - - /** - * ClutterAlpha:mode: - * - * The progress function logical id - a value from the - * #ClutterAnimationMode enumeration. - * - * If %CLUTTER_CUSTOM_MODE is used then the function set using - * clutter_alpha_set_closure() or clutter_alpha_set_func() - * will be used. - * - * Since: 1.0 - * Deprecated: 1.12: Use #ClutterTimeline:progress-mode - */ - obj_props[PROP_MODE] = - g_param_spec_ulong ("mode", - P_("Mode"), - P_("Progress mode"), - 0, G_MAXULONG, - CLUTTER_CUSTOM_MODE, - G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE); - - g_object_class_install_properties (object_class, - PROP_LAST, - obj_props); -} - -static void -clutter_alpha_init (ClutterAlpha *self) -{ - self->priv = clutter_alpha_get_instance_private (self); - self->priv->mode = CLUTTER_CUSTOM_MODE; - self->priv->alpha = 0.0; -} - -/** - * clutter_alpha_get_alpha: - * @alpha: A #ClutterAlpha - * - * Query the current alpha value. - * - * Return Value: The current alpha value for the alpha - * - * Since: 0.2 - * - * Deprecated: 1.12: Use clutter_timeline_get_progress() - */ -gdouble -clutter_alpha_get_alpha (ClutterAlpha *alpha) -{ - ClutterAlphaPrivate *priv; - gdouble retval = 0; - - g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), 0); - - priv = alpha->priv; - - if (G_LIKELY (priv->func)) - { - return priv->func (alpha, priv->user_data); - } - else if (priv->closure) - { - GValue params = G_VALUE_INIT; - GValue result_value = G_VALUE_INIT; - - g_object_ref (alpha); - - g_value_init (&result_value, G_TYPE_DOUBLE); - - g_value_init (¶ms, CLUTTER_TYPE_ALPHA); - g_value_set_object (¶ms, alpha); - - g_closure_invoke (priv->closure, &result_value, 1, ¶ms, NULL); - - retval = g_value_get_double (&result_value); - - g_value_unset (&result_value); - g_value_unset (¶ms); - - g_object_unref (alpha); - } - - return retval; -} - -/* - * clutter_alpha_set_closure_internal: - * @alpha: a #ClutterAlpha - * @closure: a #GClosure - * - * Sets the @closure for @alpha. This function does not - * set the #ClutterAlpha:mode property and does not emit - * the #GObject::notify signal for it. - */ -static inline void -clutter_alpha_set_closure_internal (ClutterAlpha *alpha, - GClosure *closure) -{ - ClutterAlphaPrivate *priv = alpha->priv; - - if (priv->notify != NULL) - priv->notify (priv->user_data); - else if (priv->closure != NULL) - g_closure_unref (priv->closure); - - priv->func = NULL; - priv->user_data = NULL; - priv->notify = NULL; - - if (closure == NULL) - return; - - /* need to take ownership of the closure before sinking it */ - priv->closure = g_closure_ref (closure); - g_closure_sink (closure); - - /* set the marshaller */ - if (G_CLOSURE_NEEDS_MARSHAL (closure)) - { - GClosureMarshal marshal = _clutter_marshal_DOUBLE__VOID; - - g_closure_set_marshal (priv->closure, marshal); - } -} - -/** - * clutter_alpha_set_closure: - * @alpha: A #ClutterAlpha - * @closure: A #GClosure - * - * Sets the #GClosure used to compute the alpha value at each - * frame of the #ClutterTimeline bound to @alpha. - * - * Since: 0.8 - * - * Deprecated: 1.12: Use clutter_timeline_set_progress_func() - */ -void -clutter_alpha_set_closure (ClutterAlpha *alpha, - GClosure *closure) -{ - ClutterAlphaPrivate *priv; - - g_return_if_fail (CLUTTER_IS_ALPHA (alpha)); - g_return_if_fail (closure != NULL); - - priv = alpha->priv; - - clutter_alpha_set_closure_internal (alpha, closure); - - priv->mode = CLUTTER_CUSTOM_MODE; - g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); -} - -/** - * clutter_alpha_set_func: - * @alpha: A #ClutterAlpha - * @func: A #ClutterAlphaFunc - * @data: user data to be passed to the alpha function, or %NULL - * @destroy: notify function used when disposing the alpha function - * - * Sets the #ClutterAlphaFunc function used to compute - * the alpha value at each frame of the #ClutterTimeline - * bound to @alpha. - * - * This function will not register @func as a global alpha function. - * - * Since: 0.2 - * - * Deprecated: 1.12: Use clutter_timeline_set_progress_func() - */ -void -clutter_alpha_set_func (ClutterAlpha *alpha, - ClutterAlphaFunc func, - gpointer data, - GDestroyNotify destroy) -{ - ClutterAlphaPrivate *priv; - - g_return_if_fail (CLUTTER_IS_ALPHA (alpha)); - g_return_if_fail (func != NULL); - - priv = alpha->priv; - - if (priv->notify != NULL) - { - priv->notify (priv->user_data); - } - else if (priv->closure != NULL) - { - g_closure_unref (priv->closure); - priv->closure = NULL; - } - - priv->func = func; - priv->user_data = data; - priv->notify = destroy; - - priv->mode = CLUTTER_CUSTOM_MODE; - - g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); -} - -/** - * clutter_alpha_set_timeline: - * @alpha: A #ClutterAlpha - * @timeline: A #ClutterTimeline - * - * Binds @alpha to @timeline. - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimeline directly - */ -void -clutter_alpha_set_timeline (ClutterAlpha *alpha, - ClutterTimeline *timeline) -{ - ClutterAlphaPrivate *priv; - - g_return_if_fail (CLUTTER_IS_ALPHA (alpha)); - g_return_if_fail (timeline == NULL || CLUTTER_IS_TIMELINE (timeline)); - - priv = alpha->priv; - - if (priv->timeline == timeline) - return; - - if (priv->timeline) - { - g_signal_handlers_disconnect_by_func (priv->timeline, - timeline_new_frame_cb, - alpha); - - g_object_unref (priv->timeline); - priv->timeline = NULL; - } - - if (timeline) - { - priv->timeline = g_object_ref (timeline); - - g_signal_connect (priv->timeline, "new-frame", - G_CALLBACK (timeline_new_frame_cb), - alpha); - } - - g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_TIMELINE]); -} - -/** - * clutter_alpha_get_timeline: - * @alpha: A #ClutterAlpha - * - * Gets the #ClutterTimeline bound to @alpha. - * - * Return value: (transfer none): a #ClutterTimeline instance - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimeline directlry - */ -ClutterTimeline * -clutter_alpha_get_timeline (ClutterAlpha *alpha) -{ - g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL); - - return alpha->priv->timeline; -} - -/** - * clutter_alpha_new: - * - * Creates a new #ClutterAlpha instance. You must set a function - * to compute the alpha value using clutter_alpha_set_func() and - * bind a #ClutterTimeline object to the #ClutterAlpha instance - * using clutter_alpha_set_timeline(). - * - * Return value: the newly created empty #ClutterAlpha instance. - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimeline instead - */ -ClutterAlpha * -clutter_alpha_new (void) -{ - return g_object_new (CLUTTER_TYPE_ALPHA, NULL); -} - -/** - * clutter_alpha_new_full: - * @timeline: #ClutterTimeline timeline - * @mode: animation mode - * - * Creates a new #ClutterAlpha instance and sets the timeline - * and animation mode. - * - * See also clutter_alpha_set_timeline() and clutter_alpha_set_mode(). - * - * Return Value: the newly created #ClutterAlpha - * - * Since: 1.0 - * - * Deprecated: 1.12: Use #ClutterTimeline instead - */ -ClutterAlpha * -clutter_alpha_new_full (ClutterTimeline *timeline, - gulong mode) -{ - g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL); - g_return_val_if_fail (mode != CLUTTER_ANIMATION_LAST, NULL); - - return g_object_new (CLUTTER_TYPE_ALPHA, - "timeline", timeline, - "mode", mode, - NULL); -} - -/** - * clutter_alpha_get_mode: - * @alpha: a #ClutterAlpha - * - * Retrieves the #ClutterAnimationMode used by @alpha. - * - * Return value: the animation mode - * - * Since: 1.0 - * - * Deprecated: 1.12: Use #ClutterTimeline instead - */ -gulong -clutter_alpha_get_mode (ClutterAlpha *alpha) -{ - g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), CLUTTER_CUSTOM_MODE); - - return alpha->priv->mode; -} - -typedef struct _AlphaData { - guint closure_set : 1; - - ClutterAlphaFunc func; - gpointer data; - - GClosure *closure; -} AlphaData; - -static GPtrArray *clutter_alphas = NULL; - -static gdouble -clutter_alpha_easing_func (ClutterAlpha *alpha, - gpointer data G_GNUC_UNUSED) -{ - ClutterAlphaPrivate *priv = alpha->priv; - ClutterTimeline *timeline = priv->timeline; - gdouble t, d; - - if (G_UNLIKELY (priv->timeline == NULL)) - return 0.0; - - t = clutter_timeline_get_elapsed_time (timeline); - d = clutter_timeline_get_duration (timeline); - - return clutter_easing_for_mode (priv->mode, t, d); -} - -/** - * clutter_alpha_set_mode: - * @alpha: a #ClutterAlpha - * @mode: a #ClutterAnimationMode - * - * Sets the progress function of @alpha using the symbolic value - * of @mode, as taken by the #ClutterAnimationMode enumeration. - * - * Since: 1.0 - * - * Deprecated: 1.12: Use #ClutterTimeline and - * clutter_timeline_set_progress_mode() instead - */ -void -clutter_alpha_set_mode (ClutterAlpha *alpha, - gulong mode) -{ - ClutterAlphaPrivate *priv; - - g_return_if_fail (CLUTTER_IS_ALPHA (alpha)); - g_return_if_fail (mode != CLUTTER_ANIMATION_LAST); - - priv = alpha->priv; - - if (mode == CLUTTER_CUSTOM_MODE) - { - priv->mode = mode; - } - else if (mode < CLUTTER_ANIMATION_LAST) - { - if (priv->mode == mode) - return; - - /* sanity check to avoid getting an out of sync - * enum/function mapping - */ - g_assert (clutter_get_easing_func_for_mode (mode) != NULL); - - clutter_alpha_set_closure_internal (alpha, NULL); - - priv->mode = mode; - - CLUTTER_NOTE (ANIMATION, "New easing mode '%s'[%lu]\n", - clutter_get_easing_name_for_mode (priv->mode), - priv->mode); - - priv->func = clutter_alpha_easing_func; - priv->user_data = NULL; - priv->notify = NULL; - } - else if (mode > CLUTTER_ANIMATION_LAST) - { - AlphaData *alpha_data = NULL; - gulong real_index = 0; - - if (priv->mode == mode) - return; - - if (G_UNLIKELY (clutter_alphas == NULL)) - { - g_warning ("No alpha functions defined for ClutterAlpha to use. "); - return; - } - - real_index = mode - CLUTTER_ANIMATION_LAST - 1; - - alpha_data = g_ptr_array_index (clutter_alphas, real_index); - if (G_UNLIKELY (alpha_data == NULL)) - { - g_warning ("No alpha function registered for mode %lu.", - mode); - return; - } - - if (alpha_data->closure_set) - clutter_alpha_set_closure (alpha, alpha_data->closure); - else - { - clutter_alpha_set_closure_internal (alpha, NULL); - - priv->func = alpha_data->func; - priv->user_data = alpha_data->data; - priv->notify = NULL; - } - - priv->mode = mode; - } - else - g_assert_not_reached (); - - g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); -} diff --git a/clutter/clutter/deprecated/clutter-alpha.h b/clutter/clutter/deprecated/clutter-alpha.h deleted file mode 100644 index fc030a567..000000000 --- a/clutter/clutter/deprecated/clutter-alpha.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * Jorn Baayen - * Emmanuele Bassi - * Tomas Frydrych - * - * Copyright (C) 2006, 2007, 2008 OpenedHand - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __CLUTTER_ALPHA_H__ -#define __CLUTTER_ALPHA_H__ - -#include -#include - -G_BEGIN_DECLS - -#define CLUTTER_TYPE_ALPHA (clutter_alpha_get_type ()) -#define CLUTTER_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALPHA, ClutterAlpha)) -#define CLUTTER_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALPHA, ClutterAlphaClass)) -#define CLUTTER_IS_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALPHA)) -#define CLUTTER_IS_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALPHA)) -#define CLUTTER_ALPHA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALPHA, ClutterAlphaClass)) - -typedef struct _ClutterAlphaClass ClutterAlphaClass; -typedef struct _ClutterAlphaPrivate ClutterAlphaPrivate; - -/** - * ClutterAlphaFunc: - * @alpha: a #ClutterAlpha - * @user_data: user data passed to the function - * - * A function returning a value depending on the position of - * the #ClutterTimeline bound to @alpha. - * - * Return value: a floating point value - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimelineProgressFunc instead. - */ -typedef gdouble (*ClutterAlphaFunc) (ClutterAlpha *alpha, - gpointer user_data); - -/** - * ClutterAlpha: - * - * #ClutterAlpha combines a #ClutterTimeline and a function. - * The contents of the #ClutterAlpha structure are private and should - * only be accessed using the provided API. - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimeline instead - */ -struct _ClutterAlpha -{ - /*< private >*/ - GInitiallyUnowned parent; - - ClutterAlphaPrivate *priv; -}; - -/** - * ClutterAlphaClass: - * - * Base class for #ClutterAlpha - * - * Since: 0.2 - * - * Deprecated: 1.12: Use #ClutterTimeline instead - */ -struct _ClutterAlphaClass -{ - /*< private >*/ - GInitiallyUnownedClass parent_class; - - void (*_clutter_alpha_1) (void); - void (*_clutter_alpha_2) (void); - void (*_clutter_alpha_3) (void); - void (*_clutter_alpha_4) (void); - void (*_clutter_alpha_5) (void); -}; - -CLUTTER_DEPRECATED -GType clutter_alpha_get_type (void) G_GNUC_CONST; - -CLUTTER_DEPRECATED -ClutterAlpha * clutter_alpha_new (void); -CLUTTER_DEPRECATED -ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline, - gulong mode); -CLUTTER_DEPRECATED -gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha); -CLUTTER_DEPRECATED -void clutter_alpha_set_func (ClutterAlpha *alpha, - ClutterAlphaFunc func, - gpointer data, - GDestroyNotify destroy); -CLUTTER_DEPRECATED -void clutter_alpha_set_closure (ClutterAlpha *alpha, - GClosure *closure); -CLUTTER_DEPRECATED -void clutter_alpha_set_timeline (ClutterAlpha *alpha, - ClutterTimeline *timeline); -CLUTTER_DEPRECATED -ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha); -CLUTTER_DEPRECATED -void clutter_alpha_set_mode (ClutterAlpha *alpha, - gulong mode); -CLUTTER_DEPRECATED -gulong clutter_alpha_get_mode (ClutterAlpha *alpha); - -G_END_DECLS - -#endif /* __CLUTTER_ALPHA_H__ */ diff --git a/clutter/clutter/deprecated/clutter-animation.c b/clutter/clutter/deprecated/clutter-animation.c index 0b5ac5112..8bf9e73b3 100644 --- a/clutter/clutter/deprecated/clutter-animation.c +++ b/clutter/clutter/deprecated/clutter-animation.c @@ -25,16 +25,14 @@ /** * SECTION:clutter-animation * @short_description: Simple implicit animations - * @See_Also: #ClutterAnimatable, #ClutterInterval, #ClutterAlpha, - * #ClutterTimeline + * @See_Also: #ClutterAnimatable, #ClutterInterval, #ClutterTimeline * * #ClutterAnimation is an object providing simple, implicit animations * for #GObjects. * * #ClutterAnimation instances will bind one or more #GObject properties - * belonging to a #GObject to a #ClutterInterval, and will then use a - * #ClutterAlpha to interpolate the property between the initial and final - * values of the interval. + * belonging to a #GObject to a #ClutterInterval, and will then interpolate the + * property between the initial and final values of the interval. * * The duration of the animation is set using clutter_animation_set_duration(). * The easing mode of the animation is set using clutter_animation_set_mode(). @@ -94,7 +92,6 @@ #define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include "clutter-alpha.h" #include "clutter-animatable.h" #include "clutter-animation.h" #include "clutter-debug.h" @@ -116,7 +113,6 @@ enum PROP_DURATION, PROP_LOOP, PROP_TIMELINE, - PROP_ALPHA, PROP_LAST }; @@ -137,7 +133,6 @@ struct _ClutterAnimationPrivate GHashTable *properties; - ClutterAlpha *alpha; ClutterTimeline *timeline; guint timeline_started_id; @@ -151,9 +146,6 @@ static GQuark quark_object_animation = 0; static void clutter_scriptable_init (ClutterScriptableIface *iface); -static void clutter_animation_set_alpha_internal (ClutterAnimation *animation, - ClutterAlpha *alpha); -static ClutterAlpha * clutter_animation_get_alpha_internal (ClutterAnimation *animation); static ClutterTimeline * clutter_animation_get_timeline_internal (ClutterAnimation *animation); G_DEFINE_TYPE_WITH_CODE (ClutterAnimation, clutter_animation, G_TYPE_OBJECT, @@ -161,26 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterAnimation, clutter_animation, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, clutter_scriptable_init)); -static ClutterAlpha * -clutter_animation_get_alpha_internal (ClutterAnimation *animation) -{ - ClutterAnimationPrivate *priv = animation->priv; - - if (priv->alpha == NULL) - { - ClutterAlpha *alpha; - - alpha = clutter_alpha_new (); - clutter_alpha_set_mode (alpha, CLUTTER_LINEAR); - - priv->alpha = g_object_ref_sink (alpha); - - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_ALPHA]); - } - - return priv->alpha; -} - static void on_actor_destroy (ClutterActor *actor, ClutterAnimation *animation) @@ -279,10 +251,7 @@ clutter_animation_dispose (GObject *gobject) ClutterAnimationPrivate *priv = CLUTTER_ANIMATION (gobject)->priv; ClutterTimeline *timeline; - if (priv->alpha != NULL) - timeline = clutter_alpha_get_timeline (priv->alpha); - else - timeline = priv->timeline; + timeline = priv->timeline; if (timeline != NULL && priv->timeline_started_id != 0) g_signal_handler_disconnect (timeline, priv->timeline_started_id); @@ -303,12 +272,6 @@ clutter_animation_dispose (GObject *gobject) priv->timeline = NULL; } - if (priv->alpha != NULL) - { - g_object_unref (priv->alpha); - priv->alpha = NULL; - } - if (priv->object != NULL) { g_object_unref (priv->object); @@ -348,10 +311,6 @@ clutter_animation_set_property (GObject *gobject, clutter_animation_set_timeline (animation, g_value_get_object (value)); break; - case PROP_ALPHA: - clutter_animation_set_alpha_internal (animation, g_value_get_object (value)); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -389,10 +348,6 @@ clutter_animation_get_property (GObject *gobject, g_value_set_object (value, clutter_animation_get_timeline (animation)); break; - case PROP_ALPHA: - g_value_set_object (value, clutter_animation_get_alpha_internal (animation)); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -460,9 +415,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) /** * ClutterAnimation:mode: * - * The animation mode, either a value from #ClutterAnimationMode - * or a value returned by clutter_alpha_register_func(). The - * default value is %CLUTTER_LINEAR. + * A #ClutterAnimationMode. default value is %CLUTTER_LINEAR. * * Since: 1.0 * Deprecated: 1.12: Use #ClutterPropertyTransition instead @@ -521,23 +474,6 @@ clutter_animation_class_init (ClutterAnimationClass *klass) CLUTTER_TYPE_TIMELINE, CLUTTER_PARAM_READWRITE); - /** - * ClutterAnimation:alpha: - * - * The #ClutterAlpha used by the animation. - * - * Since: 1.0 - * - * Deprecated: 1.10: Use the #ClutterAnimation:timeline property and - * the #ClutterTimeline:progress-mode property instead. - */ - obj_props[PROP_ALPHA] = - g_param_spec_object ("alpha", - P_("Alpha"), - P_("The alpha used by the animation"), - CLUTTER_TYPE_ALPHA, - CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED); - g_object_class_install_properties (gobject_class, PROP_LAST, obj_props); @@ -724,10 +660,7 @@ on_timeline_frame (ClutterTimeline *timeline, priv = animation->priv; - if (priv->alpha != NULL) - alpha_value = clutter_alpha_get_alpha (priv->alpha); - else - alpha_value = clutter_timeline_get_progress (priv->timeline); + alpha_value = clutter_timeline_get_progress (priv->timeline); if (CLUTTER_IS_ANIMATABLE (priv->object)) { @@ -791,13 +724,6 @@ clutter_animation_get_timeline_internal (ClutterAnimation *animation) if (priv->timeline != NULL) return priv->timeline; - if (priv->alpha != NULL) - { - timeline = clutter_alpha_get_timeline (priv->alpha); - if (timeline != NULL) - return timeline; - } - timeline = g_object_new (CLUTTER_TYPE_TIMELINE, NULL); priv->timeline_started_id = @@ -815,14 +741,6 @@ clutter_animation_get_timeline_internal (ClutterAnimation *animation) G_CALLBACK (on_timeline_frame), animation); - if (priv->alpha != NULL) - { - clutter_alpha_set_timeline (priv->alpha, timeline); - - /* the alpha owns the timeline now */ - g_object_unref (timeline); - } - priv->timeline = timeline; g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); @@ -830,93 +748,6 @@ clutter_animation_get_timeline_internal (ClutterAnimation *animation) return priv->timeline; } -static void -clutter_animation_set_alpha_internal (ClutterAnimation *animation, - ClutterAlpha *alpha) -{ - ClutterAnimationPrivate *priv; - ClutterTimeline *timeline; - - priv = animation->priv; - - if (priv->alpha == alpha) - return; - - g_object_freeze_notify (G_OBJECT (animation)); - - if (priv->alpha != NULL) - timeline = clutter_alpha_get_timeline (priv->alpha); - else - timeline = NULL; - - /* disconnect the old timeline first */ - if (timeline != NULL && priv->timeline_started_id != 0) - { - g_signal_handler_disconnect (timeline, priv->timeline_started_id); - priv->timeline_started_id = 0; - } - - if (timeline != NULL && priv->timeline_completed_id != 0) - { - g_signal_handler_disconnect (timeline, priv->timeline_completed_id); - priv->timeline_completed_id = 0; - } - - /* then we need to disconnect the signal handler from the old alpha */ - if (timeline != NULL && priv->timeline_frame_id != 0) - { - g_signal_handler_disconnect (timeline, priv->timeline_frame_id); - priv->timeline_frame_id = 0; - } - - if (priv->alpha != NULL) - { - /* this will take care of any reference we hold on the timeline */ - g_object_unref (priv->alpha); - priv->alpha = NULL; - } - - if (alpha == NULL) - goto out; - - priv->alpha = g_object_ref_sink (alpha); - - /* if the alpha has a timeline then we use it, otherwise we create one */ - timeline = clutter_alpha_get_timeline (priv->alpha); - if (timeline != NULL) - { - priv->timeline_started_id = - g_signal_connect (timeline, "started", - G_CALLBACK (on_timeline_started), - animation); - priv->timeline_completed_id = - g_signal_connect (timeline, "completed", - G_CALLBACK (on_timeline_completed), - animation); - priv->timeline_frame_id = - g_signal_connect (timeline, "new-frame", - G_CALLBACK (on_timeline_frame), - animation); - } - else - { - /* FIXME - add a create_timeline_internal() because this does - * not look very good - */ - (void) clutter_animation_get_timeline_internal (animation); - } - -out: - /* emit all relevant notifications */ - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_MODE]); - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_DURATION]); - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_LOOP]); - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_ALPHA]); - g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); - - g_object_thaw_notify (G_OBJECT (animation)); -} - /** * clutter_animation_new: * @@ -984,10 +815,7 @@ clutter_animation_set_object (ClutterAnimation *animation, * @mode: an animation mode logical id * * Sets the animation @mode of @animation. The animation @mode is - * a logical id, either coming from the #ClutterAnimationMode enumeration - * or the return value of clutter_alpha_register_func(). - * - * This function will also set #ClutterAnimation:alpha if needed. + * a logical id, coming from the #ClutterAnimationMode enumeration. * * Since: 1.0 * Deprecated: 1.12: Use #ClutterPropertyTransition instead @@ -996,29 +824,15 @@ void clutter_animation_set_mode (ClutterAnimation *animation, gulong mode) { + ClutterTimeline *timeline; + g_return_if_fail (CLUTTER_IS_ANIMATION (animation)); g_object_freeze_notify (G_OBJECT (animation)); - if (animation->priv->alpha != NULL || mode > CLUTTER_ANIMATION_LAST) - { - ClutterAlpha *alpha; + timeline = clutter_animation_get_timeline_internal (animation); - if (animation->priv->alpha == NULL) - alpha = clutter_animation_get_alpha_internal (animation); - else - alpha = animation->priv->alpha; - - clutter_alpha_set_mode (alpha, mode); - } - else - { - ClutterTimeline *timeline; - - timeline = clutter_animation_get_timeline_internal (animation); - - clutter_timeline_set_progress_mode (timeline, mode); - } + clutter_timeline_set_progress_mode (timeline, mode); g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_MODE]); @@ -1044,9 +858,6 @@ clutter_animation_get_mode (ClutterAnimation *animation) g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), CLUTTER_LINEAR); - if (animation->priv->alpha != NULL) - return clutter_alpha_get_mode (animation->priv->alpha); - timeline = clutter_animation_get_timeline_internal (animation); return clutter_timeline_get_progress_mode (timeline); @@ -1059,8 +870,7 @@ clutter_animation_get_mode (ClutterAnimation *animation) * * Sets the duration of @animation in milliseconds. * - * This function will set #ClutterAnimation:alpha and - * #ClutterAnimation:timeline if needed. + * This function will set #ClutterAnimation:timeline if needed. * * Since: 1.0 * Deprecated: 1.12: Use #ClutterPropertyTransition instead @@ -1094,8 +904,7 @@ clutter_animation_set_duration (ClutterAnimation *animation, * A looping #ClutterAnimation will not emit the #ClutterAnimation::completed * signal when finished. * - * This function will set #ClutterAnimation:alpha and - * #ClutterAnimation:timeline if needed. + * This function will set #ClutterAnimation:timeline if needed. * * Since: 1.0 * Deprecated: 1.12: Use #ClutterPropertyTransition instead @@ -1189,10 +998,7 @@ clutter_animation_set_timeline (ClutterAnimation *animation, priv = animation->priv; - if (priv->alpha != NULL) - cur_timeline = clutter_alpha_get_timeline (priv->alpha); - else - cur_timeline = priv->timeline; + cur_timeline = priv->timeline; if (cur_timeline == timeline) return; @@ -1215,16 +1021,10 @@ clutter_animation_set_timeline (ClutterAnimation *animation, /* Release previously set timeline if any */ g_clear_object (&priv->timeline); - if (priv->alpha != NULL) - clutter_alpha_set_timeline (priv->alpha, timeline); - else - { - /* Hold a reference to the timeline if it's not reffed by the priv->alpha */ - priv->timeline = timeline; + priv->timeline = timeline; - if (priv->timeline) - g_object_ref (priv->timeline); - } + if (priv->timeline) + g_object_ref (priv->timeline); g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_DURATION]); @@ -1634,8 +1434,7 @@ clutter_actor_animate_with_timeline (ClutterActor *actor, * will make width and height properties of the #ClutterActor "rectangle" * grow linearly between the current value and 100 pixels, in 250 milliseconds. * - * The animation @mode is a logical id, either from the #ClutterAnimationMode - * enumeration of from clutter_alpha_register_func(). + * The animation @mode is a logical id, from the #ClutterAnimationMode. * * All the properties specified will be animated between the current value * and the final value. If a property should be set at the beginning of diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index c8e582eed..22c5e4ee4 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -219,7 +219,6 @@ clutter_nonintrospected_sources = [ clutter_deprecated_headers = [ 'deprecated/clutter-actor.h', - 'deprecated/clutter-alpha.h', 'deprecated/clutter-animation.h', 'deprecated/clutter-box.h', 'deprecated/clutter-container.h', @@ -230,7 +229,6 @@ clutter_deprecated_headers = [ ] clutter_deprecated_sources = [ - 'deprecated/clutter-alpha.c', 'deprecated/clutter-animation.c', 'deprecated/clutter-box.c', 'deprecated/clutter-group.c', diff --git a/src/tests/clutter/interactive/test-script.c b/src/tests/clutter/interactive/test-script.c index 999e5191b..d0795dde2 100644 --- a/src/tests/clutter/interactive/test-script.c +++ b/src/tests/clutter/interactive/test-script.c @@ -40,13 +40,7 @@ static const gchar *test_behaviour = " \"type\" : \"ClutterTimeline\"," " \"duration\" : 5000," " \"loop\" : true" -" }," -" {" -" \"id\" : \"sine-alpha\"," -" \"type\" : \"ClutterAlpha\"," -" \"function\" : \"sine_alpha\"," -" \"timeline\" : \"main-timeline\"" -" }," +" }" "]"; static gboolean