[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Aug 25 20:44:41 CEST 2004


CVS commit by arwalker: 

On the off chance that no color can be found in the palette that is far enough away from badColor, makesure that we don't get stuck in an infinite loop.


  M +3 -1      kstcolorsequence.cpp   1.7


--- kdeextragear-2/kst/kst/kstcolorsequence.cpp  #1.6:1.7
@@ -53,4 +53,5 @@ QColor KstColorSequence::next(const QCol
   int sugH, sugS, sugV;
   int badH, badS, badV;
+  int start;
   suggestedColor.getHsv(sugH,sugS,sugV);
   badColor.getHsv(badH, badS, badV);
@@ -72,4 +73,5 @@ QColor KstColorSequence::next(const QCol
   y1 = r1*cos( h1 )*sin( f1 );
   z1 = r1*cos( f1 );
+  start = _self->_ptr;
   do {
     suggestedColor = _self->next();
@@ -82,5 +84,5 @@ QColor KstColorSequence::next(const QCol
     z2 = r2*cos( f2 );
     dc = sqrt( ( x1-x2 )*( x1-x2 ) + ( y1-y2 )*( y1-y2 ) + ( z1-z2 )*( z1-z2 ) );
-  } while ( dc < 0.3 );
+  } while ( dc < 0.3 && start != _self->_ptr );
 
   return QColor(suggestedColor);





More information about the Kst mailing list