private void DrawColorSpaceBox(Rect colorBoxRect, float constantValue)
{
if (Event.current.type != EventType.Repaint)
{
return;
}
if (this.m_ColorBoxMode != (ColorPicker.ColorBoxMode) this.m_TextureColorBoxMode)
{
int num = 8;
int num2;
if (this.m_ColorBoxMode == ColorPicker.ColorBoxMode.HV_S || this.m_ColorBoxMode == ColorPicker.ColorBoxMode.HS_V)
{
num2 = 64;
}
else
{
num2 = 8;
}
if (this.m_ColorBox == null)
{
this.m_ColorBox = ColorPicker.MakeTexture(num2, num);
}
if (this.m_ColorBox.width != num2 || this.m_ColorBox.height != num)
{
this.m_ColorBox.Resize(num2, num);
}
}
if (this.m_ColorBoxMode != (ColorPicker.ColorBoxMode) this.m_TextureColorBoxMode || this.m_LastConstant != constantValue)
{
this.m_Colors = this.m_ColorBox.GetPixels(0);
int width = this.m_ColorBox.width;
int height = this.m_ColorBox.height;
switch (this.m_ColorBoxMode)
{
case ColorPicker.ColorBoxMode.SV_H:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(this.m_H, 0f, 0f, 1f), new Color(0f, 1f, 0f, 0f), new Color(0f, 0f, 1f, 0f));
ColorPicker.HSVToRGBArray(this.m_Colors);
break;
case ColorPicker.ColorBoxMode.HV_S:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(0f, this.m_S, 0f, 1f), new Color(1f, 0f, 0f, 0f), new Color(0f, 0f, 1f, 0f));
ColorPicker.HSVToRGBArray(this.m_Colors);
break;
case ColorPicker.ColorBoxMode.HS_V:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(0f, 0f, this.m_V, 1f), new Color(1f, 0f, 0f, 0f), new Color(0f, 1f, 0f, 0f));
ColorPicker.HSVToRGBArray(this.m_Colors);
break;
case ColorPicker.ColorBoxMode.BG_R:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(this.m_R, 0f, 0f, 1f), new Color(0f, 0f, 1f, 0f), new Color(0f, 1f, 0f, 0f));
break;
case ColorPicker.ColorBoxMode.BR_G:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(0f, this.m_G, 0f, 1f), new Color(0f, 0f, 1f, 0f), new Color(1f, 0f, 0f, 0f));
break;
case ColorPicker.ColorBoxMode.RG_B:
ColorPicker.FillArea(width, height, this.m_Colors, new Color(0f, 0f, this.m_B, 1f), new Color(1f, 0f, 0f, 0f), new Color(0f, 1f, 0f, 0f));
break;
}
if (QualitySettings.activeColorSpace == ColorSpace.Linear)
{
ColorPicker.LinearToGammaArray(this.m_Colors);
}
this.m_ColorBox.SetPixels(this.m_Colors, 0);
this.m_ColorBox.Apply(true);
this.m_LastConstant = constantValue;
this.m_TextureColorBoxMode = (int)this.m_ColorBoxMode;
}
Graphics.DrawTexture(colorBoxRect, this.m_ColorBox, new Rect(0.5f / (float)this.m_ColorBox.width, 0.5f / (float)this.m_ColorBox.height, 1f - 1f / (float)this.m_ColorBox.width, 1f - 1f / (float)this.m_ColorBox.height), 0, 0, 0, 0, Color.grey);
}