diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c index 6a42e1e2e..bfec5df43 100644 --- a/cogl/cogl-texture-2d.c +++ b/cogl/cogl-texture-2d.c @@ -158,13 +158,6 @@ _cogl_texture_2d_free (CoglTexture2D *tex_2d) _cogl_texture_free (COGL_TEXTURE (tex_2d)); } -static gboolean -_cogl_texture_2d_is_pot (unsigned int num) -{ - /* Make sure there is only one bit set */ - return (num & (num - 1)) == 0; -} - static gboolean _cogl_texture_2d_can_create (unsigned int width, unsigned int height, @@ -183,8 +176,8 @@ _cogl_texture_2d_can_create (unsigned int width, /* If NPOT textures aren't supported then the size must be a power of two */ if (!cogl_features_available (COGL_FEATURE_TEXTURE_NPOT) && - (!_cogl_texture_2d_is_pot (width) || - !_cogl_texture_2d_is_pot (height))) + (!_cogl_util_is_pot (width) || + !_cogl_util_is_pot (height))) return FALSE; _cogl_pixel_format_to_gl (internal_format, diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h index 9d399ea1b..f63863a42 100644 --- a/cogl/cogl-util.h +++ b/cogl/cogl-util.h @@ -60,4 +60,12 @@ cogl_util_float_signbit (float x) negative numbers. */ #define COGL_UTIL_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f)) +/* Returns whether the given integer is a power of two */ +static inline gboolean +_cogl_util_is_pot (unsigned int num) +{ + /* Make sure there is only one bit set */ + return (num & (num - 1)) == 0; +} + #endif /* __COGL_UTIL_H */