From ae2ef8c3d3c211c69e02fe74fbea3671ea49839c Mon Sep 17 00:00:00 2001 From: dooglus Date: Tue, 18 Sep 2007 19:33:54 +0000 Subject: [PATCH] Round integer subtraction convertions to the nearest integer. git-svn-id: http://svn.voria.com/code@710 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/valuenode_subtract.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/valuenode_subtract.cpp b/synfig-core/trunk/src/synfig/valuenode_subtract.cpp index cb43e95..4d31718 100644 --- a/synfig-core/trunk/src/synfig/valuenode_subtract.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_subtract.cpp @@ -197,7 +197,11 @@ synfig::ValueNode_Subtract::operator()(Time t)const if(get_type()==ValueBase::TYPE_COLOR) return ((*ref_a)(t).get(Color())-(*ref_b)(t).get(Color()))*(*scalar)(t).get(Real()); if(get_type()==ValueBase::TYPE_INTEGER) - return static_cast(((*ref_a)(t).get(int())-(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()) + 0.5f); + { + Real value = ((*ref_a)(t).get(int())-(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()) + 0.5f; + if (value < 0) return static_cast(value-1); + return static_cast(value); + } if(get_type()==ValueBase::TYPE_REAL) return ((*ref_a)(t).get(Vector::value_type())-(*ref_b)(t).get(Vector::value_type()))*(*scalar)(t).get(Real()); if(get_type()==ValueBase::TYPE_VECTOR) -- 2.7.4