Multiplying a gradient by zero empties it.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 16 Sep 2007 00:54:26 +0000 (00:54 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 16 Sep 2007 00:54:26 +0000 (00:54 +0000)
git-svn-id: http://svn.voria.com/code@677 1f10aa63-cdf2-0310-b900-c93c546f37ac

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

index 2411006..29f3055 100644 (file)
@@ -210,8 +210,11 @@ synfig::Gradient::operator-=(const Gradient &rhs)
 Gradient &
 synfig::Gradient::operator*=(const float    &rhs)
 {
-       for (iterator iter = cpoints.begin(); iter!=cpoints.end(); iter++)
-               (*iter).color *= rhs;
+       if (rhs == 0)
+               cpoints.clear();
+       else
+               for (iterator iter = cpoints.begin(); iter!=cpoints.end(); iter++)
+                       (*iter).color *= rhs;
        return *this;
 }