Deprecate clutter_util_next_p2()
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 5 Feb 2010 16:22:09 +0000 (16:22 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Sat, 6 Feb 2010 10:49:33 +0000 (10:49 +0000)
The next_p2() function should have never been publicly exposed by
Clutter.

clutter/clutter-util.c
clutter/clutter-util.h
tests/interactive/test-shader.c

index 85fcf5f..6cb9dde 100644 (file)
 
 /**
  * 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;
index ab7846c..d1fe9f8 100644 (file)
 
 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__ */
index 4b3a699..2261c51 100644 (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);