[clutter/clutter-1.99: 4/14] [2.0] Remove ClutterBehaviour



commit bb51d86cd3af288cd3a0cb870ba280850a0da589
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Jun 16 16:09:03 2011 +0100

    [2.0] Remove ClutterBehaviour

 clutter/Makefile.am                    |   14 -
 clutter/clutter-actor.c                |   66 --
 clutter/clutter-behaviour-depth.c      |  305 ---------
 clutter/clutter-behaviour-depth.h      |  101 ---
 clutter/clutter-behaviour-ellipse.c    | 1064 --------------------------------
 clutter/clutter-behaviour-ellipse.h    |  147 -----
 clutter/clutter-behaviour-opacity.c    |  319 ----------
 clutter/clutter-behaviour-opacity.h    |  116 ----
 clutter/clutter-behaviour-path.c       |  474 --------------
 clutter/clutter-behaviour-path.h       |  135 ----
 clutter/clutter-behaviour-rotate.c     |  693 ---------------------
 clutter/clutter-behaviour-rotate.h     |  115 ----
 clutter/clutter-behaviour-scale.c      |  439 -------------
 clutter/clutter-behaviour-scale.h      |  106 ----
 clutter/clutter-behaviour.c            |  708 ---------------------
 clutter/clutter-behaviour.h            |  166 -----
 clutter/clutter-path.c                 |   62 ++
 clutter/clutter-script.c               |    1 -
 clutter/clutter.h                      |    7 -
 tests/conform/Makefile.am              |    1 -
 tests/conform/test-behaviours.c        |   92 ---
 tests/conform/test-conform-main.c      |    3 -
 tests/conform/test-script-parser.c     |   39 --
 tests/data/test-script.json            |    6 +-
 tests/interactive/Makefile.am          |   11 +-
 tests/interactive/test-behave.c        |  213 -------
 tests/interactive/test-scale.c         |  117 ----
 tests/interactive/test-script.c        |   87 ---
 tests/interactive/test-texture-async.c |   23 +-
 29 files changed, 72 insertions(+), 5558 deletions(-)
---
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 4ce51d2..059b63e 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -58,13 +58,6 @@ source_h =					\
 	$(srcdir)/clutter-animation.h           \
 	$(srcdir)/clutter-animator.h		\
 	$(srcdir)/clutter-backend.h		\
-	$(srcdir)/clutter-behaviour.h     	\
-	$(srcdir)/clutter-behaviour-depth.h 	\
-	$(srcdir)/clutter-behaviour-ellipse.h 	\
-	$(srcdir)/clutter-behaviour-opacity.h 	\
-	$(srcdir)/clutter-behaviour-path.h 	\
-	$(srcdir)/clutter-behaviour-rotate.h 	\
-	$(srcdir)/clutter-behaviour-scale.h 	\
 	$(srcdir)/clutter-bind-constraint.h	\
 	$(srcdir)/clutter-binding-pool.h 	\
 	$(srcdir)/clutter-bin-layout.h		\
@@ -143,13 +136,6 @@ source_c = \
 	$(srcdir)/clutter-animation.c		\
 	$(srcdir)/clutter-animator.c		\
 	$(srcdir)/clutter-backend.c		\
-	$(srcdir)/clutter-behaviour.c 		\
-	$(srcdir)/clutter-behaviour-depth.c	\
-	$(srcdir)/clutter-behaviour-ellipse.c	\
-	$(srcdir)/clutter-behaviour-opacity.c	\
-	$(srcdir)/clutter-behaviour-path.c	\
-	$(srcdir)/clutter-behaviour-rotate.c	\
-	$(srcdir)/clutter-behaviour-scale.c	\
 	$(srcdir)/clutter-bezier.c		\
 	$(srcdir)/clutter-bind-constraint.c	\
 	$(srcdir)/clutter-binding-pool.c	\
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index b1799e7..ec510f3 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -291,7 +291,6 @@
 #include "clutter-action.h"
 #include "clutter-actor-meta-private.h"
 #include "clutter-animatable.h"
-#include "clutter-behaviour.h"
 #include "clutter-constraint.h"
 #include "clutter-container.h"
 #include "clutter-debug.h"
@@ -9150,40 +9149,6 @@ parse_actor_metas (ClutterScript *script,
   return g_slist_reverse (retval);
 }
 
