From 5ee1c7ff801b475b4447c5ee6db4a77d0f75f532 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 19 Sep 2012 20:53:34 -0400 Subject: [PATCH] Fix incorrect deco colors being selected --- src/colourpicker/ColourPickerActivity.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/colourpicker/ColourPickerActivity.cpp b/src/colourpicker/ColourPickerActivity.cpp index 9436311d0..65bccc99a 100644 --- a/src/colourpicker/ColourPickerActivity.cpp +++ b/src/colourpicker/ColourPickerActivity.cpp @@ -39,8 +39,6 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke g = format::StringToNumber(a->gValue->GetText()); b = format::StringToNumber(a->bValue->GetText()); alpha = format::StringToNumber(a->aValue->GetText()); - RGB_to_HSV(r, g, b, &a->currentHue, &a->currentSaturation, &a->currentValue); - if (r > 255) r = 255; if (g > 255) @@ -49,6 +47,8 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke b = 255; if (alpha > 255) alpha = 255; + + RGB_to_HSV(r, g, b, &a->currentHue, &a->currentSaturation, &a->currentValue); a->currentAlpha = alpha; a->UpdateTextboxes(r, g, b, alpha); } @@ -89,7 +89,9 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke void ActionCallback(ui::Button * sender) { int Red, Green, Blue; - HSV_to_RGB(a->currentHue, a->currentSaturation, a->currentValue, &Red, &Green, &Blue); + Red = format::StringToNumber(a->rValue->GetText()); + Green = format::StringToNumber(a->gValue->GetText()); + Blue = format::StringToNumber(a->bValue->GetText()); ui::Colour col(Red, Green, Blue, a->currentAlpha); if(a->callback) a->callback->ColourPicked(col);