/**
* 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"
* 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;
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__ */
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)
{
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);