From b8b412230b1e1ed43295d5c299477a2cba73355e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Jan 2014 13:00:03 +1100 Subject: Code Cleanup: use iroundf also increase precision of rctf print functions --- source/blender/editors/space_graph/graph_edit.c | 6 +++--- source/blender/editors/space_graph/graph_ops.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_graph') 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); } -- cgit v1.2.3