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.
This commit is contained in:
parent
c5b5a88d6d
commit
d42c3069d1
@ -49,6 +49,34 @@ static GOptionEntry g_options[] =
|
|||||||
{ NULL }
|
{ 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
|
static gboolean
|
||||||
stage_key_release_cb (ClutterActor *actor,
|
stage_key_release_cb (ClutterActor *actor,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
@ -60,6 +88,10 @@ stage_key_release_cb (ClutterActor *actor,
|
|||||||
case CLUTTER_Q:
|
case CLUTTER_Q:
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_m:
|
||||||
|
toggle_texture_quality (actor);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user