Fix to allow the 'scale' valuenode be used with integers.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 18 Sep 2007 23:16:56 +0000 (23:16 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 18 Sep 2007 23:16:56 +0000 (23:16 +0000)
git-svn-id: http://svn.voria.com/code@718 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/valuenode_scale.cpp

index 7bd8d18..181cc29 100644 (file)
@@ -174,7 +174,11 @@ synfig::ValueNode_Scale::operator()(Time t)const
                return (*value_node)(t).get(Time())*(*scalar)(t).get(Time());
        else
        if(get_type()==ValueBase::TYPE_INTEGER)
-               return (*value_node)(t).get(int())*(*scalar)(t).get(Real());
+       {
+               Real ret = (*value_node)(t).get(int())*(*scalar)(t).get(Real()) + 0.5f;
+               if (ret < 0) return static_cast<int>(ret-1);
+               return static_cast<int>(ret);
+       }
        else
        if(get_type()==ValueBase::TYPE_ANGLE)
                return (*value_node)(t).get(Angle())*(*scalar)(t).get(Real());