//
// cocos2d::extension::CCControlUtils::RGBfromHSV from 0x1001d3f7c to 0x1001d4074 (248 bytes)
//
// 9 xrefs:
// > GameToolbox::transformColor_1 @ 0x100044e84
// > ColorSelectLiveOverlay::sliderChanged @ 0x1000f5f04
// > ColorSelectLiveOverlay::sliderChanged @ 0x1000f5f54
// > ColorSelectLiveOverlay::sliderChanged @ 0x1000f5f9c
// > ColorSelectLiveOverlay::selectColor @ 0x1000f61dc
// > ColorSelectLiveOverlay::selectColor @ 0x1000f622c
// > cocos2d::extension::CCControlColourPicker::hueSliderValueChanged @ 0x1001ae538
// > cocos2d::extension::CCControlColourPicker::colourSliderValueChanged @ 0x1001ae620
// > cocos2d::extension::CCControlSaturationBrightnessPicker::updateWithHSV @ 0x1001be004
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
double __fastcall cocos2d::extension::CCControlUtils::RGBfromHSV(double a1, double a2, double a3)
{
double v3; // d3
bool v4; // nf
double v5; // d0
__int64 v6; // x8
double v7; // d0
if ( a2 <= 0.0 )
return a3;
v3 = a1 * 0.0166666675;
v4 = a1 < 360.0;
v5 = 0.0;
if ( v4 )
v5 = v3;
v6 = (__int64)v5;
v7 = v5 - (double)(__int64)v5;
if ( v6 <= 1 )
{
if ( !v6 )
return a3;
if ( v6 == 1 )
return a3 * (1.0 - a2 * v7);
}
else
{
switch ( v6 )
{
case 2LL:
return a3 * (1.0 - a2);
case 3LL:
return a3 * (1.0 - a2);
case 4LL:
return a3 * (1.0 - a2 * (1.0 - v7));
}
}
return a3;
}