diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 09:06:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 09:06:40 +0400 |
commit | 81eafc49e624b089190ff21bdd9d71c4b4a5c7da (patch) | |
tree | 89ea4967e3d87d7a159833c876171a6db4ba20dc | |
parent | db250a48f615ed36b368412deedaa77f59366d61 (diff) |
use min_ii/max_ii over MIN2 MAX2
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 19 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 5 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.c | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 8 |
10 files changed, 36 insertions, 38 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index dd4b1e524ec..a44b694bdf4 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -724,7 +724,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, /* Loop tree levels (log N) loops */ for (i = 1, depth = 1; i <= num_branches; i = i * tree_type + tree_offset, depth++) { const int first_of_next_level = i * tree_type + tree_offset; - const int end_j = MIN2(first_of_next_level, num_branches + 1); /* index of last branch on this level */ + const int end_j = min_ii(first_of_next_level, num_branches + 1); /* index of last branch on this level */ int j; /* Loop all branches on this level */ @@ -1080,7 +1080,9 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int return NULL; /* fast check root nodes for collision before doing big splitting + traversal */ - if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis))) + if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], + min_ii(tree1->start_axis, tree2->start_axis), + min_ii(tree1->stop_axis, tree2->stop_axis))) return NULL; data = MEM_callocN(sizeof(BVHOverlapData *) * tree1->tree_type, "BVHOverlapData_star"); @@ -1094,8 +1096,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int data[j]->tree2 = tree2; data[j]->max_overlap = MAX2(tree1->totleaf, tree2->totleaf); data[j]->i = 0; - data[j]->start_axis = MIN2(tree1->start_axis, tree2->start_axis); - data[j]->stop_axis = MIN2(tree1->stop_axis, tree2->stop_axis); + data[j]->start_axis = min_ii(tree1->start_axis, tree2->start_axis); + data[j]->stop_axis = min_ii(tree1->stop_axis, tree2->stop_axis); } #pragma omp parallel for private(j) schedule(static) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6374314e4bb..1b88a60b741 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1303,7 +1303,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) if (RNA_property_type(prop) == PROP_FLOAT) { tot = RNA_property_array_length(&but->rnapoin, prop); - tot = MIN2(tot, 3); + tot = min_ii(tot, 3); for (a = 0; a < tot; a++) vec[a] = RNA_property_float_get_index(&but->rnapoin, prop, a); @@ -1348,7 +1348,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3]) int a; tot = RNA_property_array_length(&but->rnapoin, prop); - tot = MIN2(tot, 3); + tot = min_ii(tot, 3); for (a = 0; a < tot; a++) { RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 9fac19031de..96e089ee151 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -41,6 +41,7 @@ #include "BLI_string.h" #include "BLI_rect.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BLF_translation.h" @@ -1932,8 +1933,8 @@ static void ui_litem_estimate_column_flow(uiLayout *litem) return; } - flow->totcol = MAX2(litem->root->emw / maxw, 1); - flow->totcol = MIN2(flow->totcol, totitem); + flow->totcol = max_ii(litem->root->emw / maxw, 1); + flow->totcol = min_ii(flow->totcol, totitem); } else flow->totcol = flow->number; @@ -2007,7 +2008,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem) emy -= itemh; ui_item_position(item, x + offset, y, itemw, itemh); y -= style->buttonspacey; - miny = MIN2(miny, y); + miny = min_ii(miny, y); /* decide to go to next one */ if (col < flow->totcol - 1 && emy <= -emh) { @@ -2038,8 +2039,8 @@ static void ui_litem_estimate_absolute(uiLayout *litem) ui_item_offset(item, &itemx, &itemy); ui_item_size(item, &itemw, &itemh); - minx = MIN2(minx, itemx); - miny = MIN2(miny, itemy); + minx = min_ii(minx, itemx); + miny = min_ii(miny, itemy); litem->w = MAX2(litem->w, itemx + itemw); litem->h = MAX2(litem->h, itemy + itemh); @@ -2064,11 +2065,11 @@ static void ui_litem_layout_absolute(uiLayout *litem) ui_item_offset(item, &itemx, &itemy); ui_item_size(item, &itemw, &itemh); - minx = MIN2(minx, itemx); - miny = MIN2(miny, itemy); + minx = min_ii(minx, itemx); + miny = min_ii(miny, itemy); - totw = MAX2(totw, itemx + itemw); - toth = MAX2(toth, itemy + itemh); + totw = max_ii(totw, itemx + itemw); + toth = max_ii(toth, itemy + itemh); } totw -= minx; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index a09504fa4b7..2b170ea546b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -814,8 +814,8 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y) pa_sizey = pa->ofsy + get_panel_size_y(pa); } - sizex = MAX2(sizex, pa_sizex); - sizey = MIN2(sizey, pa_sizey); + sizex = max_ii(sizex, pa_sizex); + sizey = min_ii(sizey, pa_sizey); } } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1cdeeb174f6..eb08ba7d92e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -533,10 +533,7 @@ void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct) } else if (ar->drawrct.xmin != ar->drawrct.xmax) { /* partial redraw already set, expand region */ - ar->drawrct.xmin = MIN2(ar->drawrct.xmin, rct->xmin); - ar->drawrct.ymin = MIN2(ar->drawrct.ymin, rct->ymin); - ar->drawrct.xmax = MAX2(ar->drawrct.xmax, rct->xmax); - ar->drawrct.ymax = MAX2(ar->drawrct.ymax, rct->ymax); + BLI_rcti_union(&ar->drawrct, rct); } } } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 711928251ed..cd8a7978fb6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -969,18 +969,18 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller /* if top or down edge selected, test height */ if (sa->v1->flag && sa->v4->flag) - *bigger = MIN2(*bigger, y1); + *bigger = min_ii(*bigger, y1); else if (sa->v2->flag && sa->v3->flag) - *smaller = MIN2(*smaller, y1); + *smaller = min_ii(*smaller, y1); } else { int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX; /* if left or right edge selected, test width */ if (sa->v1->flag && sa->v2->flag) - *bigger = MIN2(*bigger, x1); + *bigger = min_ii(*bigger, x1); else if (sa->v3->flag && sa->v4->flag) - *smaller = MIN2(*smaller, x1); + *smaller = min_ii(*smaller, x1); } } } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 4e236c6c225..5f05c7f8df8 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4032,11 +4032,11 @@ static void *do_projectpaint_thread(void *ph_v) /* end copy */ last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index; - last_partial_redraw_cell->x1 = MIN2(last_partial_redraw_cell->x1, projPixel->x_px); - last_partial_redraw_cell->y1 = MIN2(last_partial_redraw_cell->y1, projPixel->y_px); + last_partial_redraw_cell->x1 = min_ii(last_partial_redraw_cell->x1, (int)projPixel->x_px); + last_partial_redraw_cell->y1 = min_ii(last_partial_redraw_cell->y1, (int)projPixel->y_px); - last_partial_redraw_cell->x2 = MAX2(last_partial_redraw_cell->x2, projPixel->x_px + 1); - last_partial_redraw_cell->y2 = MAX2(last_partial_redraw_cell->y2, projPixel->y_px + 1); + last_partial_redraw_cell->x2 = max_ii(last_partial_redraw_cell->x2, (int)projPixel->x_px + 1); + last_partial_redraw_cell->y2 = max_ii(last_partial_redraw_cell->y2, (int)projPixel->y_px + 1); switch (tool) { diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index cfab2542756..f454b1dbe7d 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -36,8 +36,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" - - #include "BIF_gl.h" #include "BIF_glutil.h" @@ -66,8 +64,8 @@ typedef struct ConsoleDrawContext { static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if (sel[0] <= str_len_draw && sel[1] >= 0) { - int sta = MAX2(sel[0], 0); - int end = MIN2(sel[1], str_len_draw); + int sta = max_ii(sel[0], 0); + int end = min_ii(sel[1], str_len_draw); glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_halftone); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 0aa46a36afe..311cb5ee94d 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -782,7 +782,7 @@ void startConstraint(TransInfo *t) { t->con.mode |= CON_APPLY; *t->con.text = ' '; - t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); + t->num.idx_max = min_ii(getConstraintSpaceDimension(t) - 1, t->idx_max); } void stopConstraint(TransInfo *t) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 995fa15aef3..b2e9af2f143 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2282,10 +2282,10 @@ static int border_apply_rect(wmOperator *op) /* operator arguments and storage. */ - RNA_int_set(op->ptr, "xmin", MIN2(rect->xmin, rect->xmax)); - RNA_int_set(op->ptr, "ymin", MIN2(rect->ymin, rect->ymax)); - RNA_int_set(op->ptr, "xmax", MAX2(rect->xmin, rect->xmax)); - RNA_int_set(op->ptr, "ymax", MAX2(rect->ymin, rect->ymax)); + RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax)); + RNA_int_set(op->ptr, "ymin", min_ii(rect->ymin, rect->ymax)); + RNA_int_set(op->ptr, "xmax", max_ii(rect->xmin, rect->xmax)); + RNA_int_set(op->ptr, "ymax", max_ii(rect->ymin, rect->ymax)); return 1; } |