Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-16 13:25:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-16 13:25:07 +0400
commit2253b63c979fbfbbb6f06c93ede85d9b9b6caddf (patch)
tree6fe58202f96a7edd8448d7fbf17a14df6098d0f7 /source/blender/blenkernel/intern/image_gen.c
parent91f14ddf3da140156c722e347b6f188210903629 (diff)
static functions for getting power of 2 values were being copied about too much, add to the BLI_math api.
- is_power_of_2_i - power_of_2_min_i - power_of_2_max_i
Diffstat (limited to 'source/blender/blenkernel/intern/image_gen.c')
-rw-r--r--source/blender/blenkernel/intern/image_gen.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 751980f61e8..a93d0221cf0 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -30,6 +30,7 @@
#include "BKE_image.h"
#include "BLI_math_color.h"
+#include "BLI_math_base.h"
#include "BLF_api.h"
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4])
@@ -161,21 +162,6 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
#define BLEND_FLOAT(real, add) (real+add <= 1.0f) ? (real+add) : 1.0f
#define BLEND_CHAR(real, add) ((real + (char)(add * 255.0f)) <= 255) ? (real + (char)(add * 255.0f)) : 255
-static int is_pow2(int n)
-{
- return ((n)&(n-1))==0;
-}
-static int larger_pow2(int n)
-{
- if (is_pow2(n))
- return n;
-
- while(!is_pow2(n))
- n= n&(n-1);
-
- return n*2;
-}
-
static void checker_board_color_fill(unsigned char *rect, float *rect_float, int width, int height)
{
int hue_step, y, x;
@@ -183,7 +169,7 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
sat= 1.0;
- hue_step= larger_pow2(width / 8);
+ hue_step= power_of_2_max_i(width / 8);
if(hue_step < 8) hue_step= 8;
for(y= 0; y < height; y++)