From d42c3069d101d33cf12e2c836d610e906610846f Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 14 Jun 2010 17:36:24 +0100 Subject: [PATCH] test-pixmap: Use the 'm' key to toggle texture quality When the 'm' key is pressed it will now recursively look for all ClutterTexture subclasses on the stage and toggle the texture quality between high and low. This is useful to test the mipmap fallback. --- tests/interactive/test-pixmap.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/interactive/test-pixmap.c b/tests/interactive/test-pixmap.c index 6f4051b9c..d2b8e790d 100644 --- a/tests/interactive/test-pixmap.c +++ b/tests/interactive/test-pixmap.c @@ -49,6 +49,34 @@ static GOptionEntry g_options[] = { NULL } }; +static void +toggle_texture_quality (ClutterActor *actor) +{ + if (CLUTTER_IS_CONTAINER (actor)) + clutter_container_foreach (CLUTTER_CONTAINER (actor), + (ClutterCallback) toggle_texture_quality, + NULL); + + if (CLUTTER_IS_TEXTURE (actor)) + { + ClutterTextureQuality quality; + + quality = clutter_texture_get_filter_quality (CLUTTER_TEXTURE (actor)); + + if (quality == CLUTTER_TEXTURE_QUALITY_HIGH) + quality = CLUTTER_TEXTURE_QUALITY_MEDIUM; + else + quality = CLUTTER_TEXTURE_QUALITY_HIGH; + + g_print ("switching to quality %s for %p\n", + quality == CLUTTER_TEXTURE_QUALITY_HIGH + ? "high" : "medium", + actor); + + clutter_texture_set_filter_quality (CLUTTER_TEXTURE (actor), quality); + } +} + static gboolean stage_key_release_cb (ClutterActor *actor, ClutterEvent *event, @@ -60,6 +88,10 @@ stage_key_release_cb (ClutterActor *actor, case CLUTTER_Q: clutter_main_quit (); break; + + case CLUTTER_m: + toggle_texture_quality (actor); + break; } return FALSE; }