From: dooglus Date: Sun, 16 Sep 2007 00:54:26 +0000 (+0000) Subject: Multiplying a gradient by zero empties it. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c0293e1a2e3d68c53e2ad07bd5be9066b202771d;p=synfig.git Multiplying a gradient by zero empties it. git-svn-id: http://svn.voria.com/code@677 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/gradient.cpp b/synfig-core/trunk/src/synfig/gradient.cpp index 2411006..29f3055 100644 --- a/synfig-core/trunk/src/synfig/gradient.cpp +++ b/synfig-core/trunk/src/synfig/gradient.cpp @@ -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; }