-static GSList *
-parse_behaviours (ClutterScript *script,
-                  ClutterActor  *actor,
-                  JsonNode      *node)
-{
-  GList *elements, *l;
-  GSList *retval = NULL;
-
-  if (!JSON_NODE_HOLDS_ARRAY (node))
-    return NULL;
-
-  elements = json_array_get_elements (json_node_get_array (node));
-
-  for (l = elements; l != NULL; l = l->next)
-    {
-      JsonNode *element = l->data;
-      const gchar *id_ = _clutter_script_get_id_from_node (element);
-      GObject *behaviour;
-
-      if (id_ == NULL || *id_ == '\0')
-        continue;
-
-      behaviour = clutter_script_get_object (script, id_);
-      if (behaviour == NULL)
-        continue;
-
-      retval = g_slist_prepend (retval, behaviour);
-    }
-
-  g_list_free (elements);
-
-  return g_slist_reverse (retval);
-}
-
 static gboolean
 clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
                                  ClutterScript     *script,
@@ -9242,17 +9207,6 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
       else
         g_slice_free (RotationInfo, info);
     }
-  else if (strcmp (name, "behaviours") == 0)
-    {
-      GSList *l;
-
-      l = parse_behaviours (script, actor, node);
-
-      g_value_init (value, G_TYPE_POINTER);
-      g_value_set_pointer (value, l);
-
-      retval = TRUE;
-    }
   else if (strcmp (name, "actions") == 0 ||
            strcmp (name, "constraints") == 0 ||
            strcmp (name, "effects") == 0)
@@ -9312,26 +9266,6 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
       return;
     }
 
-  if (strcmp (name, "behaviours") == 0)
-    {
-      GSList *behaviours, *l;
-
-      if (!G_VALUE_HOLDS (value, G_TYPE_POINTER))
-        return;
-
-      behaviours = g_value_get_pointer (value);
-      for (l = behaviours; l != NULL; l = l->next)
-        {
-          ClutterBehaviour *behaviour = l->data;
-
-          clutter_behaviour_apply (behaviour, actor);
-        }
-
-      g_slist_free (behaviours);
-
-      return;
-    }
-
   if (strcmp (name, "actions") == 0 ||
       strcmp (name, "constraints") == 0 ||
       strcmp (name, "effects") == 0)
diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c
index 91b2be2..82d41fb 100644
--- a/clutter/clutter-path.c
+++ b/clutter/clutter-path.c
@@ -146,6 +146,10 @@ G_DEFINE_BOXED_TYPE (ClutterPathNode, clutter_path_node,
                      clutter_path_node_copy,
                      clutter_path_node_free);
 
+G_DEFINE_BOXED_TYPE (ClutterKnot, clutter_knot,
+                     clutter_knot_copy,
+                     clutter_knot_free);
+
 G_DEFINE_TYPE_WITH_CODE (ClutterPath,
                          clutter_path,
                          G_TYPE_INITIALLY_UNOWNED,
@@ -1496,6 +1500,64 @@ clutter_path_get_length (ClutterPath *path)
   return path->priv->total_length;
 }
 
