projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
List the removed layers in the history dialog when removing layers.
[synfig.git]
/
synfig-core
/
trunk
/
src
/
synfig
/
valuenode_scale.cpp
diff --git
a/synfig-core/trunk/src/synfig/valuenode_scale.cpp
b/synfig-core/trunk/src/synfig/valuenode_scale.cpp
index
b2f62b7
..
ae32f97
100644
(file)
--- a/
synfig-core/trunk/src/synfig/valuenode_scale.cpp
+++ b/
synfig-core/trunk/src/synfig/valuenode_scale.cpp
@@
-1,6
+1,6
@@
/* === S Y N F I G ========================================================= */
/*! \file valuenode_scale.cpp
/* === S Y N F I G ========================================================= */
/*! \file valuenode_scale.cpp
-** \brief
Template File
+** \brief
Implementation of the "Scale" valuenode conversion.
**
** $Id$
**
**
** $Id$
**
@@
-34,11
+34,11
@@
#include "valuenode_scale.h"
#include "valuenode_const.h"
#include <stdexcept>
#include "valuenode_scale.h"
#include "valuenode_const.h"
#include <stdexcept>
-#include <cassert>
#include "color.h"
#include "vector.h"
#include "time.h"
#include "angle.h"
#include "color.h"
#include "vector.h"
#include "time.h"
#include "angle.h"
+#include <ETL/misc>
#endif
#endif
@@
-84,7
+84,7
@@
ValueNode_Scale::ValueNode_Scale(const ValueBase &value):
break;
default:
assert(0);
break;
default:
assert(0);
- throw runtime_error(
"synfig::ValueNode_Scale:Bad type "+ValueBase::type_name(value.get_type()
));
+ throw runtime_error(
get_local_name()+_(":Bad type ")+ValueBase::type_local_name(id
));
}
assert(value_node);
}
assert(value_node);
@@
-176,11
+176,7
@@
synfig::ValueNode_Scale::operator()(Time t)const
return ret;
}
else if(get_type()==ValueBase::TYPE_INTEGER)
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<int>(ret-1);
- return static_cast<int>(ret);
- }
+ return round_to_int((*value_node)(t).get(int())*(*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)
else if(get_type()==ValueBase::TYPE_REAL)
return (*value_node)(t).get(Real())*(*scalar)(t).get(Real());
else if(get_type()==ValueBase::TYPE_TIME)
@@
-196,8
+192,7
@@
synfig::ValueNode_Scale::operator()(Time t)const
bool
ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x)
{
bool
ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x)
{
- if(!(i==0 || i==1))
- return false;
+ assert(i>=0 && i<link_count());
if(i==0 && !set_value_node(x))
return false;
if(i==0 && !set_value_node(x))
return false;
@@
-213,7
+208,8
@@
ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x)
ValueNode::LooseHandle
ValueNode_Scale::get_link_vfunc(int i)const
{
ValueNode::LooseHandle
ValueNode_Scale::get_link_vfunc(int i)const
{
- assert(i==0 || i==1);
+ assert(i>=0 && i<link_count());
+
if(i==0)
return value_node;
else if(i==1)
if(i==0)
return value_node;
else if(i==1)
@@
-230,7
+226,8
@@
ValueNode_Scale::link_count()const
String
ValueNode_Scale::link_local_name(int i)const
{
String
ValueNode_Scale::link_local_name(int i)const
{
- assert(i==0 || i==1);
+ assert(i>=0 && i<link_count());
+
if(i==0)
return _("Link");
else if(i==1)
if(i==0)
return _("Link");
else if(i==1)
@@
-241,7
+238,8
@@
ValueNode_Scale::link_local_name(int i)const
String
ValueNode_Scale::link_name(int i)const
{
String
ValueNode_Scale::link_name(int i)const
{
- assert(i==0 || i==1);
+ assert(i>=0 && i<link_count());
+
if(i==0)
return "link";
else if(i==1)
if(i==0)
return "link";
else if(i==1)