From 15000307fdf06efda2b74889e021c63deb354a51 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 16 Nov 2011 13:59:11 +0000 Subject: interactive: Remove test-unproject The coordinate transformation code is exercised throughout the conformance and interactive tests, so there's no need to have a specific interactive test that doesn't do anything more complicated than calling clutter_actor_transform_stage_point(). --- tests/interactive/Makefile.am | 1 - tests/interactive/test-unproject.c | 157 ------------------------------------- 2 files changed, 158 deletions(-) delete mode 100644 tests/interactive/test-unproject.c diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am index 62c494bf7..75c7060dc 100644 --- a/tests/interactive/Makefile.am +++ b/tests/interactive/Makefile.am @@ -22,7 +22,6 @@ UNIT_TESTS = \ test-animator.c \ test-state.c \ test-state-animator.c \ - test-unproject.c \ test-fbo.c \ test-multistage.c \ test-cogl-primitives.c \ diff --git a/tests/interactive/test-unproject.c b/tests/interactive/test-unproject.c deleted file mode 100644 index d7e225fd3..000000000 --- a/tests/interactive/test-unproject.c +++ /dev/null @@ -1,157 +0,0 @@ -#include - -#include -#include -#include -#include - -#define RECT_L 200 -#define RECT_T 150 -#define RECT_W 320 -#define RECT_H 240 - -static ClutterActor *test_rectangle = NULL; -static ClutterActor *label = NULL; - - -static gboolean -on_event (ClutterStage *stage, - ClutterEvent *event, - gpointer user_data) -{ - switch (event->type) - { - case CLUTTER_BUTTON_PRESS: - { - ClutterActor *actor; - gfloat xu2, yu2; - gfloat x, y; - - clutter_event_get_coords (event, &x, &y); - - actor = clutter_stage_get_actor_at_pos (stage, - CLUTTER_PICK_ALL, - x, y); - - if (clutter_actor_transform_stage_point (actor, x, y, &xu2, &yu2)) - { - gchar *txt; - - if (actor == test_rectangle) - txt = g_strdup_printf ("Click on rectangle\n" - "Screen coords: [%d, %d]\n" - "Local coords : [%d, %d]", - (int) x, (int) y, - (int) xu2, (int) yu2); - else - txt = g_strdup_printf ("Click on stage\n" - "Screen coords: [%d, %d]\n" - "Local coords : [%d, %d]", - (int) x, (int) y, - (int) xu2, (int) yu2); - - clutter_text_set_text (CLUTTER_TEXT (label), txt); - g_free (txt); - } - else - clutter_text_set_text (CLUTTER_TEXT (label), "Unprojection failed."); - } - break; - - default: - break; - } - - return FALSE; -} - - -G_MODULE_EXPORT int -test_unproject_main (int argc, char *argv[]) -{ - gchar *txt; - ClutterActor *rect, *stage, *label0; - int i, rotate_x = 0, rotate_y = 60, rotate_z = 0; - ClutterColor stage_clr = { 0x0, 0x0, 0x0, 0xff }, - white = { 0xff, 0xff, 0xff, 0xff }, - blue = { 0x0, 0xff, 0xff, 0xff }; - - for (i = 0; i < argc; ++i) - { - if (!strncmp (argv[i], "--rotate-x", 10)) - { - rotate_x = atoi (argv[i] + 11); - } - else if (!strncmp (argv[i], "--rotate-y", 10)) - { - rotate_y = atoi (argv[i] + 11); - } - else if (!strncmp (argv[i], "--rotate-z", 10)) - { - rotate_z = atoi (argv[i] + 11); - } - else if (!strncmp (argv[i], "--help", 6)) - { - g_print ("%s [--rotage-x=degrees] " - "[--rotage-y=degrees] " - "[--rotage-z=degrees]\n", - argv[0]); - - return EXIT_FAILURE; - } - } - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Unprojecting events"); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); - clutter_actor_set_size (stage, 640, 480); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - rect = clutter_rectangle_new_with_color (&white); - clutter_actor_set_size (rect, RECT_W, RECT_H); - clutter_actor_set_position (rect, RECT_L, RECT_T); - clutter_actor_set_rotation (rect, CLUTTER_X_AXIS, rotate_x, 0, 0, 0); - clutter_actor_set_rotation (rect, CLUTTER_Y_AXIS, rotate_y, 0, 0, 0); - clutter_actor_set_rotation (rect, CLUTTER_Z_AXIS, rotate_z, 0, 0, 0); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); - test_rectangle = rect; - - txt = g_strdup_printf ("Rectangle: L %d, R %d, T %d, B %d\n" - "Rotation : x %d, y %d, z %d", - RECT_L, RECT_L + RECT_W, - RECT_T, RECT_T + RECT_H, - rotate_x, rotate_y, rotate_z); - - label0 = clutter_text_new_with_text ("Mono 8pt", txt); - clutter_text_set_color (CLUTTER_TEXT (label0), &white); - - clutter_actor_set_position (label0, 10, 10); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), label0); - - g_free (txt); - - label = - clutter_text_new_with_text ("Mono 8pt", "Click around!"); - - clutter_text_set_color (CLUTTER_TEXT (label), &blue); - - clutter_actor_set_position (label, 10, 50); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), label); - - clutter_actor_show_all (stage); - - g_signal_connect (stage, "event", G_CALLBACK (on_event), NULL); - - clutter_main(); - - return EXIT_SUCCESS; -} - -G_MODULE_EXPORT const char * -test_unproject_describe (void) -{ - return "Transform stage coordinates into actor coordinates."; -} -- cgit v1.2.1 From ef02de19e8a351b0f38b05d19423dd4a4eb3012c Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 16 Nov 2011 14:50:36 +0000 Subject: interactive: Remove test-model The model API is already tested in the conformance test suite. --- tests/interactive/Makefile.am | 1 - tests/interactive/test-model.c | 237 ----------------------------------------- 2 files changed, 238 deletions(-) delete mode 100644 tests/interactive/test-model.c diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am index 75c7060dc..3f9138267 100644 --- a/tests/interactive/Makefile.am +++ b/tests/interactive/Makefile.am @@ -13,7 +13,6 @@ UNIT_TESTS = \ test-depth.c \ test-threads.c \ test-script.c \ - test-model.c \ test-grab.c \ test-fullscreen.c \ test-shader.c \ diff --git a/tests/interactive/test-model.c b/tests/interactive/test-model.c deleted file mode 100644 index f54021b77..000000000 --- a/tests/interactive/test-model.c +++ /dev/null @@ -1,237 +0,0 @@ -#include -#include -#include - -enum -{ - COLUMN_FOO, - COLUMN_BAR, - - N_COLUMNS -}; - -static void -print_iter (ClutterModelIter *iter, - const gchar *text) -{ - ClutterModel *model; - gint i; - gchar *string; - - model = clutter_model_iter_get_model (iter); - - clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); - - g_print ("[row:%02d]: %s: (%s: %d), (%s: %s)\n", - clutter_model_iter_get_row (iter), - text, - clutter_model_get_column_name (model, COLUMN_FOO), i, - clutter_model_get_column_name (model, COLUMN_BAR), string); - - g_free (string); -} - -static gboolean -foreach_func (ClutterModel *model, - ClutterModelIter *iter, - gpointer dummy) -{ - gint i; - gchar *string; - - clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); - - g_print ("[row:%02d]: Foreach: %d, %s\n", - clutter_model_iter_get_row (iter), - i, string); - - g_free (string); - - return TRUE; -} - -static gboolean -filter_func (ClutterModel *model, - ClutterModelIter *iter, - gpointer dummy) -{ - gint i = 0; - - clutter_model_iter_get (iter, COLUMN_FOO, &i, -1); - - return !(i % 2); -} - -static gint -sort_func (ClutterModel *model, - const GValue *a, - const GValue *b, - gpointer dummy) -{ - return -1 * strcmp (g_value_get_string (a), g_value_get_string (b)); -} - -static void -on_row_changed (ClutterModel *model, - ClutterModelIter *iter) -{ - print_iter (iter, "Changed"); -} - -static void -filter_model (ClutterModel *model) -{ - ClutterModelIter *iter; - - g_print ("\n* Filter function: even rows\n"); - clutter_model_set_filter (model, filter_func, NULL, NULL); - - iter = clutter_model_get_first_iter (model); - while (!clutter_model_iter_is_last (iter)) - { - print_iter (iter, "Filtered Forward Iteration"); - - iter = clutter_model_iter_next (iter); - } - g_object_unref (iter); - - g_print ("\n* Sorting function: reverse alpha\n"); - clutter_model_set_sort (model, COLUMN_BAR, sort_func, NULL, NULL); - - g_signal_connect (model, "row-changed", G_CALLBACK (on_row_changed), NULL); - - iter = clutter_model_get_iter_at_row (model, 0); - clutter_model_iter_set (iter, COLUMN_BAR, "Changed string of 0th row, " - "automatically gets sorted", - -1); - g_object_unref (iter); - - clutter_model_foreach (model, foreach_func, NULL); - - g_print ("\n* Unset filter\n"); - clutter_model_set_filter (model, NULL, NULL, NULL); - - while (clutter_model_get_n_rows (model)) - clutter_model_remove (model, 0); - - clutter_main_quit (); -} - -static void -iterate (ClutterModel *model) -{ - ClutterModelIter *iter; - - iter = clutter_model_get_first_iter (model); - - while (!clutter_model_iter_is_last (iter)) - { - print_iter (iter, "Forward Iteration"); - iter = clutter_model_iter_next (iter); - } - g_object_unref (iter); - - iter = clutter_model_get_last_iter (model); - do - { - print_iter (iter, "Reverse Iteration"); - iter = clutter_model_iter_prev (iter); - } - while (!clutter_model_iter_is_first (iter)); - - print_iter (iter, "Reverse Iteration"); - g_object_unref (iter); - - filter_model (model); -} - - -static gboolean -populate_model (ClutterModel *model) -{ - gint i; - - for (i = 0; i < 10; i++) - { - gchar *string = g_strdup_printf ("String %d", i); - - clutter_model_append (model, - COLUMN_FOO, i, - COLUMN_BAR, string, - -1); - g_free (string); - } - - clutter_model_foreach (model, foreach_func, NULL); - iterate (model); - - return FALSE; -} - -static void -on_row_added (ClutterModel *model, - ClutterModelIter *iter, - gpointer dummy) -{ - gint i; - gchar *string; - - clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); - - g_print ("[row:%02d]: Added: %d, %s\n", - clutter_model_iter_get_row (iter), - i, string); - - g_free (string); -} - -static void -on_row_removed (ClutterModel *model, - ClutterModelIter *iter, - gpointer dummy) -{ - print_iter (iter, "Removed"); -} - -static void -on_sort_changed (ClutterModel *model) -{ - g_print ("*** Sort Changed ***\n\n"); - clutter_model_foreach (model, foreach_func, NULL); -} - -static void -on_filter_changed (ClutterModel *model) -{ - g_print ("*** Filter Changed ***\n\n"); -} - -G_MODULE_EXPORT int -test_model_main (int argc, char *argv[]) -{ - ClutterModel *model; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - model = clutter_list_model_new (N_COLUMNS, - G_TYPE_INT, "Foo", - G_TYPE_STRING, "Bar"); - - g_timeout_add (1000, (GSourceFunc) populate_model, model); - - g_signal_connect (model, "row-added", - G_CALLBACK (on_row_added), NULL); - g_signal_connect (model, "row-removed", - G_CALLBACK (on_row_removed), NULL); - g_signal_connect (model, "sort-changed", - G_CALLBACK (on_sort_changed), NULL); - g_signal_connect (model, "filter-changed", - G_CALLBACK (on_filter_changed), NULL); - - clutter_main(); - - g_object_unref (model); - - return 0; -} -- cgit v1.2.1 From ebf12a8cd724ff5136021d4b3aaa6e61531620d4 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 16 Nov 2011 16:42:41 +0000 Subject: docs: Document the DeformEffect wrap-mode change The change from CoglVertexBuffer to CoglPrimitive led to a change of the default wrap-mode for the pipeline. Since using REPEAT can introduce artifacts when sampling outside the [ 0, 1 ] texture coordinates range, and since the default wrap mode was not documented anyway, we want to keep the change from REPEAT to CLAMP, but it's worth adding an entry in the release notes. --- README.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.in b/README.in index 433de68b2..9ab556a15 100644 --- a/README.in +++ b/README.in @@ -289,6 +289,16 @@ features). Release Notes for Clutter 1.10 ------------------------------------------------------------------------------- +• ClutterDeformEffect switched from using CoglVertexBuffer to using the + CoglPrimitive API internally, to improve performance and use non-deprecated + Cogl API. CoglPrimitive converts COGL_WRAP_MODE_AUTOMATIC to + COGL_WRAP_MODE_CLAMP_TO_EDGE, unlike CoglVertexBuffer which converts it to + COGL_WRAP_MODE_REPEAT. This prevents artifacts when sampling texture + coordinates outside the [ 0, 1 ] range. This change may cause the back + texture to not be painted if its coordinates go outside the allowed range, + for instance when using a custom transformation matrix on the back material + used by the ClutterDeformEffect. + • The "default stage" has been deprecated; since the 1.0 release, the default stage creation was deferred to the call to clutter_stage_get_default(), and the preferred way for getting a ClutterStage was calling clutter_stage_new() -- cgit v1.2.1