diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-27 04:13:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-27 04:13:03 +0300 |
commit | 43b49130516db974c125d89919fe8ddc25cf4405 (patch) | |
tree | 0ed06e3090a10ef20ea4682edd2c3b61f5937624 /source/blender/editors/animation | |
parent | 870dfb1b5aac1c5c4dbcce0f8318c11d229bf3ac (diff) |
Math Lib: Add non-clamped round_* functions
Replace iroundf with round_fl_to_int, add other types
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 5852ee72b19..dba060bfb29 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4458,8 +4458,8 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle * a callback available (e.g. broken F-Curve rename) */ if (acf->name_prop(ale, &ptr, &prop)) { - const short margin_x = 3 * iroundf(UI_DPI_FAC); - const short channel_height = iroundf(ymaxc - yminc); + const short margin_x = 3 * round_fl_to_int(UI_DPI_FAC); + const short channel_height = round_fl_to_int(ymaxc - yminc); const short width = ac->ar->winx - offset - (margin_x * 2); uiBut *but; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index be01f8cbe69..efcc3e9477c 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -149,7 +149,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f (side == 'L' && marker->frame < cfra) || (side == 'R' && marker->frame >= cfra)) { - marker->frame += iroundf(value); + marker->frame += round_fl_to_int(value); changed_tot++; } break; @@ -157,7 +157,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f case TFM_TIME_SCALE: { /* rescale the distance between the marker and the current frame */ - marker->frame = cfra + iroundf((float)(marker->frame - cfra) * value); + marker->frame = cfra + round_fl_to_int((float)(marker->frame - cfra) * value); changed_tot++; break; } @@ -195,7 +195,7 @@ TimeMarker *ED_markers_find_nearest_marker(ListBase *markers, float x) int ED_markers_find_nearest_marker_time(ListBase *markers, float x) { TimeMarker *nearest = ED_markers_find_nearest_marker(markers, x); - return (nearest) ? (nearest->frame) : iroundf(x); + return (nearest) ? (nearest->frame) : round_fl_to_int(x); } diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 0eb6508f7b2..fcdd45d4ac3 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -108,7 +108,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) SUBFRA = frame - (int)frame; } else { - CFRA = iroundf(frame); + CFRA = round_fl_to_int(frame); SUBFRA = 0.0f; } FRAMENUMBER_MIN_CLAMP(CFRA); @@ -301,8 +301,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) if (efra < sfra) efra = sfra; scene->r.flag |= SCER_PRV_RANGE; - scene->r.psfra = iroundf(sfra); - scene->r.pefra = iroundf(efra); + scene->r.psfra = round_fl_to_int(sfra); + scene->r.pefra = round_fl_to_int(efra); /* send notifiers */ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); |