diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-12-15 09:03:52 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-12-15 09:03:52 -0500 |
commit | aa57e9e03284593513c554b9190499f247fbbaca (patch) | |
tree | d9e4ac59131f5b4f84e9f6ce3df9b9e8f1230194 /libs/canvas/colors.cc | |
parent | 4908685d5ea40812ad0d5ccbf1da6acc81e12ac8 (diff) |
more fixes to SVAModifier constructor(s)
Diffstat (limited to 'libs/canvas/colors.cc')
-rw-r--r-- | libs/canvas/colors.cc | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/libs/canvas/colors.cc b/libs/canvas/colors.cc index f955e13c05..b66828937e 100644 --- a/libs/canvas/colors.cc +++ b/libs/canvas/colors.cc @@ -548,12 +548,24 @@ SVAModifier::from_string (string const & str) switch (op) { case '*': type = Multiply; + /* no-op values for multiply */ + s = 1.0; + v = 1.0; + a = 1.0; break; case '+': type = Add; + /* no-op values for add */ + s = 0.0; + v = 0.0; + a = 1.0; break; case '=': type = Assign; + /* this will avoid assignment in operator() (see below) */ + s = -1.0; + v = -1.0; + a = -1.0; break; default: throw failed_constructor (); @@ -564,11 +576,11 @@ SVAModifier::from_string (string const & str) while (ss) { ss >> mod; if ((pos = mod.find ("alpha:")) != string::npos) { - a = PBD::atoi (mod.substr (pos+6)); + a = PBD::atof (mod.substr (pos+6)); } else if ((pos = mod.find ("saturate:")) != string::npos) { - s = PBD::atoi (mod.substr (pos+9)); + s = PBD::atof (mod.substr (pos+9)); } else if ((pos = mod.find ("darkness:")) != string::npos) { - v = PBD::atoi (mod.substr (pos+9)); + v = PBD::atof (mod.substr (pos+9)); } else { throw failed_constructor (); } @@ -625,9 +637,15 @@ SVAModifier::operator () (HSV& hsv) const r.a *= a; break; case Assign: - r.s = s; - r.v = v; - r.a = a; + if (s > -1.0) { + r.s = s; + } + if (v > -1.0) { + r.v = v; + } + if (a > -1.0) { + r.a = a; + } break; } |