diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-21 09:07:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-21 09:07:26 +0400 |
commit | b2c66e268f68ee406e5e05a65d9d1609b65d20c4 (patch) | |
tree | 722192b9fe1d7af57695860fc3639781bedf5f2b /source/blender/editors | |
parent | e09ddf0d4ba6f6d1e8963d41eef153dadce482f8 (diff) |
replace MIN/MAX 3,4 with inline functions
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/reeb.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_select.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 8 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 2 |
11 files changed, 25 insertions, 27 deletions
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index b1bf13db69b..1b5c550df11 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -634,7 +634,7 @@ static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end if (aDst->bcount > 0 && aSrc->bcount > 0) { int indexDst = 0, indexSrc = 0; - start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val); + start = max_fff(start, aDst->buckets[0].val, aSrc->buckets[0].val); while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start) { indexDst++; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index a195f37b60e..c8a1264fd10 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1146,7 +1146,7 @@ static float len_v3_tri_side_max(const float v1[3], const float v2[3], const flo const float s2 = len_squared_v3v3(v2, v3); const float s3 = len_squared_v3v3(v3, v1); - return sqrtf(MAX3(s1, s2, s3)); + return sqrtf(max_fff(s1, s2, s3)); } static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree, diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 2b3e310363e..773331d20f8 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1062,7 +1062,7 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float static unsigned int mirror_facehash(const void *ptr) { const MFace *mf = ptr; - int v0, v1; + unsigned int v0, v1; if (mf->v4) { v0 = MIN4(mf->v1, mf->v2, mf->v3, mf->v4); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index db2023b7364..c54ac485be6 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -127,7 +127,7 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings * float longest_axis; BKE_object_dimensions_get(domainob, dim); - longest_axis = MAX3(dim[0], dim[1], dim[2]); + longest_axis = max_fff(dim[0], dim[1], dim[2]); return longest_axis * scene->unit.scale_length; } diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index b8e162bfb17..bec50130230 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -123,10 +123,10 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack * BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max); - epsx = MIN4(pat_min[0] - marker->search_min[0], marker->search_max[0] - pat_max[0], - fabsf(pat_min[0]), fabsf(pat_max[0])) / 2; - 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 = min_ffff(pat_min[0] - marker->search_min[0], marker->search_max[0] - pat_max[0], + fabsf(pat_min[0]), fabsf(pat_max[0])) / 2; + epsy = min_ffff(pat_min[1] - marker->search_min[1], marker->search_max[1] - pat_max[1], + fabsf(pat_min[1]), fabsf(pat_max[1])) / 2; epsx = max_ff(epsx, 2.0f / width); epsy = max_ff(epsy, 2.0f / height); @@ -166,7 +166,7 @@ static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2]) d3 = dist_squared_to_line_segment_v2(p, v3, v4); d4 = dist_squared_to_line_segment_v2(p, v4, v1); - return sqrtf(MIN4(d1, d2, d3, d4)); + return sqrtf(min_ffff(d1, d2, d3, d4)); } static float dist_to_crns(float co[2], float pos[2], float crns[4][2]) @@ -181,7 +181,7 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]) d3 = dist_squared_to_line_segment_v2(p, v3, v4); d4 = dist_squared_to_line_segment_v2(p, v4, v1); - return sqrtf(MIN4(d1, d2, d3, d4)); + return sqrtf(min_ffff(d1, d2, d3, d4)); } static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbase, float co[2]) @@ -210,7 +210,7 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas d3 = dist_to_rect(co, marker->pos, marker->search_min, marker->search_max); /* choose minimal distance. useful for cases of overlapped markers. */ - dist = MIN3(d1, d2, d3); + dist = min_fff(d1, d2, d3); if (track == NULL || dist < mindist) { track = cur; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f123bcdb94f..59dd66a0207 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3416,10 +3416,10 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa vec[2][0] = vec[3][0] - dist; vec[2][1] = vec[3][1]; } - if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) { + if (v2d && min_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) { /* clipped */ } - else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { + else if (v2d && max_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { /* clipped */ } else { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 8155f9d645e..6219a9061f4 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -859,9 +859,9 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) * the other strips. */ if (!RNA_struct_property_is_set(op->ptr, "channel")) { if (seq->seq1) { - int chan = MAX3(seq->seq1 ? seq->seq1->machine : 0, - seq->seq2 ? seq->seq2->machine : 0, - seq->seq3 ? seq->seq3->machine : 0); + int chan = max_iii(seq->seq1 ? seq->seq1->machine : 0, + seq->seq2 ? seq->seq2->machine : 0, + seq->seq3 ? seq->seq3->machine : 0); if (chan < MAXSEQ) seq->machine = chan; } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 70690e2dce7..29daee3e11b 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -449,8 +449,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, * inserting previously found vertex into the plane equation */ /* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */ - ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]); - dd = MAX3(sds->global_size[0], sds->global_size[1], sds->global_size[2]) / 128.f; + ds = (fabsf(viewnormal[0]) * size[0] + fabsf(viewnormal[1]) * size[1] + fabsf(viewnormal[2]) * size[2]); + dd = max_fff(sds->global_size[0], sds->global_size[1], sds->global_size[2]) / 128.f; n = 0; good_index = i; @@ -570,7 +570,7 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob) float min[3]; float *cell_size = domain->cell_size; - float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f; + float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.f; float vf = domain->scale / 16.f * 2.f; /* velocity factor */ glLineWidth(1.0f); @@ -624,7 +624,7 @@ void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob) float min[3]; float *cell_size = domain->cell_size; - float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f; + float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.f; float vf = domain->scale / 16.f * 2.f; /* velocity factor */ /* set first position so that it doesn't jump when domain moves */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index cf6475383f1..78c3f4e4f4a 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2233,7 +2233,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar, float new_dist; sub_v3_v3v3(afm, max, min); - size = MAX3(afm[0], afm[1], afm[2]); + size = max_fff(afm[0], afm[1], afm[2]); if (ok_dist) { /* fix up zoom distance if needed */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 56ce9bda607..41d092ce2b1 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1070,11 +1070,9 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL } } } - - box[0] = (max[0] - min[0]); - box[1] = (max[1] - min[1]); - box[2] = (max[2] - min[2]); - size = MAX3(box[0], box[1], box[2]); + + sub_v3_v3v3(box, max, min); + size = max_fff(box[0], box[1], box[2]); /* do not zoom closer than the near clipping plane */ size = max_ff(size, v3d->near * 1.5f); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 8703234122a..5d3a5983030 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -3109,7 +3109,7 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) sina2 = sin(a2); sina3 = sin(a3); - sinmax = MAX3(sina1, sina2, sina3); + sinmax = max_fff(sina1, sina2, sina3); /* shift vertices to find most stable order */ if (sina3 != sinmax) { |