diff --git a/clutter/clutter-util.c b/clutter/clutter-util.c index 85fcf5f57..6cb9dde20 100644 --- a/clutter/clutter-util.c +++ b/clutter/clutter-util.c @@ -25,12 +25,11 @@ /** * SECTION:clutter-util - * @short_description: Misc utility functions. + * @short_description: Utility functions * - * Various misc utilility functions. + * Various miscellaneous utilility functions. */ - #include "clutter-util.h" #include "clutter-main.h" @@ -41,13 +40,15 @@ * Calculates the nearest power of two, greater than or equal to @a. * * Return value: The nearest power of two, greater or equal to @a. + * + * Deprecated: 1.2 */ -int -clutter_util_next_p2 (int a) +gint +clutter_util_next_p2 (gint a) { - int rval=1; + int rval = 1; - while(rval < a) + while (rval < a) rval <<= 1; return rval; diff --git a/clutter/clutter-util.h b/clutter/clutter-util.h index ab7846c06..d1fe9f8f1 100644 --- a/clutter/clutter-util.h +++ b/clutter/clutter-util.h @@ -32,9 +32,12 @@ G_BEGIN_DECLS -int -clutter_util_next_p2 (int a); +#ifndef CLUTTER_DISABLE_DEPRECATED + +gint clutter_util_next_p2 (gint a) G_GNUC_DEPRECATED; + +#endif /* CLUTTER_DISABLE_DEPRECATED */ G_END_DECLS -#endif +#endif /* __CLUTTER_UTIL_H__ */ diff --git a/tests/interactive/test-shader.c b/tests/interactive/test-shader.c index 4b3a6997c..2261c51e7 100644 --- a/tests/interactive/test-shader.c +++ b/tests/interactive/test-shader.c @@ -203,6 +203,17 @@ static ShaderSource shaders[]= static gint shader_no = 0; +static int +next_p2 (gint a) +{ + int rval = 1; + + while (rval < a) + rval <<= 1; + + return rval; +} + static void set_shader_num (ClutterActor *actor, gint new_no) { @@ -251,10 +262,14 @@ set_shader_num (ClutterActor *actor, gint new_no) if (CLUTTER_IS_TEXTURE (actor)) { + /* XXX - this assumes *a lot* about how things are done + * internally on *some* hardware and driver + */ tex_width = clutter_actor_get_width (actor); - tex_width = clutter_util_next_p2 (tex_width); + tex_width = next_p2 (tex_width); + tex_height = clutter_actor_get_height (actor); - tex_height = clutter_util_next_p2 (tex_height); + tex_height = next_p2 (tex_height); clutter_actor_set_shader_param_float (actor, "x_step", 1.0f / tex_width);