Deprecate clutter_util_next_p2()

The next_p2() function should have never been publicly exposed by
Clutter.
This commit is contained in:
Emmanuele Bassi 2010-02-05 16:22:09 +00:00
parent bbaf6b233d
commit e55966d675
3 changed files with 31 additions and 12 deletions

View File

@ -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;

View File

@ -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__ */

View File

@ -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);