Code cleanup: use bools

also rename BLI_omp_thread_count -> BLI_system_thread_count_omp
This commit is contained in:
Campbell Barton 2014-04-17 13:46:34 +10:00
parent 4219e44f1d
commit 1b9db9911d
13 changed files with 25 additions and 23 deletions

View File

@ -1874,7 +1874,7 @@ int BKE_scene_num_threads(const Scene *scene)
int BKE_scene_num_omp_threads(const struct Scene *scene)
{
if (scene->omp_threads_mode == SCE_OMP_AUTO)
return BLI_omp_thread_count();
return BLI_system_thread_count_omp();
else
return scene->omp_threads;
}

View File

@ -75,7 +75,7 @@ int BLI_system_thread_count(void); /* gets the number of threads the system
void BLI_system_num_threads_override_set(int num);
int BLI_system_num_threads_override_get(void);
int BLI_omp_thread_count(void); /* gets the number of openmp threads the system can make use of */
int BLI_system_thread_count_omp(void);
/* Global Mutex Locks
*

View File

@ -350,8 +350,10 @@ void BLI_end_threads(ListBase *threadbase)
/* System Information */
/* gets the number of openmp threads the system can make use of */
int BLI_omp_thread_count(void)
/**
* Returns the number of openmp threads the system can make use of
*/
int BLI_system_thread_count_omp(void)
{
int t;
#ifdef _OPENMP

View File

@ -103,7 +103,7 @@ enum TfmMode {
* returns 1 if successful, 0 otherwise (usually means there's no selection)
* (if 0 is returns, *vec is unmodified)
* */
int calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
struct TransInfo;
struct ScrArea;

View File

@ -433,7 +433,7 @@ void uiButSetDragName(uiBut *but, const char *name);
void uiButSetDragValue(uiBut *but);
void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale);
int UI_but_active_drop_name(struct bContext *C);
bool UI_but_active_drop_name(struct bContext *C);
void uiButSetFlag(uiBut *but, int flag);
void uiButClearFlag(uiBut *but, int flag);

View File

@ -6248,7 +6248,7 @@ void uiFreeActiveButtons(const bContext *C, bScreen *screen)
/* returns true if highlighted button allows drop of names */
/* called in region context */
int UI_but_active_drop_name(bContext *C)
bool UI_but_active_drop_name(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
uiBut *but = ui_but_find_activated(ar);

View File

@ -549,7 +549,7 @@ void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
uiWidgetColors *ui_tooltip_get_theme(void);
void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol);
bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol);
void ui_draw_link_bezier(const rcti *rect);
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);

View File

@ -2462,7 +2462,7 @@ static void widget_numbut_embossn(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
widget_numbut_draw(wcol, rect, state, roundboxalign, true);
}
int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
{
float dist, vec[4][2];
@ -2479,9 +2479,9 @@ int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
vec[2][0] = vec[3][0] - dist;
vec[2][1] = vec[3][1];
BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], &coord_array[0][0], resol, sizeof(float[2]));
BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], &coord_array[0][1], resol, sizeof(float[2]));
return 1;
}
@ -2489,7 +2489,7 @@ int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
void ui_draw_link_bezier(const rcti *rect)
{
float coord_array[LINK_RESOL + 1][2];
if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
/* we can reuse the dist variable here to increment the GL curve eval amount*/
// const float dist = 1.0f / (float)LINK_RESOL; // UNUSED

View File

@ -1522,7 +1522,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
}
int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[2])
bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[2])
{
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
bool success;
@ -2000,7 +2000,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
/* note: caller needs to free 't' on a 0 return */
int initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode)
bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode)
{
int options = 0;
PropertyRNA *prop;

View File

@ -486,7 +486,7 @@ typedef struct TransInfo {
#define POINT_INIT 4
#define MULTI_POINTS 8
int initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, const struct wmEvent *event, int mode);
bool initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, const struct wmEvent *event, int mode);
void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op);
int transformEvent(TransInfo *t, const struct wmEvent *event);
void transformApply(struct bContext *C, TransInfo *t);
@ -523,7 +523,7 @@ void flushTransTracking(TransInfo *t);
void flushTransMasking(TransInfo *t);
/*********************** exported from transform_manipulator.c ********** */
int gimbal_axis(struct Object *ob, float gmat[3][3]); /* return 0 when no gimbal for selection */
bool gimbal_axis(struct Object *ob, float gmat[3][3]); /* return 0 when no gimbal for selection */
int calc_manipulator_stats(const struct bContext *C);
/*********************** TransData Creation and General Handling *********** */

View File

@ -202,7 +202,7 @@ static int test_rotmode_euler(short rotmode)
return (ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) ? 0 : 1;
}
int gimbal_axis(Object *ob, float gmat[3][3])
bool gimbal_axis(Object *ob, float gmat[3][3])
{
if (ob) {
if (ob->mode & OB_MODE_POSE) {

View File

@ -116,7 +116,7 @@ typedef struct GPUDrawObject {
/* if there was a failure allocating some buffer, use old
* rendering code */
int legacy;
bool legacy;
} GPUDrawObject;
/* used for GLSL materials */
@ -161,7 +161,7 @@ void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start,
void GPU_buffer_unbind(void);
/* used to check whether to use the old (without buffers) code */
int GPU_buffer_legacy(struct DerivedMesh *dm);
bool GPU_buffer_legacy(struct DerivedMesh *dm);
/* Buffers for non-DerivedMesh drawing */
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;

View File

@ -594,7 +594,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
int *mat_orig_to_new;
int *cur_index_per_mat;
int i;
int success;
bool success;
GLboolean uploaded;
pool = gpu_get_global_buffer_pool();
@ -1283,13 +1283,13 @@ void GPU_color_switch(int mode)
/* return 1 if drawing should be done using old immediate-mode
* code, 0 otherwise */
int GPU_buffer_legacy(DerivedMesh *dm)
bool GPU_buffer_legacy(DerivedMesh *dm)
{
int test = (U.gameflags & USER_DISABLE_VBO);
if (test)
return 1;
if (dm->drawObject == 0)
if (dm->drawObject == NULL)
dm->drawObject = GPU_drawobject_new(dm);
return dm->drawObject->legacy;
}