diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-15 06:00:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-15 06:40:40 +0400 |
commit | b8b412230b1e1ed43295d5c299477a2cba73355e (patch) | |
tree | 0b3d61142c7a0490293c975a636165057f20c58e /source/blender/editors/animation | |
parent | e5c7535bebc37e04489fac4e88beca8cc5677d7d (diff) |
Code Cleanup: use iroundf
also increase precision of rctf print functions
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index e65ca3d20be..f95807b55ea 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -144,7 +144,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 += (int)floorf(value + 0.5f); + marker->frame += iroundf(value); changed_tot++; } break; @@ -152,7 +152,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 + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f); + marker->frame = cfra + iroundf((float)(marker->frame - cfra) * value); changed_tot++; break; } @@ -190,7 +190,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) : (int)floor(x + 0.5f); + return (nearest) ? (nearest->frame) : iroundf(x); } diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index af9b58736ef..48b310b57ed 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -35,6 +35,7 @@ #include "BLI_sys_types.h" #include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "DNA_anim_types.h" #include "DNA_scene_types.h" @@ -126,7 +127,7 @@ static int frame_from_event(bContext *C, const wmEvent *event) UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, NULL); /* round result to nearest int (frames are ints!) */ - frame = (int)floor(viewx + 0.5f); + frame = iroundf(viewx); if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { CLAMP(frame, PSFRA, PEFRA); @@ -223,8 +224,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) if (efra < sfra) efra = sfra; scene->r.flag |= SCER_PRV_RANGE; - scene->r.psfra = (int)floor(sfra + 0.5f); - scene->r.pefra = (int)floor(efra + 0.5f); + scene->r.psfra = iroundf(sfra); + scene->r.pefra = iroundf(efra); /* send notifiers */ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); |