diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-23 20:21:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-23 20:21:55 +0400 |
commit | fec81d9b56075f46f6dde196ac85140872cff74e (patch) | |
tree | 6ee12fcc0b04ba3041f1b7e4d17281136375beb1 /source/blender/editors | |
parent | c623ba5e4b2aa68a5717ba17500c14217bc417aa (diff) |
use min_ max_ functions in more places.
also fix minor error in MOD decimate when the modifier did nothing the reported face count would be wrong.
Diffstat (limited to 'source/blender/editors')
11 files changed, 30 insertions, 28 deletions
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index dc204909577..cd1a47754f8 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -34,6 +34,7 @@ #include "BLI_utildefines.h" #include "BLI_rect.h" #include "BLI_lasso.h" +#include "BLI_math.h" #include "BKE_context.h" #include "BKE_mask.h" @@ -622,7 +623,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) /* compute ellipse and position in unified coordinates */ ED_mask_get_size(sa, &width, &height); ED_mask_zoom(sa, ar, &zoomx, &zoomy); - width = height = MAX2(width, height); + width = height = max_ii(width, height); ellipse[0] = width * zoomx / radius; ellipse[1] = height * zoomy / radius; diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index fa1b04df05f..262f81abacb 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -505,7 +505,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_RELEASE) break; - cuts = MAX2(cuts - 1, 0); + cuts = max_ii(cuts - 1, 0); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); show_cuts = TRUE; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 740f769b5bc..9dbf9049bfc 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1062,7 +1062,7 @@ static void vgroup_normalize(Object *ob) dw = defvert_find_index(dv, def_nr); if (dw) { - weight_max = MAX2(dw->weight, weight_max); + weight_max = max_ff(dw->weight, weight_max); } } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 5cfe7179f5a..a2f31b35246 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -368,7 +368,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) { /* don't use assign_material, it changed mat->id.us, which shows in the UI */ Material ***matar = give_matarar(base->object); - int actcol = MAX2(base->object->actcol - 1, 0); + int actcol = max_ii(base->object->actcol - 1, 0); if (matar && actcol < base->object->totcol) (*matar)[actcol] = mat; @@ -518,8 +518,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) { - newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx); - newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty); + newrect->xmax = max_ii(newrect->xmax, rect->xmin + rres.rectx + offx); + newrect->ymax = max_ii(newrect->ymax, rect->ymin + rres.recty); if (rres.rectx && rres.recty) { /* temporary conversion to byte for drawing */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index b24681fdb05..4e236c6c225 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -173,7 +173,7 @@ typedef struct ImagePaintState { } ImagePaintState; typedef struct ImagePaintPartialRedraw { - int x1, y1, x2, y2; + int x1, y1, x2, y2; /* XXX, could use 'rcti' */ int enabled; } ImagePaintPartialRedraw; @@ -3583,11 +3583,11 @@ static int partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPar { int touch = 0; while (tot--) { - pr->x1 = MIN2(pr->x1, pr_other->x1); - pr->y1 = MIN2(pr->y1, pr_other->y1); + pr->x1 = min_ii(pr->x1, pr_other->x1); + pr->y1 = min_ii(pr->y1, pr_other->y1); - pr->x2 = MAX2(pr->x2, pr_other->x2); - pr->y2 = MAX2(pr->y2, pr_other->y2); + pr->x2 = max_ii(pr->x2, pr_other->x2); + pr->y2 = max_ii(pr->y2, pr_other->y2); if (pr->x2 != -1) touch = 1; @@ -4222,10 +4222,10 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, imapaintpartial.enabled = 1; } else { - imapaintpartial.x1 = MIN2(imapaintpartial.x1, x); - imapaintpartial.y1 = MIN2(imapaintpartial.y1, y); - imapaintpartial.x2 = MAX2(imapaintpartial.x2, x + w); - imapaintpartial.y2 = MAX2(imapaintpartial.y2, y + h); + imapaintpartial.x1 = min_ii(imapaintpartial.x1, x); + imapaintpartial.y1 = min_ii(imapaintpartial.y1, y); + imapaintpartial.x2 = max_ii(imapaintpartial.x2, x + w); + imapaintpartial.y2 = max_ii(imapaintpartial.y2, y + h); } w = ((x + w - 1) >> IMAPAINT_TILE_BITS); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 68de184f008..ccdbc38936c 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -39,6 +39,7 @@ #include "BLI_string.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BKE_context.h" #include "BKE_text.h" /* only for character utility funcs */ @@ -904,8 +905,8 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op)) for (cl = sc->scrollback.first; cl; cl = cl->next) { if (sel[0] <= cl->len && sel[1] >= 0) { - int sta = MAX2(sel[0], 0); - int end = MIN2(sel[1], cl->len); + int sta = max_ii(sel[0], 0); + int end = min_ii(sel[1], cl->len); if (BLI_dynstr_get_len(buf_dyn)) BLI_dynstr_append(buf_dyn, "\n"); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 636d2f2fc01..c4b46831714 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1240,8 +1240,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* boundbox and selection tests for NOT drawing the strip... */ if ((seq->flag & SELECT) != sel) continue; else if (seq == last_seq) continue; - else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue; - else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue; + else if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) continue; + else if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue; else if (seq->machine + 1.0f < v2d->cur.ymin) continue; else if (seq->machine > v2d->cur.ymax) continue; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c09e0ffaa33..6b71fbe301e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1952,7 +1952,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) while (seq) { next = seq->next; if (seq != seqm && (seq->flag & SELECT)) { - channel_max = MAX2(seq->machine, channel_max); + channel_max = max_ii(seq->machine, channel_max); BLI_remlink(ed->seqbasep, seq); BLI_addtail(&seqm->seqbase, seq); } @@ -2255,11 +2255,11 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { - xmin = MIN2(xmin, seq->startdisp); - xmax = MAX2(xmax, seq->enddisp); + xmin = min_ii(xmin, seq->startdisp); + xmax = max_ii(xmax, seq->enddisp); - ymin = MIN2(ymin, seq->machine); - ymax = MAX2(ymax, seq->machine); + ymin = min_ii(ymin, seq->machine); + ymax = max_ii(ymax, seq->machine); } } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 9755c7d1b7c..f1be0978c06 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1223,7 +1223,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) if (ob == NULL) return; - lim = 10000.0f * MAX2(1.0f, v3d->grid); + lim = 10000.0f * max_ff(1.0f, v3d->grid); block = uiLayoutGetBlock(pa->layout); uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index f7ae082787b..b7cde89bf4d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2868,8 +2868,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw /* clamp small tile sizes to prevent inefficient threading utilization * the same happens for final renders as well */ - engine->tile_x = MAX2(engine->tile_x, 64); - engine->tile_y = MAX2(engine->tile_x, 64); + engine->tile_x = max_ii(engine->tile_x, 64); + engine->tile_y = max_ii(engine->tile_x, 64); type->view_update(engine, C); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 8d34108011a..5b6125b558b 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -3988,7 +3988,7 @@ static void p_smooth(PChart *chart) diff[1] = p[1] - oldp[1]; length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]); - d = MAX2(d, length); + d = max_ff(d, length); moved += length; } } |