+/**
+ * clutter_knot_copy:
+ * @knot: a #ClutterKnot
+ *
+ * Makes an allocated copy of a knot.
+ *
+ * Return value: the copied knot.
+ *
+ * Since: 0.2
+ */
+ClutterKnot *
+clutter_knot_copy (const ClutterKnot *knot)
+{
+  if (knot != NULL)
+    return g_slice_dup (ClutterKnot, knot);
+
+  return NULL;
+}
+
+/**
+ * clutter_knot_free:
+ * @knot: a #ClutterKnot
+ *
+ * Frees the memory of an allocated knot.
+ *
+ * Since: 0.2
+ */
+void
+clutter_knot_free (ClutterKnot *knot)
+{
+  if (knot != NULL)
+    g_slice_free (ClutterKnot, knot);
+}
+
+/**
+ * clutter_knot_equal:
+ * @knot_a: First knot
+ * @knot_b: Second knot
+ *
+ * Compares to knot and checks if the point to the same location.
+ *
+ * Return value: %TRUE if the knots point to the same location.
+ *
+ * Since: 0.2
+ */
+gboolean
+clutter_knot_equal (const ClutterKnot *knot_a,
+                    const ClutterKnot *knot_b)
+{
+  g_return_val_if_fail (knot_a != NULL, FALSE);
+  g_return_val_if_fail (knot_b != NULL, FALSE);
+
+  if (knot_a == knot_b)
+    return TRUE;
+
+  return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
+}
+
 static ClutterPathNodeFull *
 clutter_path_node_full_new (void)
 {
diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c
index b3625c0..0850bb9 100644
--- a/clutter/clutter-script.c
+++ b/clutter/clutter-script.c
@@ -236,7 +236,6 @@
 
 #include "clutter-actor.h"
 #include "clutter-alpha.h"
-#include "clutter-behaviour.h"
 #include "clutter-container.h"
 #include "clutter-stage.h"
 #include "clutter-state.h"
diff --git a/clutter/clutter.h b/clutter/clutter.h
index bd2ccd0..eadad21 100644
--- a/clutter/clutter.h
+++ b/clutter/clutter.h
@@ -41,13 +41,6 @@
 #include "clutter-animation.h"
 #include "clutter-animator.h"
 #include "clutter-backend.h"
-#include "clutter-behaviour-depth.h"
-#include "clutter-behaviour-ellipse.h"
-#include "clutter-behaviour.h"
-#include "clutter-behaviour-opacity.h"
-#include "clutter-behaviour-path.h"
-#include "clutter-behaviour-rotate.h"
-#include "clutter-behaviour-scale.h"
 #include "clutter-bind-constraint.h"
 #include "clutter-binding-pool.h"
 #include "clutter-bin-layout.h"
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 0a57ad0..d2b1711 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -17,7 +17,6 @@ units_sources =
 # animation tests
 units_sources += \
 	test-animator.c			\
-	test-behaviours.c		\
 	test-score.c			\
 	test-state.c			\
 	test-timeline.c			\
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 1cc7d5d..f1eda71 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -192,7 +192,6 @@ main (int argc, char **argv)
 
   TEST_CONFORM_SIMPLE ("/script", test_script_single);
   TEST_CONFORM_SIMPLE ("/script", test_script_child);
-  TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
   TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
   TEST_CONFORM_SIMPLE ("/script", test_script_animation);
   TEST_CONFORM_SIMPLE ("/script", test_script_named_object);
@@ -208,8 +207,6 @@ main (int argc, char **argv)
 
   TEST_CONFORM_SIMPLE ("/score", test_score);
 
-  TEST_CONFORM_SIMPLE ("/behaviours", test_behaviours);
-
   TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
   TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
   TEST_CONFORM_SIMPLE ("/cogl", test_cogl_backface_culling);
diff --git a/tests/conform/test-script-parser.c b/tests/conform/test-script-parser.c
index 44abe09..cc6b9a3 100644
--- a/tests/conform/test-script-parser.c
+++ b/tests/conform/test-script-parser.c
@@ -205,45 +205,6 @@ test_script_single (TestConformSimpleFixture *fixture,
 }
 
 void
-test_script_implicit_alpha (TestConformSimpleFixture *fixture,
-                            gconstpointer dummy)
-{
-  ClutterScript *script = clutter_script_new ();
-  ClutterTimeline *timeline;
-  GObject *behaviour = NULL;
-  GError *error = NULL;
-  ClutterAlpha *alpha;
-  gchar *test_file;
-
-  test_file = clutter_test_get_data_file ("test-script-implicit-alpha.json");
-  clutter_script_load_from_file (script, test_file, &error);
-  if (g_test_verbose () && error)
-    g_print ("Error: %s", error->message);
-
-#if GLIB_CHECK_VERSION (2, 20, 0)
-  g_assert_no_error (error);
-#else
-  g_assert (error == NULL);
-#endif
-
-  behaviour = clutter_script_get_object (script, "test");
-  g_assert (CLUTTER_IS_BEHAVIOUR (behaviour));
-
-  alpha = clutter_behaviour_get_alpha (CLUTTER_BEHAVIOUR (behaviour));
-  g_assert (CLUTTER_IS_ALPHA (alpha));
-
-  g_assert_cmpint (clutter_alpha_get_mode (alpha), ==, CLUTTER_EASE_OUT_CIRC);
-
-  timeline = clutter_alpha_get_timeline (alpha);
-  g_assert (CLUTTER_IS_TIMELINE (timeline));
-
-  g_assert_cmpint (clutter_timeline_get_duration (timeline), ==, 500);
-
-  g_object_unref (script);
-  g_free (test_file);
-}
-
-void
 test_script_object_property (TestConformSimpleFixture *fixture,
                              gconstpointer dummy)
 {
diff --git a/tests/data/test-script.json b/tests/data/test-script.json
index 3482d73..20c5846 100644
--- a/tests/data/test-script.json
+++ b/tests/data/test-script.json
@@ -17,8 +17,7 @@
         "reactive" : true,
         "rotation" : [
           { "z-axis" : [ 45.0, [ 75, 75 ] ] }
-        ],
-        "behaviours" : [ "fade-behaviour", "path-behaviour" ]
+        ]
       },
       {
         "id" : "green-button",
@@ -46,8 +45,7 @@
         "keep-aspect-ratio" : true,
         "anchor-x" : "5 em",
         "anchor-y" : "5 pt",
-        "opacity" : 100,
-        "behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
+        "opacity" : 100
       },
       {
         "id" : "red-hand-clone",
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 67ed9a7..c59094b 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -5,13 +5,7 @@ UNIT_TESTS = \
 	test-texture-async.c \
 	test-texture-material.c \
 	test-events.c \
-	test-scale.c \
-        test-actors.c \
-        test-actor-clone.c \
-	test-behave.c \
 	test-shader-effects.c \
-	test-depth.c \
-	test-threads.c \
 	test-script.c \
 	test-model.c \
 	test-grab.c \
@@ -23,7 +17,6 @@ UNIT_TESTS = \
 	test-state-animator.c \
 	test-unproject.c \
 	test-fbo.c \
-	test-multistage.c \
 	test-cogl-primitives.c \
 	test-cogl-tex-tile.c \
 	test-cogl-tex-convert.c \
@@ -34,8 +27,6 @@ UNIT_TESTS = \
 	test-cogl-multitexture.c \
 	test-stage-read-pixels.c \
 	test-clip.c \
-	test-paint-wrapper.c \
-	test-texture-quality.c \
 	test-layout.c \
         test-animation.c \
         test-easing.c \
@@ -60,7 +51,7 @@ UNIT_TESTS = \
 	test-drop.c
 
 if X11_TESTS
-UNIT_TESTS += test-pixmap.c test-devices.c
+UNIT_TESTS += test-devices.c
 endif
 
 if OS_WIN32
diff --git a/tests/interactive/test-script.c b/tests/interactive/test-script.c
index e980196..d9c54da 100644
--- a/tests/interactive/test-script.c
+++ b/tests/interactive/test-script.c
@@ -32,73 +32,6 @@ static const gchar *test_unmerge =
 "  }"
 "]";
 
-static const gchar *test_behaviour =
-"["
-"  {"
-"    \"id\" : \"main-timeline\","
-"    \"type\" : \"ClutterTimeline\","
-"    \"duration\" : 5000,"
-"    \"loop\" : true"
-"  },"
-"  {"
-"    \"id\" : \"sine-alpha\","
-"    \"type\" : \"ClutterAlpha\","
-"    \"function\" : \"sine_alpha\","
-"    \"timeline\" : \"main-timeline\""
-"  },"
-"  {"
-"    \"id\"          : \"path-behaviour\","
-"    \"type\"        : \"ClutterBehaviourPath\","
-"    \"path\"        : \"M 50 50 L 100 100\","
-"    \"alpha\"       : {"
-"      \"timeline\" : \"main-timeline\","
-"      \"function\" : \"double_ramp_alpha\""
-"    }"
-"  },"
-"  {"
-"    \"id\"          : \"rotate-behaviour\","
-"    \"type\"        : \"ClutterBehaviourRotate\","
-"    \"angle-start\" : 0.0,"
-"    \"angle-end\"   : 360.0,"
-"    \"axis\"        : \"y-axis\","
-"    \"alpha\"       : \"sine-alpha\""
-"  },"
-"  {"
-"    \"id\"            : \"fade-behaviour\","
-"    \"type\"          : \"ClutterBehaviourOpacity\","
-"    \"opacity-start\" : 255,"
-"    \"opacity-end\"   : 0,"
-"    \"alpha\"         : {"
-"      \"id\"       : \"fade-alpha\","
-"      \"type\"     : \"ClutterAlpha\","
-"      \"timeline\" : \"main-timeline\","
-"      \"mode\"     : \"linear\""
-"    }"
-"  }"
-"]";
-
-gdouble
-sine_alpha (ClutterAlpha *alpha,
-            gpointer      dummy G_GNUC_UNUSED)
-{
-  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
-
-  return sin (clutter_timeline_get_progress (timeline) * G_PI);
-}
-
-gdouble
-double_ramp_alpha (ClutterAlpha *alpha,
-                   gpointer      dummy G_GNUC_UNUSED)
-{
-  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
-  gdouble progress = clutter_timeline_get_progress (timeline);
-
-  if (progress >= 0.5)
-    return 1.0 - progress;
-
-  return progress;
-}
-
 static gboolean
 blue_button_press (ClutterActor       *actor,
                    ClutterButtonEvent *event,
@@ -117,18 +50,8 @@ red_button_press (ClutterActor *actor,
                   ClutterButtonEvent *event,
                   gpointer            data)
 {
-  GObject *timeline;
-
   g_print ("[*] Pressed '%s'\n", clutter_get_script_id (G_OBJECT (actor)));
 
-  timeline = clutter_script_get_object (script, "main-timeline");
-  g_assert (CLUTTER_IS_TIMELINE (timeline));
-
-  if (!clutter_timeline_is_playing (CLUTTER_TIMELINE (timeline)))
-    clutter_timeline_start (CLUTTER_TIMELINE (timeline));
-  else
-    clutter_timeline_pause (CLUTTER_TIMELINE (timeline));
-
   return TRUE;
 }
 
@@ -146,16 +69,6 @@ test_script_main (int argc, char *argv[])
   script = clutter_script_new ();
   g_assert (CLUTTER_IS_SCRIPT (script));
 
-  clutter_script_load_from_data (script, test_behaviour, -1, &error);
-  if (error)
-    {
-      g_print ("*** Error:\n"
-               "***   %s\n", error->message);
-      g_error_free (error);
-      g_object_unref (script);
-      return EXIT_FAILURE;
-    }
-
   file = g_build_filename (TESTS_DATADIR, "test-script.json", NULL);
   clutter_script_load_from_file (script, file, &error);
   if (error)
diff --git a/tests/interactive/test-texture-async.c b/tests/interactive/test-texture-async.c
index f88f382..5d172a6 100644
--- a/tests/interactive/test-texture-async.c
+++ b/tests/interactive/test-texture-async.c
@@ -52,9 +52,6 @@ size_change_cb (ClutterTexture *texture,
 static
 gboolean task (gpointer user_data)
 {
-  ClutterTimeline  *timeline;
-  ClutterAlpha     *alpha;
-  ClutterBehaviour *depth_behavior;
   ClutterActor     *image[4];
   ClutterActor     *clone[4];
   ClutterActor     *stage;
@@ -107,11 +104,10 @@ gboolean task (gpointer user_data)
 
   for (i = 0; i < 3; i++)
     {
-      timeline = clutter_timeline_new (5000);
-      alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
-      depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 0);
-      clutter_behaviour_apply (depth_behavior, image[i]);
-      clutter_timeline_start (timeline);
+      clutter_actor_animate (image[i], CLUTTER_LINEAR,
+                             5000,
+                             "depth", -2500.0,
+                             NULL);
     }
 
   return FALSE;
@@ -122,15 +118,13 @@ G_MODULE_EXPORT gint
 test_texture_async_main (int argc, char *argv[])
 {
   ClutterActor *stage;
-  ClutterColor  stage_color = { 0x12, 0x34, 0x56, 0xff };
-  gchar        *path;
+  gchar *path;
 
   if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
     return 1;
 
-  g_thread_init (NULL);
-  stage = clutter_stage_get_default ();
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+  stage = clutter_stage_new ();
+  clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue);
 
   clutter_actor_show (stage);
   g_signal_connect (stage,
@@ -147,8 +141,5 @@ test_texture_async_main (int argc, char *argv[])
 
   g_free (path);
 
-  /*g_object_unref (depth_behavior);
-  g_object_unref (timeline);*/
-
   return EXIT_SUCCESS;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]