Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-29 20:59:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-29 20:59:51 +0400
commitc41e1e434ab9defa35178ad8886d81b60d889e9a (patch)
tree89cc6a948b408865e475ccb1f8c2cf98edac76bc /source/blender/editors
parent93ff6f6dff73cf24e591dd2678ee601495714dc7 (diff)
code cleanup: replace MIN2/MAX2 with minf/maxf
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_panel.c9
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/space_clip/clip_draw.c10
-rw-r--r--source/blender/editors/space_clip/clip_editor.c2
-rw-r--r--source/blender/editors/space_clip/clip_ops.c4
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c14
-rw-r--r--source/blender/editors/space_clip/tracking_select.c6
-rw-r--r--source/blender/editors/space_image/image_ops.c2
-rw-r--r--source/blender/editors/space_nla/nla_edit.c4
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c6
-rw-r--r--source/blender/editors/transform/transform.c4
17 files changed, 49 insertions, 48 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 76485571096..d04c1af2769 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -831,14 +831,15 @@ static void ui_do_animate(const bContext *C, Panel *panel)
float fac;
fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
- fac = sqrt(fac);
- fac = MIN2(fac, 1.0f);
+ fac = minf(sqrt(fac), 1.0f);
/* for max 1 second, interpolate positions */
- if (uiAlignPanelStep(sa, ar, fac, 0))
+ if (uiAlignPanelStep(sa, ar, fac, 0)) {
ED_region_tag_redraw(ar);
- else
+ }
+ else {
fac = 1.0f;
+ }
if (fac >= 1.0f) {
panel_activate_state(C, panel, PANEL_STATE_EXIT);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index a869886355a..fa7df050a42 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2624,21 +2624,21 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
m1 = MAXSLOPE;
b1 = x12;
}
- x2max = MAX2(x21, x22) + 0.001f; /* prevent missed edges */
- x2min = MIN2(x21, x22) - 0.001f; /* due to round off error */
- y2max = MAX2(y21, y22) + 0.001f;
- y2min = MIN2(y21, y22) - 0.001f;
+ 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;
/* Found an intersect, calc intersect point */
if (m1 == m2) { /* co-incident lines */
/* cut at 50% of overlap area */
- x1max = MAX2(x11, x12);
- x1min = MIN2(x11, x12);
- xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0f;
+ x1max = maxf(x11, x12);
+ x1min = minf(x11, x12);
+ xi = (minf(x2max, x1max) + maxf(x2min, x1min)) / 2.0f;
- y1max = MAX2(y11, y12);
- y1min = MIN2(y11, y12);
- yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0f;
+ y1max = maxf(y11, y12);
+ y1min = minf(y11, y12);
+ yi = (minf(y2max, y1max) + maxf(y2min, y1min)) / 2.0f;
}
else if (m2 == MAXSLOPE) {
xi = x22;
@@ -4983,7 +4983,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] = MAX2(amounts[0], 0.0f);
+ amounts[0] = maxf(amounts[0], 0.0f);
RNA_float_set(op->ptr, "thickness", amounts[0]);
RNA_float_set(op->ptr, "depth", amounts[1]);
@@ -5024,7 +5024,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 = MAX2(amount, 0.0f);
+ amount = maxf(amount, 0.0f);
RNA_float_set(op->ptr, "thickness", amount);
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 2a497d599aa..306724de301 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5236,7 +5236,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 = MAX2(size * zoomx, size * zoomy);
+ pixel_size = size * maxf(zoomx, zoomy);
}
else {
pixel_size = size;
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 8e13bc61ee8..96eb6002840 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -732,7 +732,7 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker)
cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
- len = MIN2(cur_len, len);
+ len = minf(cur_len, len);
}
return len;
@@ -804,11 +804,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 = MIN2(dx * 2.0f / 3.0f, side / 6.0f);
- patdy = MIN2(dy * 2.0f / 3.0f, side * width / height / 6.0f);
+ patdx = minf(dx * 2.0f / 3.0f, side / 6.0f);
+ patdy = minf(dy * 2.0f / 3.0f, side * width / height / 6.0f);
- searchdx = MIN2(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f);
- searchdy = MIN2(dy, (marker->search_max[1] - marker->search_min[1]) / 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);
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 54ee691b63b..349303afbf2 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -351,7 +351,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 / MIN2(zoomx, zoomy));
+ newzoom = 1.0f / power_of_2(1.0f / minf(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 f7222dae75f..20d47063cd4 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -735,7 +735,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, MIN2(zoomx, zoomy), NULL);
+ sclip_zoom_set(C, minf(zoomx, zoomy), NULL);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
@@ -743,7 +743,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 / MIN2(zoomx, zoomy)), NULL);
+ sclip_zoom_set(C, 1.0f / power_of_2(1.0f / minf(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 77c4b527a11..153287eecdd 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -373,8 +373,8 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
dx = size / width / sc->zoom;
dy = size / height / sc->zoom;
- dx = MIN2(dx, (max[0] - min[0]) / 6.0f);
- dy = MIN2(dy, (max[1] - min[1]) / 6.0f);
+ dx = minf(dx, (max[0] - min[0]) / 6.0f);
+ dy = minf(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);
@@ -425,14 +425,14 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker,
cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
- len = MIN2(cur_len, len);
+ len = minf(cur_len, len);
}
dx = 12.0f / width / sc->zoom;
dy = 12.0f / height / sc->zoom;
- dx = MIN2(dx, len * 2.0f / 3.0f);
- dy = MIN2(dy, len * width / height * 2.0f / 3.0f);
+ dx = minf(dx, len * 2.0f / 3.0f);
+ dy = minf(dy, len * width / height * 2.0f / 3.0f);
for (i = 0; i < 4; i++) {
float crn[2];
@@ -463,8 +463,8 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
dx = 12.0f / width / sc->zoom;
dy = 12.0f / height / sc->zoom;
- dx = MIN2(dx, (pat_max[0] - pat_min[0]) / 2.0f);
- dy = MIN2(dy, (pat_max[1] - pat_min[1]) / 2.0f);
+ dx = minf(dx, (pat_max[0] - pat_min[0]) / 2.0f);
+ dy = minf(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 9581d7708fb..559fe8c840d 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 < MAX2(epsx, epsy);
+ return dist < maxf(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 = MAX2(epsx, 2.0f / width);
- epsy = MAX2(epsy, 2.0f / height);
+ epsx = maxf(epsx, 2.0f / width);
+ epsy = maxf(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 4626600f2cf..d34f734c6c2 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -582,7 +582,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 / MIN2(zoomx, zoomy)), NULL);
+ sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / minf(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 5c9994e46d3..a3e9ca1c4a2 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 = MIN2(*min, strip->start);
- *max = MAX2(*max, strip->end);
+ *min = minf(*min, strip->start);
+ *max = maxf(*max, strip->end);
}
}
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index ad3e1954e68..c546eda1998 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3155,7 +3155,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 = MIN2(zoomx, zoomy);
+ zoom = minf(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 8c9f057efc1..f8ce572ee46 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -413,7 +413,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 = MIN2(dy, locy - 2 * NODE_DY);
+ node->totr.ymin = minf(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_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 057382549b6..4034c9f98f0 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2111,7 +2111,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 / MIN2(zoomX, zoomY) );
+ sseq->zoom = 1.0f / power_of_2(1 / minf(zoomX, zoomY));
}
else {
sseq->zoom = 1.0f;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index ac31d0d622e..85a4d911df5 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1716,7 +1716,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 = MIN2(zoomx, zoomy);
+ float tzoom = minf(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 440f7344616..ba665cfb89c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2435,7 +2435,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(MIN2(xfac, yfac));
+ rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(minf(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));
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 3efd7c252fe..561e97a8393 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -549,7 +549,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 * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed < 0.0f) {
fly->speed = 0.0f;
@@ -567,7 +567,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 * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed > 0.0f) {
fly->speed = 0;
@@ -843,7 +843,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 = MIN2(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
+ time_redraw_clamped = minf(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 f7fbc7002a2..feab96d6ddf 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -972,7 +972,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 = MIN2(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
t->redraw |= TREDRAW_HARD;
@@ -1142,7 +1142,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 = MIN2(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
t->redraw = 1;