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/space_graph | |
parent | e5c7535bebc37e04489fac4e88beca8cc5677d7d (diff) |
Code Cleanup: use iroundf
also increase precision of rctf print functions
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 0f3ba9865c4..68d82cd2848 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -189,8 +189,8 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) /* set the range directly */ get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, FALSE, FALSE); scene->r.flag |= SCER_PRV_RANGE; - scene->r.psfra = (int)floor(min + 0.5f); - scene->r.pefra = (int)floor(max + 0.5f); + scene->r.psfra = iroundf(min); + scene->r.pefra = iroundf(max); /* set notifier that things have changed */ // XXX err... there's nothing for frame ranges yet, but this should do fine too @@ -1825,7 +1825,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = ac.scene; /* take the average values, rounding to the nearest int for the current frame */ - CFRA = (int)floor((ked.f1 / ked.i1) + 0.5f); + CFRA = iroundf(ked.f1 / ked.i1); SUBFRA = 0.f; sipo->cursorVal = ked.f2 / (float)ked.i1; } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 74114f8ca9d..4409a5b180e 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -37,6 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "BKE_context.h" #include "BKE_global.h" @@ -123,7 +124,7 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent /* store the values in the operator properties */ /* frame is rounded to the nearest int, since frames are ints */ - RNA_int_set(op->ptr, "frame", (int)floor(viewx + 0.5f)); + RNA_int_set(op->ptr, "frame", iroundf(viewx)); RNA_float_set(op->ptr, "value", viewy); } |