X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode_scale.cpp;h=b2f62b79b0fe4e116a14b9b577eaeb70f6a7b019;hb=37600b4b217caa5e316984ec0b035c5e8f9698af;hp=7bd8d186e239063d6fa04f1ce33e733605f3889b;hpb=b2c243deddefa52cd7e5ee9a50d2d2464bcef4ad;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode_scale.cpp b/synfig-core/trunk/src/synfig/valuenode_scale.cpp index 7bd8d18..b2f62b7 100644 --- a/synfig-core/trunk/src/synfig/valuenode_scale.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_scale.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -163,23 +164,9 @@ synfig::ValueNode_Scale::operator()(Time t)const { if(!value_node || !scalar) throw runtime_error(strprintf("ValueNode_Scale: %s",_("One or both of my parameters aren't set!"))); - else - if(get_type()==ValueBase::TYPE_VECTOR) - return (*value_node)(t).get(Vector())*(*scalar)(t).get(Real()); - else - if(get_type()==ValueBase::TYPE_REAL) - return (*value_node)(t).get(Real())*(*scalar)(t).get(Real()); - else - if(get_type()==ValueBase::TYPE_TIME) - 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()); - else - if(get_type()==ValueBase::TYPE_ANGLE) + else if(get_type()==ValueBase::TYPE_ANGLE) return (*value_node)(t).get(Angle())*(*scalar)(t).get(Real()); - else - if(get_type()==ValueBase::TYPE_COLOR) + else if(get_type()==ValueBase::TYPE_COLOR) { Color ret((*value_node)(t).get(Color())); Real s((*scalar)(t).get(Real())); @@ -188,6 +175,18 @@ synfig::ValueNode_Scale::operator()(Time t)const ret.set_b(ret.get_b()*s); return ret; } + else if(get_type()==ValueBase::TYPE_INTEGER) + { + Real ret = (*value_node)(t).get(int())*(*scalar)(t).get(Real()) + 0.5f; + if (ret < 0) return static_cast(ret-1); + return static_cast(ret); + } + else if(get_type()==ValueBase::TYPE_REAL) + return (*value_node)(t).get(Real())*(*scalar)(t).get(Real()); + else if(get_type()==ValueBase::TYPE_TIME) + return (*value_node)(t).get(Time())*(*scalar)(t).get(Time()); + else if(get_type()==ValueBase::TYPE_VECTOR) + return (*value_node)(t).get(Vector())*(*scalar)(t).get(Real()); assert(0); return ValueBase(); @@ -277,9 +276,10 @@ bool ValueNode_Scale::check_type(ValueBase::Type type) { return - type==ValueBase::TYPE_VECTOR || - type==ValueBase::TYPE_REAL || - type==ValueBase::TYPE_INTEGER || + type==ValueBase::TYPE_ANGLE || type==ValueBase::TYPE_COLOR || - type==ValueBase::TYPE_ANGLE; + type==ValueBase::TYPE_INTEGER || + type==ValueBase::TYPE_REAL || + type==ValueBase::TYPE_TIME || + type==ValueBase::TYPE_VECTOR; }