cogl: Make cogl_util_next_p2 internal and fix the documentation

cogl_util_next_p2 is declared in cogl-util.h which is a private header
so it shouldn't be possible for an application to use it. It's
probably not a function we'd like to export from Cogl so it seems
better to keep it private. This patch renames it to _cogl_util_next_p2
so that it won't be exported from the shared library.

The documentation for the function is also slightly wrong because it
stated that the function returned the next power greater than
'a'. However the code would actually return 'a' if it's already a
power of two. I think the actual behaviour is more useful so this
patch changes the documentation rather than the code.
This commit is contained in:
Neil Roberts 2010-09-15 14:39:05 +01:00
parent a433bd8e9e
commit 583d5cc79f
3 changed files with 9 additions and 8 deletions

View File

@ -783,8 +783,8 @@ _cogl_texture_2d_sliced_slices_create (CoglTexture2DSliced *tex_2ds,
} }
else else
{ {
max_width = cogl_util_next_p2 (width); max_width = _cogl_util_next_p2 (width);
max_height = cogl_util_next_p2 (height); max_height = _cogl_util_next_p2 (height);
tex_2ds->gl_target = GL_TEXTURE_2D; tex_2ds->gl_target = GL_TEXTURE_2D;
slices_for_size = _cogl_pot_slices_for_size; slices_for_size = _cogl_pot_slices_for_size;
} }

View File

@ -40,16 +40,17 @@
#include "cogl-handle.h" #include "cogl-handle.h"
#include "cogl-util.h" #include "cogl-util.h"
/** /*
* cogl_util_next_p2: * cogl_util_next_p2:
* @a: Value to get the next power * @a: Value to get the next power of two
* *
* Calculates the next power greater than @a. * Calculates the next power of two greater than or equal to @a.
* *
* Return value: The next power after @a. * Return value: @a if @a is already a power of two, otherwise returns
* the next nearest power of two.
*/ */
int int
cogl_util_next_p2 (int a) _cogl_util_next_p2 (int a)
{ {
int rval = 1; int rval = 1;

View File

@ -28,7 +28,7 @@
#include <math.h> #include <math.h>
int int
cogl_util_next_p2 (int a); _cogl_util_next_p2 (int a);
/* The signbit macro is defined by ISO C99 so it should be available, /* The signbit macro is defined by ISO C99 so it should be available,
however if it's not we can fallback to an evil hack */ however if it's not we can fallback to an evil hack */