diff options
Diffstat (limited to 'source')
94 files changed, 283 insertions, 280 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 43f795eeee5..b6f1b88c912 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1172,7 +1172,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* constrain direction with maximum angular velocity */ angle = saacos(dot_v3v3(old_dir, wanted_dir)); - angle = minf(angle, val.max_ave); + angle = min_ff(angle, val.max_ave); cross_v3_v3v3(nor, old_dir, wanted_dir); axis_angle_to_quat(q, nor, angle); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f618427b9cb..98b206712d6 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -876,8 +876,8 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, /* not sure if it's actually needed or it's a mistake in coords/sizes * calculation in brush_painter_fixed_tex_partial_update(), but without this * limitation memory gets corrupted at fast strokes with quite big spacing (sergey) */ - w = MIN2(w, ibuf->x); - h = MIN2(h, ibuf->y); + w = min_ii(w, ibuf->x); + h = min_ii(h, ibuf->y); if (painter->cache.flt) { for (; y < h; y++) { @@ -1052,13 +1052,13 @@ void BKE_brush_painter_break_stroke(BrushPainter *painter) static void brush_pressure_apply(BrushPainter *painter, Brush *brush, float pressure) { if (BKE_brush_use_alpha_pressure(painter->scene, brush)) - brush_alpha_set(painter->scene, brush, maxf(0.0f, painter->startalpha * pressure)); + brush_alpha_set(painter->scene, brush, max_ff(0.0f, painter->startalpha * pressure)); if (BKE_brush_use_size_pressure(painter->scene, brush)) - BKE_brush_size_set(painter->scene, brush, maxf(1.0f, painter->startsize * pressure)); + BKE_brush_size_set(painter->scene, brush, max_ff(1.0f, painter->startsize * pressure)); if (brush->flag & BRUSH_JITTER_PRESSURE) - brush->jitter = maxf(0.0f, painter->startjitter * pressure); + brush->jitter = max_ff(0.0f, painter->startjitter * pressure); if (brush->flag & BRUSH_SPACING_PRESSURE) - brush->spacing = maxf(1.0f, painter->startspacing * (1.5f - pressure)); + brush->spacing = max_ff(1.0f, painter->startspacing * (1.5f - pressure)); } void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) @@ -1158,7 +1158,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p /* compute brush spacing adapted to brush radius, spacing may depend * on pressure, so update it */ brush_pressure_apply(painter, brush, painter->lastpressure); - spacing = maxf(1.0f, radius) * brush->spacing * 0.01f; + spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f; /* setup starting distance, direction vector and accumulated distance */ startdistance = painter->accumdistance; @@ -1176,7 +1176,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p t = step / len; press = (1.0f - t) * painter->lastpressure + t * pressure; brush_pressure_apply(painter, brush, press); - spacing = maxf(1.0f, radius) * brush->spacing * 0.01f; + spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f; BKE_brush_jitter_pos(scene, brush, paintpos, finalpos); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index ed22ad27811..7a4b3edde47 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -272,7 +272,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM /* Decrease in magnitude of relative tangential velocity due to coulomb friction * in original formula "magrelVel" should be the "change of relative velocity in normal direction" */ - magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); + magtangent = min_ff(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); /* Apply friction impulse. */ if ( magtangent > ALMOST_ZERO ) { diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index a1fa9f85577..0c369a463d5 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -65,10 +65,10 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m cumap->flag = CUMA_DO_CLIP; if (tot == 4) cumap->cur = 3; /* rhms, hack for 'col' curve? */ - clipminx = minf(minx, maxx); - clipminy = minf(miny, maxy); - clipmaxx = maxf(minx, maxx); - clipmaxy = maxf(miny, maxy); + clipminx = min_ff(minx, maxx); + clipminy = min_ff(miny, maxy); + clipmaxx = max_ff(minx, maxx); + clipmaxy = max_ff(miny, maxy); BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy); cumap->clipr = cumap->curr; @@ -160,7 +160,7 @@ void curvemapping_set_black_white_ex(const float black[3], const float white[3], int a; for (a = 0; a < 3; a++) { - const float delta = maxf(white[a] - black[a], 1e-5f); + const float delta = max_ff(white[a] - black[a], 1e-5f); r_bwmul[a] = 1.0f / delta; } } @@ -498,8 +498,8 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr"); for (a = 0; a < cuma->totpoint; a++) { - cuma->mintable = minf(cuma->mintable, cmp[a].x); - cuma->maxtable = maxf(cuma->maxtable, cmp[a].x); + cuma->mintable = min_ff(cuma->mintable, cmp[a].x); + cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x); bezt[a].vec[1][0] = cmp[a].x; bezt[a].vec[1][1] = cmp[a].y; if (cmp[a].flag & CUMA_VECTOR) @@ -690,13 +690,13 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) for (a = 0; a < cuma->totpoint; a++) { if (cmp[a].flag & CUMA_SELECT) { if (cmp[a].x < clipr->xmin) - dx = minf(dx, cmp[a].x - clipr->xmin); + dx = min_ff(dx, cmp[a].x - clipr->xmin); else if (cmp[a].x > clipr->xmax) - dx = maxf(dx, cmp[a].x - clipr->xmax); + dx = max_ff(dx, cmp[a].x - clipr->xmax); if (cmp[a].y < clipr->ymin) - dy = minf(dy, cmp[a].y - clipr->ymin); + dy = min_ff(dy, cmp[a].y - clipr->ymin); else if (cmp[a].y > clipr->ymax) - dy = maxf(dy, cmp[a].y - clipr->ymax); + dy = max_ff(dy, cmp[a].y - clipr->ymax); } } for (a = 0; a < cuma->totpoint; a++) { diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a44f519e8c0..fc0bf9f1291 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3615,7 +3615,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t cross_v3_v3v3(raxis, obvec, tarvec); rangle = dot_v3v3(obvec, tarvec); - rangle = acos(maxf(-1.0f, minf(1.0f, rangle))); + rangle = acos(max_ff(-1.0f, min_ff(1.0f, rangle))); /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 2c8571670b3..82938ed1d39 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -278,7 +278,7 @@ void defvert_normalize_lock_map(MDeformVert *dvert, const char *lock_flags, cons } } - lock_iweight = maxf(0.0f, 1.0f - lock_iweight); + lock_iweight = max_ff(0.0f, 1.0f - lock_iweight); if (tot_weight > 0.0f) { /* paranoid, should be 1.0 but in case of float error clamp anyway */ diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 10c9f30f5ee..e13d05d0a2f 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1386,8 +1386,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba ListBase top_capbase = {NULL, NULL}; for (dlb = dlbev.first; dlb; dlb = dlb->next) { - const float bevfac1 = minf(cu->bevfac1, cu->bevfac2); - const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2); + const float bevfac1 = min_ff(cu->bevfac1, cu->bevfac2); + const float bevfac2 = max_ff(cu->bevfac1, cu->bevfac2); float firstblend = 0.0f, lastblend = 0.0f; int i, start, steps; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0533262666b..ec61311d89e 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -504,8 +504,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]); } else { - xminv = minf(xminv, bezt_first->vec[1][0]); - xmaxv = maxf(xmaxv, bezt_last->vec[1][0]); + xminv = min_ff(xminv, bezt_first->vec[1][0]); + xmaxv = max_ff(xmaxv, bezt_last->vec[1][0]); } } } @@ -521,8 +521,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]); } else { - yminv = minf(yminv, bezt->vec[1][1]); - ymaxv = maxf(ymaxv, bezt->vec[1][1]); + yminv = min_ff(yminv, bezt->vec[1][1]); + ymaxv = max_ff(ymaxv, bezt->vec[1][1]); } foundvert = TRUE; @@ -533,8 +533,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo else if (fcu->fpt) { /* frame range can be directly calculated from end verts */ if (xmin || xmax) { - xminv = minf(xminv, fcu->fpt[0].vec[0]); - xmaxv = maxf(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); + xminv = min_ff(xminv, fcu->fpt[0].vec[0]); + xmaxv = max_ff(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); } /* only loop over keyframes to find extents for values if needed */ @@ -591,15 +591,15 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end, if (bezt_first) { BLI_assert(bezt_last != NULL); - min = minf(min, bezt_first->vec[1][0]); - max = maxf(max, bezt_last->vec[1][0]); + min = min_ff(min, bezt_first->vec[1][0]); + max = max_ff(max, bezt_last->vec[1][0]); foundvert = TRUE; } } else if (fcu->fpt) { - min = minf(min, fcu->fpt[0].vec[0]); - max = maxf(max, fcu->fpt[fcu->totvert - 1].vec[0]); + min = min_ff(min, fcu->fpt[0].vec[0]); + max = max_ff(max, fcu->fpt[fcu->totvert - 1].vec[0]); foundvert = TRUE; } diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index a7805d1f19a..d4634748c71 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -671,7 +671,7 @@ makebreak: yof -= linedist; - maxlen = maxf(maxlen, (xof - tb->x / cu->fsize)); + maxlen = max_ff(maxlen, (xof - tb->x / cu->fsize)); linedata[lnr] = xof - tb->x / cu->fsize; linedata2[lnr] = cnr; linedata3[lnr] = tb->w / cu->fsize; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 182cf313a22..7df5449b1b1 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -691,8 +691,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const if (nu->bp) { step = nu->pntsu * nu->pntsv; - a1 = maxi(a, start); - a2 = mini(a + step, end); + a1 = max_ii(a, start); + a2 = min_ii(a + step, end); if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT); } @@ -700,8 +700,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const step = 3 * nu->pntsu; /* exception because keys prefer to work with complete blocks */ - a1 = maxi(a, start); - a2 = mini(a + step, end); + a1 = max_ii(a, start); + a2 = min_ii(a + step, end); if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE); } @@ -1217,7 +1217,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in remain = step; } - count = mini(remain, estep); + count = min_ii(remain, estep); if (mode == KEY_MODE_BEZTRIPLE) { count += 3 - count % 3; } @@ -1584,7 +1584,7 @@ void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt) fp = kb->data; tot = lt->pntsu * lt->pntsv * lt->pntsw; - tot = mini(kb->totelem, tot); + tot = min_ii(kb->totelem, tot); for (a = 0; a < tot; a++, fp += 3, bp++) { copy_v3_v3(bp->vec, fp); @@ -1656,7 +1656,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) tot = BKE_nurbList_verts_count(nurb); - tot = mini(kb->totelem, tot); + tot = min_ii(kb->totelem, tot); while (nu && tot > 0) { @@ -1724,7 +1724,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me) mvert = me->mvert; fp = kb->data; - tot = mini(kb->totelem, me->totvert); + tot = min_ii(kb->totelem, me->totvert); for (a = 0; a < tot; a++, fp += 3, mvert++) { copy_v3_v3(mvert->co, fp); diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index aa19350c456..da0fb895ec2 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1955,5 +1955,5 @@ void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int coun int BKE_mask_get_duration(Mask *mask) { - return maxi(1, mask->efra - mask->sfra); + return max_ii(1, mask->efra - mask->sfra); } diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 4a8601df0b8..50be5b8a112 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -69,7 +69,7 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh unsigned int i, resol = 1; if (width != 0 && height != 0) { - max_segment = 1.0f / (float)maxi(width, height); + max_segment = 1.0f / (float)max_ii(width, height); } for (i = 0; i < spline->tot_point; i++) { @@ -418,7 +418,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe max_delta = MAX2(max_delta_x, max_delta_y); - buckets_per_side = MIN2(512, 0.9f / max_delta); + buckets_per_side = min_ii(512, 0.9f / max_delta); if (buckets_per_side == 0) { /* happens when some segment fills the whole bounding box across some of dimension */ diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index f1af05a1af1..3561d5db9c0 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -428,7 +428,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) /* width and height of each bucket */ const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / layer->buckets_x; const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / layer->buckets_y; - const float bucket_max_rad = (maxf(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON; + const float bucket_max_rad = (max_ff(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON; const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad; unsigned int *face = &layer->face_array[0][0]; @@ -451,10 +451,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) const float *v2 = cos[face[1]]; const float *v3 = cos[face[2]]; - xmin = minf(v1[0], minf(v2[0], v3[0])); - xmax = maxf(v1[0], maxf(v2[0], v3[0])); - ymin = minf(v1[1], minf(v2[1], v3[1])); - ymax = maxf(v1[1], maxf(v2[1], v3[1])); + xmin = min_ff(v1[0], min_ff(v2[0], v3[0])); + xmax = max_ff(v1[0], max_ff(v2[0], v3[0])); + ymin = min_ff(v1[1], min_ff(v2[1], v3[1])); + ymax = max_ff(v1[1], max_ff(v2[1], v3[1])); } else { const float *v1 = cos[face[0]]; @@ -462,10 +462,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) const float *v3 = cos[face[2]]; const float *v4 = cos[face[3]]; - xmin = minf(v1[0], minf(v2[0], minf(v3[0], v4[0]))); - xmax = maxf(v1[0], maxf(v2[0], maxf(v3[0], v4[0]))); - ymin = minf(v1[1], minf(v2[1], minf(v3[1], v4[1]))); - ymax = maxf(v1[1], maxf(v2[1], maxf(v3[1], v4[1]))); + xmin = min_ff(v1[0], min_ff(v2[0], min_ff(v3[0], v4[0]))); + xmax = max_ff(v1[0], max_ff(v2[0], max_ff(v3[0], v4[0]))); + ymin = min_ff(v1[1], min_ff(v2[1], min_ff(v3[1], v4[1]))); + ymax = max_ff(v1[1], max_ff(v2[1], max_ff(v3[1], v4[1]))); } @@ -560,7 +560,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas const short do_feather) { const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f}; - const float pixel_size = 1.0f / MIN2(width, height); + const float pixel_size = 1.0f / (float)min_ii(width, height); const float asp_xy[2] = {(do_aspect_correct && width > height) ? (float)height / (float)width : 1.0f, (do_aspect_correct && width < height) ? (float)width / (float)height : 1.0f}; @@ -1335,10 +1335,10 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x value -= value_layer; break; case MASK_BLEND_LIGHTEN: - value = maxf(value, value_layer); + value = max_ff(value, value_layer); break; case MASK_BLEND_DARKEN: - value = minf(value, value_layer); + value = min_ff(value, value_layer); break; case MASK_BLEND_MUL: value *= value_layer; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 30eaf461430..26120b771bf 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -735,7 +735,7 @@ float *BKE_mesh_orco_verts_get(Object *ob) /* Get appropriate vertex coordinates */ vcos = MEM_callocN(sizeof(*vcos) * me->totvert, "orco mesh"); mvert = tme->mvert; - totvert = MIN2(tme->totvert, me->totvert); + totvert = min_ii(tme->totvert, me->totvert); for (a = 0; a < totvert; a++, mvert++) { copy_v3_v3(vcos[a], mvert->co); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0fcf1be7e2d..daada283a70 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2710,7 +2710,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob) if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID) == 0) { scene->physics_settings.quick_cache_step = scene->physics_settings.quick_cache_step ? - mini(scene->physics_settings.quick_cache_step, pid->cache->step) : + min_ii(scene->physics_settings.quick_cache_step, pid->cache->step) : pid->cache->step; } } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 70962553c31..790bd49f755 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1353,7 +1353,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f hyp2 = fabsf(angle * x + y + (-(yo - posy * 0.5f) - angle * (xo - posx * 0.5f))) * wipezone->pythangle; } - hwidth = minf(hwidth, fabsf(b3 - b1) / 2.0f); + hwidth = min_ff(hwidth, fabsf(b3 - b1) / 2.0f); if (b2 < b1 && b2 < b3) { output = in_band(hwidth, hyp, 0, 1); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 7d504875567..e52fa3498a9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -507,8 +507,8 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase * since sound is played outside of evaluating the imbufs, */ for (seq = metaseq->seqbase.first; seq; seq = seq->next) { if (seq->type == SEQ_TYPE_META) { - seq_update_sound_bounds_recursive_rec(scene, seq, maxi(start, metaseq_start(seq)), - mini(end, metaseq_end(seq))); + seq_update_sound_bounds_recursive_rec(scene, seq, max_ii(start, metaseq_start(seq)), + min_ii(end, metaseq_end(seq))); } else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { if (seq->scene_sound) { @@ -3195,7 +3195,7 @@ int BKE_sequence_tx_get_final_left(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return maxi(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE)); + return max_ii(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE)); } else { return (seq->start - seq->startstill) + seq->startofs; @@ -3206,7 +3206,7 @@ int BKE_sequence_tx_get_final_right(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return mini(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE)); + return min_ii(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE)); } else { return ((seq->start + seq->len) + seq->endstill) - seq->endofs; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 0d304482060..4fcaed66f6b 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -997,8 +997,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) if (event == CLAMP_PAT_DIM) { for (a = 0; a < 2; a++) { /* search shouldn't be resized smaller than pattern */ - marker->search_min[a] = minf(pat_min[a], marker->search_min[a]); - marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]); + marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]); + marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]); } } else if (event == CLAMP_PAT_POS) { @@ -1022,8 +1022,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) else if (event == CLAMP_SEARCH_DIM) { for (a = 0; a < 2; a++) { /* search shouldn't be resized smaller than pattern */ - marker->search_min[a] = minf(pat_min[a], marker->search_min[a]); - marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]); + marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]); + marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]); } } else if (event == CLAMP_SEARCH_POS) { @@ -2345,10 +2345,10 @@ static int tracking_check_marker_margin(MovieTrackingTrack *track, MovieTracking /* margin from frame boundaries */ BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max); sub_v2_v2v2(dim, pat_max, pat_min); - margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f; + margin[0] = margin[1] = max_ff(dim[0], dim[1]) / 2.0f; - margin[0] = maxf(margin[0], (float)track->margin / frame_width); - margin[1] = maxf(margin[1], (float)track->margin / frame_height); + margin[0] = max_ff(margin[0], (float)track->margin / frame_width); + margin[1] = max_ff(margin[1], (float)track->margin / frame_height); /* do not track markers which are too close to boundary */ if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] || @@ -3275,7 +3275,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i S = (-w * I - h * J) / (dx * I + dy * J + K); - scale = maxf(scale, S); + scale = max_ff(scale, S); } } } @@ -3284,7 +3284,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i stab->scale = scale; if (stab->maxscale > 0.0f) - stab->scale = minf(stab->scale, stab->maxscale); + stab->scale = min_ff(stab->scale, stab->maxscale); } else { stab->scale = 1.0f; diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 6ee1498c855..2b513cbec41 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -188,8 +188,11 @@ MINLINE float sasqrt(float fac); MINLINE float interpf(float a, float b, float t); -MINLINE float minf(float a, float b); -MINLINE float maxf(float a, float b); +MINLINE float min_ff(float a, float b); +MINLINE float max_ff(float a, float b); + +MINLINE int min_ii(int a, int b); +MINLINE int max_ii(int a, int b); MINLINE float signf(float f); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 414612dcce5..4dea8022083 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -648,7 +648,7 @@ static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index /* This functions returns the number of branches needed to have the requested number of leafs. */ static int implicit_needed_branches(int tree_type, int leafs) { - return maxi(1, (leafs + tree_type - 3) / (tree_type - 1) ); + return max_ii(1, (leafs + tree_type - 3) / (tree_type - 1) ); } /* diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 2e9f5c151c5..8a97fdcab67 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -96,7 +96,7 @@ typedef struct BoxVert { BOXTOP(b1) - EPSILON <= BOXBOTTOM(b2)) /* compiler should inline */ -static float maxf(const float a, const float b) { return b > a ? b : a; } +static float max_ff(const float a, const float b) { return b > a ? b : a; } #if 0 #define BOXDEBUG(b) \ @@ -133,8 +133,8 @@ static int vertex_sort(const void *p1, const void *p2) v1 = vertarray + ((int *)p1)[0]; v2 = vertarray + ((int *)p2)[0]; - a1 = maxf(v1->x + box_width, v1->y + box_height); - a2 = maxf(v2->x + box_width, v2->y + box_height); + a1 = max_ff(v1->x + box_width, v1->y + box_height); + a2 = max_ff(v2->x + box_width, v2->y + box_height); /* sort largest to smallest */ if (a1 > a2) return 1; @@ -314,8 +314,8 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float * if (!isect) { /* maintain the total width and height */ - (*tot_width) = maxf(BOXRIGHT(box), (*tot_width)); - (*tot_height) = maxf(BOXTOP(box), (*tot_height)); + (*tot_width) = max_ff(BOXRIGHT(box), (*tot_width)); + (*tot_height) = max_ff(BOXTOP(box), (*tot_height)); /* Place the box */ vert->free &= ~quad_flags[j]; diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 018d64b86a7..0a87316aa81 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -271,7 +271,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf (len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > - maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), + max_ff(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2])))) { bezt->h1 = bezt->h2 = HD_ALIGN; diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 21ecfccf9d9..f27da759482 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -139,20 +139,20 @@ MINLINE int power_of_2_min_i(int n) return n; } -MINLINE float minf(float a, float b) +MINLINE float min_ff(float a, float b) { return (a < b) ? a : b; } -MINLINE float maxf(float a, float b) +MINLINE float max_ff(float a, float b) { return (a > b) ? a : b; } -MINLINE int mini(int a, int b) +MINLINE int min_ii(int a, int b) { return (a < b) ? a : b; } -MINLINE int maxi(int a, int b) +MINLINE int max_ii(int a, int b) { return (b < a) ? a : b; } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 122fc8e9f4a..1d59f55a04b 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -404,8 +404,8 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[ if (u > u2) SWAP(float, u, u2); if (u > 1.0f + eps || u2 < -eps) return -1; /* non-ovlerlapping segments */ - else if (maxf(0.0f, u) == minf(1.0f, u2)) { /* one common point: can return result */ - interp_v2_v2v2(vi, v1, v2, maxf(0, u)); + else if (max_ff(0.0f, u) == min_ff(1.0f, u2)) { /* one common point: can return result */ + interp_v2_v2v2(vi, v1, v2, max_ff(0, u)); return 1; } } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 3e19ea4f999..f4a65564fd4 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1400,7 +1400,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) int m = 4; int n = 4; int maxiter = 200; - int nu = minf(m, n); + int nu = min_ff(m, n); float *work = work1; float *e = work2; @@ -1411,14 +1411,14 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) /* Reduce A to bidiagonal form, storing the diagonal elements * in s and the super-diagonal elements in e. */ - int nct = minf(m - 1, n); - int nrt = maxf(0, minf(n - 2, m)); + int nct = min_ff(m - 1, n); + int nrt = max_ff(0, min_ff(n - 2, m)); copy_m4_m4(A, A_); zero_m4(U); zero_v4(s); - for (k = 0; k < maxf(nct, nrt); k++) { + for (k = 0; k < max_ff(nct, nrt); k++) { if (k < nct) { /* Compute the transformation for the k-th column and @@ -1522,7 +1522,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) /* Set up the final bidiagonal matrix or order p. */ - p = minf(n, m + 1); + p = min_ff(n, m + 1); if (nct < n) { s[nct] = A[nct][nct]; } @@ -1714,7 +1714,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) /* Calculate the shift. */ - float scale = maxf(maxf(maxf(maxf( + float scale = max_ff(max_ff(max_ff(max_ff( fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])), fabsf(s[k])), fabsf(e[k])); float invscale = 1.0f / scale; diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 2ac84062d0c..7637c60ec16 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -191,8 +191,8 @@ static void BB_expand(BB *bb, float co[3]) { int i; for (i = 0; i < 3; ++i) { - bb->bmin[i] = minf(bb->bmin[i], co[i]); - bb->bmax[i] = maxf(bb->bmax[i], co[i]); + bb->bmin[i] = min_ff(bb->bmin[i], co[i]); + bb->bmax[i] = max_ff(bb->bmax[i], co[i]); } } @@ -201,8 +201,8 @@ static void BB_expand_with_bb(BB *bb, BB *bb2) { int i; for (i = 0; i < 3; ++i) { - bb->bmin[i] = minf(bb->bmin[i], bb2->bmin[i]); - bb->bmax[i] = maxf(bb->bmax[i], bb2->bmax[i]); + bb->bmin[i] = min_ff(bb->bmin[i], bb2->bmin[i]); + bb->bmax[i] = max_ff(bb->bmax[i], bb2->bmax[i]); } } @@ -665,7 +665,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, bvh->totgrid = totgrid; bvh->gridkey = *key; bvh->grid_hidden = grid_hidden; - bvh->leaf_limit = maxi(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1); + bvh->leaf_limit = max_ii(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1); BB_reset(&cb); diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 2c5e05197ed..8a5e8c292e4 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -661,8 +661,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) /* this happens with a serial of overlapping edges */ if (v1 == v2 || v2 == v3) break; /* printf("test verts %x %x %x\n",v1,v2,v3); */ - miny = minf(v1->xy[1], v3->xy[1]); - /* miny = minf(v1->xy[1],v3->xy[1]); */ + miny = min_ff(v1->xy[1], v3->xy[1]); + /* miny = min_ff(v1->xy[1],v3->xy[1]); */ sc1 = sc + 1; test = 0; diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c index 3030e54eb78..1a55dd26ce0 100644 --- a/source/blender/blenlib/intern/voronoi.c +++ b/source/blender/blenlib/intern/voronoi.c @@ -259,9 +259,9 @@ static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, f x2 = (-b - sqrtf(disc)) / (2 * a); if (p[1] < r[1]) - ry = maxf(x1, x2); + ry = max_ff(x1, x2); else - ry = minf(x1, x2); + ry = min_ff(x1, x2); return ry; } diff --git a/source/blender/bmesh/intern/bmesh_decimate_dissolve.c b/source/blender/bmesh/intern/bmesh_decimate_dissolve.c index 26cf174dd15..91eac527047 100644 --- a/source/blender/bmesh/intern/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/intern/bmesh_decimate_dissolve.c @@ -77,7 +77,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int BMEdge **einput_arr, const int einput_len) { const float angle_max = (float)M_PI / 2.0f; - DissolveElemWeight *weight_elems = MEM_mallocN(maxi(einput_len, vinput_len) * + DissolveElemWeight *weight_elems = MEM_mallocN(max_ii(einput_len, vinput_len) * sizeof(DissolveElemWeight), __func__); int i, tot_found; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index b3e4e896c3e..7ca43d9ba80 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -257,7 +257,7 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int f1 = fabsf(f1); f2 = fabsf(f2); - f1 = minf(f1, f2); + f1 = min_ff(f1, f2); CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON); } else { diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index eb2b7721bdc..bd0f93ee7aa 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -507,8 +507,8 @@ static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3 #define GETMIN2_AXIS(a, b, ma, mb, axis) \ { \ - ma[axis] = minf(a[axis], b[axis]); \ - mb[axis] = maxf(a[axis], b[axis]); \ + ma[axis] = min_ff(a[axis], b[axis]); \ + mb[axis] = max_ff(a[axis], b[axis]); \ } (void)0 #define GETMIN2(a, b, ma, mb) \ @@ -994,8 +994,8 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len) for (i = 0, l = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l = l->next) { p1 = projverts[i]; - out[0] = maxf(out[0], p1[0]); - out[1] = maxf(out[1], p1[1]); + out[0] = max_ff(out[0], p1[0]); + out[1] = max_ff(out[1], p1[1]); /* out[2] = 0.0f; */ /* keep at zero */ p1[2] = 0.0f; diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index e31df2e4444..c5120571755 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -126,7 +126,7 @@ static void calc_corner_co(BMLoop *l, const float fac, float r_co[3], * gives nicer, move even output. * * Use the minimum rather then the middle value so skinny faces don't flip along the short axis */ - float min_fac = minf(normalize_v3(l_vec_prev), normalize_v3(l_vec_next)); + float min_fac = min_ff(normalize_v3(l_vec_prev), normalize_v3(l_vec_next)); float angle; if (do_even) { diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index fde475c2d6a..ebd848ff8b2 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -425,8 +425,8 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) /* merge loops of bridge faces */ if (use_merge) { - const int vert_len = mini(BLI_array_count(vv1), BLI_array_count(vv2)) - ((cl1 || cl2) ? 1 : 0); - const int edge_len = mini(BLI_array_count(ee1), BLI_array_count(ee2)); + const int vert_len = min_ii(BLI_array_count(vv1), BLI_array_count(vv2)) - ((cl1 || cl2) ? 1 : 0); + const int edge_len = min_ii(BLI_array_count(ee1), BLI_array_count(ee2)); if (merge_factor <= 0.0f) { /* 2 --> 1 */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index ce6ecfc7b6f..9addb1b1657 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -482,7 +482,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) BMOpSlot *einput = BMO_slot_get(op, "edges"); BMOpSlot *vinput = BMO_slot_get(op, "verts"); const float angle_max = (float)M_PI / 2.0f; - const float angle_limit = minf(angle_max, BMO_slot_float_get(op, "angle_limit")); + const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op, "angle_limit")); const int do_dissolve_boundaries = BMO_slot_bool_get(op, "use_dissolve_boundaries"); BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries, diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.c b/source/blender/bmesh/operators/bmo_unsubdivide.c index 75f886856dc..3d44feac380 100644 --- a/source/blender/bmesh/operators/bmo_unsubdivide.c +++ b/source/blender/bmesh/operators/bmo_unsubdivide.c @@ -39,7 +39,7 @@ void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op) BMVert *v; BMIter iter; - const int iterations = maxi(1, BMO_slot_int_get(op, "iterations")); + const int iterations = max_ii(1, BMO_slot_int_get(op, "iterations")); BMOpSlot *vinput = BMO_slot_get(op, "verts"); BMVert **vinput_arr = (BMVert **)vinput->data.p; diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 31608c88274..1723da11f21 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -92,8 +92,8 @@ void DisplaceOperation::executePixel(float output[4], int x, int y, void *data) dxt = p_dx - d_dx; dyt = p_dy - d_dy; - dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth(); - dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight(); + dxt = signf(dxt) * max_ff(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth(); + dyt = signf(dyt) * max_ff(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight(); /* EWA filtering (without nearest it gets blurry with NO distortion) */ this->m_inputColorProgram->read(output, u, v, dxt, dyt, COM_PS_NEAREST); diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp index 70d4d987c81..81ca06cfff0 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cpp +++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp @@ -133,9 +133,9 @@ void InpaintSimpleOperation::calc_manhatten_distance() if (this->get_pixel(i, j)[3] < 1.0f) { r = width + height; if (i > 0) - r = mini(r, m[j * width + i - 1] + 1); + r = min_ii(r, m[j * width + i - 1] + 1); if (j > 0) - r = mini(r, m[(j - 1) * width + i] + 1); + r = min_ii(r, m[(j - 1) * width + i] + 1); } m[j * width + i] = r; } @@ -146,9 +146,9 @@ void InpaintSimpleOperation::calc_manhatten_distance() int r = m[j * width + i]; if (i + 1 < width) - r = mini(r, m[j * width + i + 1] + 1); + r = min_ii(r, m[j * width + i + 1] + 1); if (j + 1 < height) - r = mini(r, m[(j + 1) * width + i] + 1); + r = min_ii(r, m[(j + 1) * width + i] + 1); m[j * width + i] = r; diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index d92fe04eb15..00e35f2c9d8 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -104,7 +104,7 @@ void ProjectorLensDistortionOperation::updateDispersion() float result[4]; this->getInputSocketReader(1)->read(result, 1, 1, COM_PS_NEAREST); this->m_dispersion = result[0]; - this->m_kr = 0.25f * maxf(minf(this->m_dispersion, 1.0f), 0.0f); + this->m_kr = 0.25f * max_ff(min_ff(this->m_dispersion, 1.0f), 0.0f); this->m_kr2 = this->m_kr * 20; this->m_dispersionAvailable = true; } diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index b65444108bc..d2c6c833e2e 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -268,11 +268,11 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) { - this->m_kg = maxf(minf(distortion, 1.0f), -0.999f); + this->m_kg = max_ff(min_ff(distortion, 1.0f), -0.999f); // smaller dispersion range for somewhat more control - const float d = 0.25f * maxf(minf(dispersion, 1.0f), 0.0f); - this->m_kr = maxf(minf((this->m_kg + d), 1.0f), -0.999f); - this->m_kb = maxf(minf((this->m_kg - d), 1.0f), -0.999f); + const float d = 0.25f * max_ff(min_ff(dispersion, 1.0f), 0.0f); + this->m_kr = max_ff(min_ff((this->m_kg + d), 1.0f), -0.999f); + this->m_kb = max_ff(min_ff((this->m_kg - d), 1.0f), -0.999f); this->m_maxk = MAX3(this->m_kr, this->m_kg, this->m_kb); this->m_sc = (this->m_data->fit && (this->m_maxk > 0.0f)) ? (1.0f / (1.0f + 2.0f * this->m_maxk)) : (1.0f / (1.0f + this->m_maxk)); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 0f1d48ff8af..51b7a3aa984 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -563,7 +563,7 @@ static void heat_set_H(LaplacianSystem *sys, int vertex) /* compute H entry */ if (numclosest > 0) { - mindist = maxf(mindist, 1e-4f); + mindist = max_ff(mindist, 1e-4f); h = numclosest * C_WEIGHT / (mindist * mindist); } else diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index beb57b44248..6374314e4bb 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -238,7 +238,7 @@ static void ui_text_bounds_block(uiBlock *block, float offset) bt->rect.xmax = bt->rect.xmin + i + block->bounds; if (col == lastcol) { - bt->rect.xmax = maxf(bt->rect.xmax, offset + block->minbounds); + bt->rect.xmax = max_ff(bt->rect.xmax, offset + block->minbounds); } ui_check_but(bt); /* clips text again */ @@ -275,7 +275,7 @@ void ui_bounds_block(uiBlock *block) block->rect.ymax += block->bounds; } - block->rect.xmax = block->rect.xmin + maxf(BLI_rctf_size_x(&block->rect), block->minbounds); + block->rect.xmax = block->rect.xmin + max_ff(BLI_rctf_size_x(&block->rect), block->minbounds); /* hardcoded exception... but that one is annoying with larger safety */ bt = block->buttons.first; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 426daa69272..a73954e2075 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -161,12 +161,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - coltop[0] = minf(1.0f, color[0] + shadetop); - coltop[1] = minf(1.0f, color[1] + shadetop); - coltop[2] = minf(1.0f, color[2] + shadetop); - coldown[0] = maxf(0.0f, color[0] + shadedown); - coldown[1] = maxf(0.0f, color[1] + shadedown); - coldown[2] = maxf(0.0f, color[2] + shadedown); + coltop[0] = min_ff(1.0f, color[0] + shadetop); + coltop[1] = min_ff(1.0f, color[1] + shadetop); + coltop[2] = min_ff(1.0f, color[2] + shadetop); + coldown[0] = max_ff(0.0f, color[0] + shadedown); + coldown[1] = max_ff(0.0f, color[1] + shadedown); + coldown[2] = max_ff(0.0f, color[2] + shadedown); glShadeModel(GL_SMOOTH); glBegin(mode); @@ -270,12 +270,12 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - colLeft[0] = minf(1.0f, color[0] + shadeLeft); - colLeft[1] = minf(1.0f, color[1] + shadeLeft); - colLeft[2] = minf(1.0f, color[2] + shadeLeft); - colRight[0] = maxf(0.0f, color[0] + shadeRight); - colRight[1] = maxf(0.0f, color[1] + shadeRight); - colRight[2] = maxf(0.0f, color[2] + shadeRight); + colLeft[0] = min_ff(1.0f, color[0] + shadeLeft); + colLeft[1] = min_ff(1.0f, color[1] + shadeLeft); + colLeft[2] = min_ff(1.0f, color[2] + shadeLeft); + colRight[0] = max_ff(0.0f, color[0] + shadeRight); + colRight[1] = max_ff(0.0f, color[1] + shadeRight); + colRight[2] = max_ff(0.0f, color[2] + shadeRight); glShadeModel(GL_SMOOTH); glBegin(mode); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 445182fb325..dc7ea930e45 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3460,7 +3460,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float data->ungrab_mval[0] = mx_fl; data->ungrab_mval[1] = my_fl; { /* clamp */ - const float radius = minf(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f; + const float radius = min_ff(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f; const float cent[2] = {BLI_rctf_cent_x(&but->rect), BLI_rctf_cent_y(&but->rect)}; const float len = len_v2v2(cent, data->ungrab_mval); if (len > radius) { @@ -4008,7 +4008,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx } else { /* scale histogram values (dy / 10 for better control) */ - const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; + const float yfac = min_ff(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; hist->ymax += (dy * 0.1f) * yfac; /* 0.1 allows us to see HDR colors up to 10 */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d1dee74c1b1..a09504fa4b7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -831,7 +831,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) float fac; fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME; - fac = minf(sqrt(fac), 1.0f); + fac = min_ff(sqrt(fac), 1.0f); /* for max 1 second, interpolate positions */ if (uiAlignPanelStep(sa, ar, fac, 0)) { diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index b9036db74a1..afa8c9051b2 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2396,7 +2396,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * on the first item */ offset[0] = 0; for (bt = block->buttons.first; bt; bt = bt->next) - offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); + offset[0] = min_ii(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); offset[1] = 1.5 * UI_UNIT_Y; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index f793d71458e..e79c311c3ee 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -345,7 +345,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; - minsize = mini(BLI_rcti_size_x(rect) * hnum, + minsize = min_ii(BLI_rcti_size_x(rect) * hnum, BLI_rcti_size_y(rect) * vnum); if (2.0f * rad > minsize) @@ -491,7 +491,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); + minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -526,7 +526,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); + minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -1895,7 +1895,7 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec /* duplication of code... well, simple is better now */ const float centx = BLI_rcti_cent_x_fl(rect); const float centy = BLI_rcti_cent_y_fl(rect); - const float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; + const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; const float m_delta[2] = {mx - centx, my - centy}; const float dist_squared = len_squared_v2(m_delta); @@ -1910,7 +1910,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * const float centx = BLI_rcti_cent_x_fl(rect); const float centy = BLI_rcti_cent_y_fl(rect); - float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; + float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; /* gouraud triangle fan */ const float *hsv_ptr = ui_block_hsv_get(but->block); @@ -2423,7 +2423,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat if (rect1.xmax > rect->xmax) { rect1.xmax = rect->xmax; - rect1.xmin = maxi(rect1.xmax - min, rect->xmin); + rect1.xmin = max_ii(rect1.xmax - min, rect->xmin); } } } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 87da31ceaee..48a1f8bf0f3 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1243,16 +1243,16 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) for (i = 0; i < 2; i++) { /* axis translation normalized to scale */ - tfac = fabsf(cent_a[i] - cent_b[i]) / minf(size_a[i], size_b[i]); - fac_max = maxf(fac_max, tfac); + tfac = fabsf(cent_a[i] - cent_b[i]) / min_ff(size_a[i], size_b[i]); + fac_max = max_ff(fac_max, tfac); if (fac_max >= 1.0f) break; /* axis scale difference, x2 so doubling or half gives 1.0f */ - tfac = (1.0f - (minf(size_a[i], size_b[i]) / maxf(size_a[i], size_b[i]))) * 2.0f; - fac_max = maxf(fac_max, tfac); + tfac = (1.0f - (min_ff(size_a[i], size_b[i]) / max_ff(size_a[i], size_b[i]))) * 2.0f; + fac_max = max_ff(fac_max, tfac); if (fac_max >= 1.0f) break; } - return minf(fac_max, 1.0f); + return min_ff(fac_max, 1.0f); } /* will start timer if appropriate */ diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 490389c6d0c..1c23df1c11e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -408,7 +408,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline const short is_active, int width, int height) { - const unsigned int resol = maxi(BKE_mask_spline_feather_resolution(spline, width, height), + const unsigned int resol = max_ii(BKE_mask_spline_feather_resolution(spline, width, height), BKE_mask_spline_resolution(spline, width, height)); unsigned char rgb_tmp[4]; @@ -579,7 +579,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, y += v2d->tot.ymin * zoomy; /* frame the image */ - maxdim = maxf(width, height); + maxdim = max_ff(width, height); if (width == height) { xofs = yofs = 0; } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1d19d35ca34..7cc725118ee 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1506,7 +1506,7 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize) if (density < 1.0f) density = 1.0f; - return minf(maxsize / (density * 0.5f), maxsize); + return min_ff(maxsize / (density * 0.5f), maxsize); } /* p is closest point on edge to the mouse cursor */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0bbd9c7fbaf..90a7e2fe0ea 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2712,21 +2712,21 @@ static float bm_edge_seg_isect(const float sco_a[2], const float sco_b[2], m1 = MAXSLOPE; b1 = x12; } - x2max = maxf(x21, x22) + 0.001f; /* prevent missed edges */ - x2min = minf(x21, x22) - 0.001f; /* due to round off error */ - y2max = maxf(y21, y22) + 0.001f; - y2min = minf(y21, y22) - 0.001f; + x2max = max_ff(x21, x22) + 0.001f; /* prevent missed edges */ + x2min = min_ff(x21, x22) - 0.001f; /* due to round off error */ + y2max = max_ff(y21, y22) + 0.001f; + y2min = min_ff(y21, y22) - 0.001f; /* Found an intersect, calc intersect point */ if (m1 == m2) { /* co-incident lines */ /* cut at 50% of overlap area */ - x1max = maxf(x11, x12); - x1min = minf(x11, x12); - xi = (minf(x2max, x1max) + maxf(x2min, x1min)) / 2.0f; + x1max = max_ff(x11, x12); + x1min = min_ff(x11, x12); + xi = (min_ff(x2max, x1max) + max_ff(x2min, x1min)) / 2.0f; - y1max = maxf(y11, y12); - y1min = minf(y11, y12); - yi = (minf(y2max, y1max) + maxf(y2min, y1min)) / 2.0f; + y1max = max_ff(y11, y12); + y1min = min_ff(y11, y12); + yi = (min_ff(y2max, y1max) + max_ff(y2min, y1min)) / 2.0f; } else if (m2 == MAXSLOPE) { xi = x22; @@ -5150,7 +5150,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event) if (handleNumInput(&opdata->num_input, event)) { applyNumInput(&opdata->num_input, amounts); - amounts[0] = maxf(amounts[0], 0.0f); + amounts[0] = max_ff(amounts[0], 0.0f); RNA_float_set(op->ptr, "thickness", amounts[0]); RNA_float_set(op->ptr, "depth", amounts[1]); @@ -5191,7 +5191,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event) if (opdata->modify_depth) RNA_float_set(op->ptr, "depth", amount); else { - amount = maxf(amount, 0.0f); + amount = max_ff(amount, 0.0f); RNA_float_set(op->ptr, "thickness", amount); } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3b505f24d2d..f8ec51c7a7c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3529,7 +3529,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) view3d_operator_needs_opengl(C); selected= (short)count_selected_keys(scene, edit); - dmax = maxf(fabsf(dx), fabsf(dy)); + dmax = max_ff(fabsf(dx), fabsf(dy)); tot_steps = dmax/(0.2f * brush->size) + 1; dx /= (float)tot_steps; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 24053d76672..c1811adf2d8 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -625,8 +625,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo * covers the entire screen). */ glGetFloatv(GL_SCISSOR_BOX, scissor); - draw_w = mini(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom)); - draw_h = mini(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); + draw_w = min_ii(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom)); + draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); if (draw_w > 0 && draw_h > 0) { int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 058b8bb4827..b24681fdb05 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5302,7 +5302,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT)); if (use_zoom) { - pixel_size = size * maxf(zoomx, zoomy); + pixel_size = size * max_ff(zoomx, zoomy); } else { pixel_size = size; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index c6df3a057bd..6396a0c2cbc 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -255,7 +255,7 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const if (pressure > FLT_EPSILON) { /* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel * causing very high step sizes, hanging blender [#32381] */ - const float size_clamp = maxf(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure); + const float size_clamp = max_ff(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure); scale = (size_clamp * stroke->brush->spacing / 50.0f) / length; if (scale > FLT_EPSILON) { mul_v2_fl(vec, scale); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d7936c1e2e8..fc9c040852f 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -716,7 +716,7 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker) cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); - len = minf(cur_len, len); + len = min_ff(cur_len, len); } return len; @@ -788,11 +788,11 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo dy = 6.0f / height / sc->zoom; side = get_shortest_pattern_side(marker); - patdx = minf(dx * 2.0f / 3.0f, side / 6.0f); - patdy = minf(dy * 2.0f / 3.0f, side * width / height / 6.0f); + patdx = min_ff(dx * 2.0f / 3.0f, side / 6.0f); + patdy = min_ff(dy * 2.0f / 3.0f, side * width / height / 6.0f); - searchdx = minf(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f); - searchdy = minf(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f); + searchdx = min_ff(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f); + searchdy = min_ff(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f); px[0] = 1.0f / sc->zoom / width / sc->scale; px[1] = 1.0f / sc->zoom / height / sc->scale; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index b495ca32813..71589517c83 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -395,7 +395,7 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit) zoomx = (float)width / w / aspx; zoomy = (float)height / h / aspy; - newzoom = 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)); + newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)); if (fit || sc->zoom > newzoom) sc->zoom = newzoom; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 37eb0bcb7c1..1a9cae93a38 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -747,7 +747,7 @@ static int view_all_exec(bContext *C, wmOperator *op) zoomx = (float) width / (w + 2 * margin); zoomy = (float) height / (h + 2 * margin); - sclip_zoom_set(C, minf(zoomx, zoomy), NULL); + sclip_zoom_set(C, min_ff(zoomx, zoomy), NULL); } else { if ((w >= width || h >= height) && (width > 0 && height > 0)) { @@ -755,7 +755,7 @@ static int view_all_exec(bContext *C, wmOperator *op) zoomy = (float) height / h; /* find the zoom value that will fit the image in the image space */ - sclip_zoom_set(C, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL); + sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL); } else sclip_zoom_set(C, 1.0f, NULL); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index c061125b4d5..521b1383db8 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -372,8 +372,8 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker, dx = size / width / sc->zoom; dy = size / height / sc->zoom; - dx = minf(dx, (max[0] - min[0]) / 6.0f); - dy = minf(dy, (max[1] - min[1]) / 6.0f); + dx = min_ff(dx, (max[0] - min[0]) / 6.0f); + dy = min_ff(dy, (max[1] - min[1]) / 6.0f); return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) && IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy); @@ -424,14 +424,14 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker, cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); - len = minf(cur_len, len); + len = min_ff(cur_len, len); } dx = 12.0f / width / sc->zoom; dy = 12.0f / height / sc->zoom; - dx = minf(dx, len * 2.0f / 3.0f); - dy = minf(dy, len * width / height * 2.0f / 3.0f); + dx = min_ff(dx, len * 2.0f / 3.0f); + dy = min_ff(dy, len * width / height * 2.0f / 3.0f); for (i = 0; i < 4; i++) { float crn[2]; @@ -462,8 +462,8 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki dx = 12.0f / width / sc->zoom; dy = 12.0f / height / sc->zoom; - dx = minf(dx, (pat_max[0] - pat_min[0]) / 2.0f); - dy = minf(dy, (pat_max[1] - pat_min[1]) / 2.0f); + dx = min_ff(dx, (pat_max[0] - pat_min[0]) / 2.0f); + dy = min_ff(dy, (pat_max[1] - pat_min[1]) / 2.0f); return co[0] >= pos[0] - dx && co[0] <= pos[0] + dx && co[1] >= pos[1] - dy && co[1] <= pos[1] + dy; } diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index feb523237ba..b8e162bfb17 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -107,7 +107,7 @@ static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx { float dist = dist_to_crns(co, pos, crns); - return dist < maxf(epsx, epsy); + return dist < max_ff(epsx, epsy); } static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track) @@ -128,8 +128,8 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack * epsy = MIN4(pat_min[1] - marker->search_min[1], marker->search_max[1] - pat_max[1], fabsf(pat_min[1]), fabsf(pat_max[1])) / 2; - epsx = maxf(epsx, 2.0f / width); - epsy = maxf(epsy, 2.0f / height); + epsx = max_ff(epsx, 2.0f / width); + epsy = max_ff(epsy, 2.0f / height); if (sc->flag & SC_SHOW_MARKER_SEARCH) { if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy)) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index df8ef6cc750..512e8d97540 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -599,7 +599,7 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op)) /* find the zoom value that will fit the image in the image space */ zoomx = width / w; zoomy = height / h; - sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL); + sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL); } else sima_zoom_set(sima, ar, 1.0f, NULL); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 945ec1d4a1b..92956b7aa5b 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -266,8 +266,8 @@ static void get_nlastrip_extents(bAnimContext *ac, float *min, float *max, const /* only consider selected strips? */ if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) { /* extend range if appropriate */ - *min = minf(*min, strip->start); - *max = maxf(*max, strip->end); + *min = min_ff(*min, strip->start); + *max = max_ff(*max, strip->end); } } } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 074e9c29152..39f0a49e1d2 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -834,7 +834,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))), - mini((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); + min_ii((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr); uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL); uiBlockLayoutResolve(gnode->block, NULL, NULL); @@ -3226,7 +3226,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode) float zoomx, zoomy; zoomx = (float)sa->winx / ibuf->x; zoomy = (float)sa->winy / ibuf->y; - zoom = minf(zoomx, zoomy); + zoom = min_ff(zoomx, zoomy); } x = (sa->winx - zoom * ibuf->x) / 2 + snode->xof; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 6b201e94c35..20afbf7ce65 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -391,7 +391,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) node->totr.xmin = locx; node->totr.xmax = locx + node->width; node->totr.ymax = locy; - node->totr.ymin = minf(dy, locy - 2 * NODE_DY); + node->totr.ymin = min_ff(dy, locy - 2 * NODE_DY); /* Set the block bounds to clip mouse events from underlying nodes. * Add a margin for sockets on each side. diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index adfc3d07af2..636d2f2fc01 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1189,7 +1189,7 @@ static void draw_seq_backdrop(View2D *v2d) glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); /* Alternating horizontal stripes */ - i = maxi(1, ((int)v2d->cur.ymin) - 1); + i = max_ii(1, ((int)v2d->cur.ymin) - 1); glBegin(GL_QUADS); while (i < v2d->cur.ymax) { @@ -1208,7 +1208,7 @@ static void draw_seq_backdrop(View2D *v2d) glEnd(); /* Darker lines separating the horizontal bands */ - i = maxi(1, ((int)v2d->cur.ymin) - 1); + i = max_ii(1, ((int)v2d->cur.ymin) - 1); UI_ThemeColor(TH_GRID); glBegin(GL_LINES); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 9de91322714..c09e0ffaa33 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2129,7 +2129,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) zoomY = ((float)height) / ((float)imgheight); sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY; - sseq->zoom = 1.0f / power_of_2(1 / minf(zoomX, zoomY)); + sseq->zoom = 1.0f / power_of_2(1 / min_ff(zoomX, zoomY)); } else { sseq->zoom = 1.0f; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 2296b27916e..9b2722d3bd0 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1232,7 +1232,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); uiSetRoundBox(UI_CNR_ALL); - rad = 0.4f * mini(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); + rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); UI_GetThemeColor3ubv(TH_HILITE, col); col[3] = 48; glColor4ubv(col); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 8ff9b79af1d..f7ae082787b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1640,7 +1640,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* apply offset last - camera offset is different to offset in blender units */ /* so this has some sane way of working - this matches camera's shift _exactly_ */ { - const float max_dim = maxf(x2 - x1, y2 - y1); + const float max_dim = max_ff(x2 - x1, y2 - y1); const float xof_scale = bgpic->xof * max_dim; const float yof_scale = bgpic->yof * max_dim; @@ -1689,7 +1689,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* calc window coord */ initgrabz(rv3d, 0.0, 0.0, 0.0); ED_view3d_win_to_delta(ar, mval_f, tvec); - fac = maxf(fabsf(tvec[0]), maxf(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */ + fac = max_ff(fabsf(tvec[0]), max_ff(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */ fac = 1.0f / fac; asp = (float)ibuf->y / (float)ibuf->x; @@ -1717,7 +1717,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */ if (zoomx < 1.0f || zoomy < 1.0f) { - float tzoom = minf(zoomx, zoomy); + float tzoom = min_ff(zoomx, zoomy); int mip = 0; if ((ibuf->userflags & IB_MIPMAP_INVALID) != 0) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 4e16e50692a..7440bfefb33 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2591,7 +2591,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was xfac = (float)ar->winx / (float)(size[0] + 4); yfac = (float)ar->winy / (float)(size[1] + 4); - rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(minf(xfac, yfac)); + rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(min_ff(xfac, yfac)); CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); @@ -2879,7 +2879,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* work out the ratios, so that everything selected fits when we zoom */ xscale = (BLI_rcti_size_x(&rect) / vb[0]); yscale = (BLI_rcti_size_y(&rect) / vb[1]); - new_dist *= maxf(xscale, yscale); + new_dist *= max_ff(xscale, yscale); /* zoom in as required, or as far as we can go */ dist_range_min = 0.001f * v3d->grid; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 4babb03f374..da30ae61879 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -553,7 +553,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) time_wheel = (float)(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; /* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast) */ - time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ + time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ if (fly->speed < 0.0f) { fly->speed = 0.0f; @@ -571,7 +571,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) time_currwheel = PIL_check_seconds_timer(); time_wheel = (float)(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; - time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ + time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ if (fly->speed > 0.0f) { fly->speed = 0; @@ -847,7 +847,7 @@ static int flyApply(bContext *C, FlyInfo *fly) #endif time_current = PIL_check_seconds_timer(); time_redraw = (float)(time_current - fly->time_lastdraw); - time_redraw_clamped = minf(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */ + time_redraw_clamped = min_ff(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */ fly->time_lastdraw = time_current; /* Scale the time to use shift to scale the speed down- just like diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1a218c1b49d..2e813aa2c83 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1023,7 +1023,7 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_PROP_EDIT) { t->prop_size *= 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } t->redraw |= TREDRAW_HARD; @@ -1193,7 +1193,7 @@ int transformEvent(TransInfo *t, wmEvent *event) if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size *= 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } t->redraw = 1; @@ -1487,8 +1487,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; float angle = atan2f(dy, dx); float dist = sqrtf(dx * dx + dy * dy); - float delta_angle = minf(15.0f / dist, (float)M_PI / 4.0f); - float spacing_angle = minf(5.0f / dist, (float)M_PI / 12.0f); + float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f); + float spacing_angle = min_ff(5.0f / dist, (float)M_PI / 12.0f); UI_ThemeColor(TH_WIRE); setlinestyle(3); @@ -5612,7 +5612,7 @@ static int doEdgeSlide(TransInfo *t, float perc) for (i = 0; i < sld->totsv; i++, sv++) { const float sv_length = len_v3v3(sv->up->co, sv->down->co); - const float fac = minf(sv_length, curr_length_perc) / sv_length; + const float fac = min_ff(sv_length, curr_length_perc) / sv_length; if (sld->flipped_vtx) { interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index a9a74d3d0a1..c74faf53ced 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1831,7 +1831,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f d2 = d + len_v3(vec); if (dists[BM_elem_index_get(v3)] != FLT_MAX) - dists[BM_elem_index_get(v3)] = minf(d2, dists[BM_elem_index_get(v3)]); + dists[BM_elem_index_get(v3)] = min_ff(d2, dists[BM_elem_index_get(v3)]); else dists[BM_elem_index_get(v3)] = d2; @@ -2547,8 +2547,8 @@ void clipUVData(TransInfo *t) if ((td->flag & TD_SKIP) || (!td->loc)) continue; - td->loc[0] = minf(maxf(0.0f, td->loc[0]), aspx); - td->loc[1] = minf(maxf(0.0f, td->loc[1]), aspy); + td->loc[0] = min_ff(max_ff(0.0f, td->loc[0]), aspx); + td->loc[1] = min_ff(max_ff(0.0f, td->loc[1]), aspy); } } @@ -4300,7 +4300,7 @@ static void freeSeqData(TransInfo *t) for (a = 0; a < t->total; a++, td++) { seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { - minframe = mini(minframe, seq->startdisp); + minframe = min_ii(minframe, seq->startdisp); } } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 2b225118472..b1945c37048 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -432,8 +432,8 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1]; rotation = (edgesin > 0.0f) ? - +acosf(maxf(-1.0f, minf(1.0f, edgecos))) : - -acosf(maxf(-1.0f, minf(1.0f, edgecos))); + +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) : + -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))); island_stitch_data[element1->island].num_rot_elements++; island_stitch_data[element1->island].rotation += rotation; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index e6f40c4f1bf..1fd215b1ec2 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1129,7 +1129,7 @@ static void do_material_tex(GPUShadeInput *shi) newnor = tnor; } - norfac = minf(fabsf(mtex->norfac), 1.0f); + norfac = min_ff(fabsf(mtex->norfac), 1.0f); if (norfac == 1.0f && !GPU_link_changed(stencil)) { shi->vn = newnor; diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index c929c97a040..5cf762af3e8 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1253,7 +1253,7 @@ static IK_Scene *convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]); const float ikstretch = pchan->ikstretch * pchan->ikstretch; /* why invert twice here? */ - weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - 0.001f)); + weight[1] = (1.0 - min_ff(1.0 - ikstretch, 1.0f - 0.001f)); weights.push_back(weight[1]); } if (!ret) diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 966e70c2876..95b085dc982 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -710,7 +710,7 @@ void IMB_buffer_float_clamp(float *buf, int width, int height) { int i, total = width * height * 4; for (i = 0; i < total; i++) { - buf[i] = minf(1.0, buf[i]); + buf[i] = min_ff(1.0, buf[i]); } } diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 3bf8b9ffacc..5cef59a462b 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -241,13 +241,13 @@ static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, floa copy_v3_v3(max, mvert->co); for (v = 1; v < totvert; v++, mvert++) { - min[0] = minf(min[0], mvert->co[0]); - min[1] = minf(min[1], mvert->co[1]); - min[2] = minf(min[2], mvert->co[2]); + min[0] = min_ff(min[0], mvert->co[0]); + min[1] = min_ff(min[1], mvert->co[1]); + min[2] = min_ff(min[2], mvert->co[2]); - max[0] = maxf(max[0], mvert->co[0]); - max[1] = maxf(max[1], mvert->co[1]); - max[2] = maxf(max[2], mvert->co[2]); + max[0] = max_ff(max[0], mvert->co[0]); + max[1] = max_ff(max[1], mvert->co[1]); + max[2] = max_ff(max[2], mvert->co[2]); } sub_v3_v3v3(delta, max, min); diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 44ebc76e4a1..9f815f104cb 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -161,7 +161,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object if (smd->limit[0] < 0.0f) smd->limit[0] = 0.0f; if (smd->limit[0] > 1.0f) smd->limit[0] = 1.0f; - smd->limit[0] = minf(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */ + smd->limit[0] = min_ff(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */ /* Calculate matrixs do convert between coordinate spaces */ if (smd->origin) { @@ -191,8 +191,8 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object if (transf) space_transform_apply(transf, tmp); - lower = minf(lower, tmp[limit_axis]); - upper = maxf(upper, tmp[limit_axis]); + lower = min_ff(lower, tmp[limit_axis]); + upper = max_ff(upper, tmp[limit_axis]); } @@ -200,7 +200,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object smd_limit[1] = lower + (upper - lower) * smd->limit[1]; smd_limit[0] = lower + (upper - lower) * smd->limit[0]; - smd_factor = smd->factor / maxf(FLT_EPSILON, smd_limit[1] - smd_limit[0]); + smd_factor = smd->factor / max_ff(FLT_EPSILON, smd_limit[1] - smd_limit[0]); } modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup); diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 7dd988ac321..af5de2e8738 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -355,7 +355,7 @@ static void merge_frame_corners(Frame **frames, int totframe) BLI_assert(frames[i] != frames[k]); side_b = frame_len(frames[k]); - thresh = minf(side_a, side_b) / 2.0f; + thresh = min_ff(side_a, side_b) / 2.0f; /* Compare with each corner of all other frames... */ for (l = 0; l < 4; l++) { diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index a370bebf0e9..1094cebba75 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -480,9 +480,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der for (i = 0; i < numIdx; i++) { new_w[i] = dists_v ? dists_v[i] : FLT_MAX; if (dists_e) - new_w[i] = minf(dists_e[i], new_w[i]); + new_w[i] = min_ff(dists_e[i], new_w[i]); if (dists_f) - new_w[i] = minf(dists_f[i], new_w[i]); + new_w[i] = min_ff(dists_f[i], new_w[i]); } if (free_target_dm) target_dm->release(target_dm); if (dists_v) MEM_freeN(dists_v); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 826c555d2c6..27ce0f7c4a7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -338,7 +338,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // fast blur... // bug #6656 part 1, probably when previous node_composite.c was split into separate files, it was not properly updated // to include recent cvs commits (well, at least not defocus node), so this part was missing... - wt = minf(nqd->maxblur, aperture * 128.0f); + wt = min_ff(nqd->maxblur, aperture * 128.0f); IIR_gauss_single(crad, wt); IIR_gauss_single(wts, wt); @@ -589,8 +589,8 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // n-agonal int ov, nv; float mind, maxd, lwt; - ys = maxi((int)floor(bkh_b[2] * ct_crad + y), 0); - ye = mini((int)ceil(bkh_b[3] * ct_crad + y), new->y - 1); + ys = max_ii((int)floor(bkh_b[2] * ct_crad + y), 0); + ye = min_ii((int)ceil(bkh_b[3] * ct_crad + y), new->y - 1); for (sy=ys; sy<=ye; sy++) { float fxs = 1e10f, fxe = -1e10f; float yf = (sy - y)/ct_crad; diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 8a761caea21..014b72d3c60 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -76,7 +76,7 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * } /*only change if more transparent than either image */ - maxInputAlpha=maxf(inColor1[3], inColor2[3]); + maxInputAlpha=max_ff(inColor1[3], inColor2[3]); if (alpha < maxInputAlpha) { /*clamp*/ if (alpha < 0.0f) alpha = 0.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index f53c64b990a..9787c9f7145 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -54,28 +54,28 @@ static void morpho_dilate(CompBuf *cbuf) for (y = 0; y < cbuf->y; y++) { for (x = 0; x < cbuf->x - 1; x++) { p = rectf + cbuf->x * y + x; - *p = maxf(*p, *(p + 1)); + *p = max_ff(*p, *(p + 1)); } } for (y = 0; y < cbuf->y; y++) { for (x = cbuf->x - 1; x >= 1; x--) { p = rectf + cbuf->x * y + x; - *p = maxf(*p, *(p - 1)); + *p = max_ff(*p, *(p - 1)); } } for (x = 0; x < cbuf->x; x++) { for (y = 0; y < cbuf->y - 1; y++) { p = rectf + cbuf->x * y + x; - *p = maxf(*p, *(p + cbuf->x)); + *p = max_ff(*p, *(p + cbuf->x)); } } for (x = 0; x < cbuf->x; x++) { for (y = cbuf->y - 1; y >= 1; y--) { p = rectf + cbuf->x * y + x; - *p = maxf(*p, *(p - cbuf->x)); + *p = max_ff(*p, *(p - cbuf->x)); } } } @@ -88,28 +88,28 @@ static void morpho_erode(CompBuf *cbuf) for (y = 0; y < cbuf->y; y++) { for (x = 0; x < cbuf->x - 1; x++) { p = rectf + cbuf->x * y + x; - *p = minf(*p, *(p + 1)); + *p = min_ff(*p, *(p + 1)); } } for (y = 0; y < cbuf->y; y++) { for (x = cbuf->x - 1; x >= 1; x--) { p = rectf + cbuf->x * y + x; - *p = minf(*p, *(p - 1)); + *p = min_ff(*p, *(p - 1)); } } for (x = 0; x < cbuf->x; x++) { for (y = 0; y < cbuf->y - 1; y++) { p = rectf + cbuf->x * y + x; - *p = minf(*p, *(p + cbuf->x)); + *p = min_ff(*p, *(p + cbuf->x)); } } for (x = 0; x < cbuf->x; x++) { for (y = cbuf->y - 1; y >= 1; y--) { p = rectf + cbuf->x * y + x; - *p = minf(*p, *(p - cbuf->x)); + *p = min_ff(*p, *(p - cbuf->x)); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index c283512e461..c07ad0a0c97 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -113,8 +113,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf * dxt = p_dx - d_dx; dyt = p_dy - d_dy; - dxt = signf(dxt)*maxf(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x; - dyt = signf(dyt)*maxf(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y; + dxt = signf(dxt)*max_ff(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x; + dyt = signf(dyt)*max_ff(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y; ibuf_sample(ibuf, u, v, dxt, dyt, col); qd_setPixel(stackbuf, x, y, col); diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h index a515b986d77..757ebc4c4d3 100644 --- a/source/blender/render/intern/raytrace/svbvh.h +++ b/source/blender/render/intern/raytrace/svbvh.h @@ -165,16 +165,16 @@ inline void bvh_node_merge_bb<SVBVHNode>(SVBVHNode *node, float min[3], float ma for (i = 0; i + 4 <= node->nchilds; i += 4) { float *res = node->child_bb + 6 * i; for (int j = 0; j < 3; j++) { - min[j] = minf(res[4 * j + 0], - minf(res[4 * j + 1], - minf(res[4 * j + 2], - minf(res[4 * j + 3], min[j])))); + min[j] = min_ff(res[4 * j + 0], + min_ff(res[4 * j + 1], + min_ff(res[4 * j + 2], + min_ff(res[4 * j + 3], min[j])))); } for (int j = 0; j < 3; j++) { - max[j] = maxf(res[4 * (j + 3) + 0], - maxf(res[4 * (j + 3) + 1], - maxf(res[4 * (j + 3) + 2], - maxf(res[4 * (j + 3) + 3], max[j])))); + max[j] = max_ff(res[4 * (j + 3) + 0], + max_ff(res[4 * (j + 3) + 1], + max_ff(res[4 * (j + 3) + 2], + max_ff(res[4 * (j + 3) + 3], max[j])))); } } diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 64cd62ee98b..44faee73d35 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -989,7 +989,7 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x)); alphaclip *= clipy_rctf(&rf, 0.0, (float)(ibuf->y)); - alphaclip = maxf(alphaclip, 0.0f); + alphaclip = max_ff(alphaclip, 0.0f); if (alphaclip!=1.0f) { /* premul it all */ @@ -1247,8 +1247,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex float fProbes; a *= ff; b *= ff; - a = maxf(a, 1.0f); - b = maxf(b, 1.0f); + a = max_ff(a, 1.0f); + b = max_ff(b, 1.0f); fProbes = 2.f*(a / b) - 1.f; AFD.iProbes = (int)floorf(fProbes + 0.5f); AFD.iProbes = MIN2(AFD.iProbes, tex->afmax); @@ -1264,7 +1264,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex if (ecc > (float)tex->afmax) b = a / (float)tex->afmax; b *= ff; } - maxd = maxf(b, 1e-8f); + maxd = max_ff(b, 1e-8f); levf = ((float)M_LOG2E) * logf(maxd); curmap = 0; @@ -1349,8 +1349,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex imp2radangle(A, B, C, F, &a, &b, &th, &ecc); a *= ff; b *= ff; - a = maxf(a, 1.0f); - b = maxf(b, 1.0f); + a = max_ff(a, 1.0f); + b = max_ff(b, 1.0f); fProbes = 2.f*(a / b) - 1.f; /* no limit to number of Probes here */ AFD.iProbes = (int)floorf(fProbes + 0.5f); @@ -1645,7 +1645,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const dx = minx; dy = miny; - maxd = maxf(dx, dy); + maxd = max_ff(dx, dy); if (maxd > 0.5f) maxd = 0.5f; pixsize = 1.0f / (float) MIN2(ibuf->x, ibuf->y); diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index c4df041a5ae..3420648cb52 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -162,7 +162,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) copy_v3_v3(lvrot, lv); mul_m3_v3(lar->imat, lvrot); - x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); + x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ inpr= 1.0/(sqrt(1.0f+x*x)); diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index ed08f5a16fb..127e0bc07b9 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1515,7 +1515,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) if (!(shi->combinedflag & SCE_PASS_REFRACT)) sub_v3_v3v3(diff, diff, shr->refr); - shr->alpha = minf(1.0f, tracol[3]); + shr->alpha = min_ff(1.0f, tracol[3]); } if (do_mir) { diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 9cdf7da5a44..c507d6595e0 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1753,7 +1753,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, if (mtex->texco == TEXCO_UV) { /* for the uv case, use the same value for both du/dv, * since individually scaling the normal derivatives makes them useless... */ - du = minf(du, dv); + du = min_ff(du, dv); idu = (du < 1e-5f) ? bf : (bf/du); /* +u val */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 37e21d072ee..d7dc1432a49 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1583,7 +1583,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe copy_v3_v3(shi->facenor, nor); shade_input_set_viewco(shi, x, y, sx, sy, z); - *area = minf(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea); + *area = min_ff(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea); shade_input_set_uv(shi); shade_input_set_normals(shi); diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index ce89ebd4c34..b4eaabc432a 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -1394,7 +1394,7 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3]) } } - labda = minf(labdax, labday); + labda = min_ff(labdax, labday); if (labda==labdao || labda>=1.0f) break; zf= zf1 + labda*(zf2-zf1); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index f1665a3a9cd..93743dedd3c 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -827,7 +827,7 @@ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float d nv = 0.0f; if (darkness <= 1.0f) - i = nl * pow(maxf(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/ + i = nl * pow(max_ff(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/ else i = nl * pow( (1.001f - nv), (darkness - 1.0f) ); /*Nvidia model*/ @@ -1233,7 +1233,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d copy_v3_v3(lvrot, lv); mul_m3_v3(lar->imat, lvrot); - x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); + x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ inpr= 1.0f/(sqrt(1.0f+x*x)); diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 77d68e6c85a..6d0e15ea46e 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -307,7 +307,7 @@ ScatterSettings *scatter_settings_new(float refl, float radius, float ior, float ss->Fdr= -1.440f/ior*ior + 0.710f/ior + 0.668f + 0.0636f*ior; ss->A= (1.0f + ss->Fdr)/(1.0f - ss->Fdr); ss->ld= radius; - ss->ro= minf(refl, 0.999f); + ss->ro= min_ff(refl, 0.999f); ss->color= ss->ro*reflfac + (1.0f-reflfac); ss->alpha_= compute_reduced_albedo(ss); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index a9a6a90f834..8e53ce11e4d 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -150,7 +150,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2) } else { dx0 = 0.0f; - xs0 = minf(minv[0], maxv[0]); + xs0 = min_ff(minv[0], maxv[0]); } /* empty span */ @@ -3889,7 +3889,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf addAlphaUnderFloat(samp_shr->combined, shr->combined); - samp_shr->z = minf(samp_shr->z, shr->z); + samp_shr->z = min_ff(samp_shr->z, shr->z); if (addpassflag & SCE_PASS_VECTOR) { copy_v4_v4(samp_shr->winspeed, shr->winspeed); diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index b103c8c4050..20314098776 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -311,7 +311,7 @@ int SCA_Joystick::pAxisTest(int axisnum) short i2= m_axis_array[(axisnum*2)+1]; /* long winded way to do - * return maxf(absf(i1), absf(i2)) + * return max_ff(absf(i1), absf(i2)) * avoid abs from math.h */ if (i1 < 0) i1 = -i1; if (i2 < 0) i2 = -i2; |