r16463 by jghali - #9856: Frequent ""Unable to find the requested color..." error in colorwheel widget

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 20 13:48:50 CET 2011


Author: jghali
Date: Sun Mar 20 12:48:49 2011
New Revision: 16463

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16463
Log:
#9856: Frequent ""Unable to find the requested color..." error in colorwheel widget

Modified:
    branches/Version135/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp

Modified: branches/Version135/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16463&path=/branches/Version135/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp Sun Mar 20 12:48:49 2011
@@ -305,25 +305,26 @@
 
 bool ColorWheel::recomputeColor(ScColor col)
 {
+	int angle;
 	int origh, origs, origv;
 	ColorMap::iterator it;
 	QColor c(ScColorEngine::getRGBColor(col, currentDoc));
 	QColor act(ScColorEngine::getRGBColor(actualColor, currentDoc));
 
 	c.getHsv(&origh, &origs, &origv);
-	for (it = colorMap.begin(); it != colorMap.end(); ++it)
+	angle = origh + angleShift;
+	if (angle > 359)
+		angle -= 360;
+	if (colorMap.contains(angle))
 	{
 		int tmph, tmps, tmpv;
-		QColor col(ScColorEngine::getRGBColor(it.value(), currentDoc));
+		QColor col(ScColorEngine::getRGBColor(colorMap[angle], currentDoc));
 		col.getHsv(&tmph, &tmps, &tmpv);
-		if (origh == tmph)
-		{
-			act.setHsv(tmph, origs, origv);
-			actualColor.fromQColor(act);
-			actualColor = ScColorEngine::convertToModel(actualColor, currentDoc, currentColorSpace);
-			baseAngle = it.key();
-			return true;
-		}
+		act.setHsv(tmph , origs, origv);
+		actualColor.fromQColor(act);
+		actualColor = ScColorEngine::convertToModel(actualColor, currentDoc, currentColorSpace);
+		baseAngle = angle;
+		return true;
 	}
 	return false;
 }




More information about the scribus-commit mailing list