From 583d5cc79f2a00ac6e9ac93253f9cfdb528830a2 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 15 Sep 2010 14:39:05 +0100 Subject: [PATCH] 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. --- cogl/cogl-texture-2d-sliced.c | 4 ++-- cogl/cogl-util.c | 11 ++++++----- cogl/cogl-util.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c index 36292f8c9..adbbb144e 100644 --- a/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl-texture-2d-sliced.c @@ -783,8 +783,8 @@ _cogl_texture_2d_sliced_slices_create (CoglTexture2DSliced *tex_2ds, } else { - max_width = cogl_util_next_p2 (width); - max_height = cogl_util_next_p2 (height); + max_width = _cogl_util_next_p2 (width); + max_height = _cogl_util_next_p2 (height); tex_2ds->gl_target = GL_TEXTURE_2D; slices_for_size = _cogl_pot_slices_for_size; } diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c index 369017b8c..f6d3709f2 100644 --- a/cogl/cogl-util.c +++ b/cogl/cogl-util.c @@ -40,16 +40,17 @@ #include "cogl-handle.h" #include "cogl-util.h" -/** +/* * 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 -cogl_util_next_p2 (int a) +_cogl_util_next_p2 (int a) { int rval = 1; diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h index f63863a42..64ba8ffcf 100644 --- a/cogl/cogl-util.h +++ b/cogl/cogl-util.h @@ -28,7 +28,7 @@ #include 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, however if it's not we can fallback to an evil hack */