private void DrawColorSlider(Rect colorSliderRect, Vector2 constantValues)
{
if (Event.current.type == EventType.Repaint)
{
if (this.m_ColorBoxMode != this.m_TextureColorSliderMode)
{
int width = 0;
int height = 0;
width = (int) this.m_ColorSliderSize;
if (this.m_ColorBoxMode == ColorBoxMode.SV_H)
{
height = 0x40;
}
else
{
height = (int) this.m_ColorSliderSize;
}
if (this.m_ColorSlider == null)
{
this.m_ColorSlider = MakeTexture(width, height);
}
if ((this.m_ColorSlider.width != width) || (this.m_ColorSlider.height != height))
{
this.m_ColorSlider.Resize(width, height);
}
}
if (((this.m_ColorBoxMode != this.m_TextureColorSliderMode) || (constantValues != this.m_LastConstantValues)) || this.m_ColorSliderDirty)
{
float tonemappingExposureAdjusment = this.GetTonemappingExposureAdjusment();
float colorScale = this.GetColorScale();
Color[] pixels = this.m_ColorSlider.GetPixels(0);
int xSize = this.m_ColorSlider.width;
int ySize = this.m_ColorSlider.height;
switch (this.m_ColorBoxMode)
{
case ColorBoxMode.SV_H:
FillArea(xSize, ySize, pixels, new Color(0f, 1f, 1f, 1f), new Color(0f, 0f, 0f, 0f), new Color(1f, 0f, 0f, 0f));
HSVToRGBArray(pixels, 1f);
break;
case ColorBoxMode.HV_S:
FillArea(xSize, ySize, pixels, new Color(this.m_H, 0f, Mathf.Max(this.m_V, 0.3f), 1f), new Color(0f, 0f, 0f, 0f), new Color(0f, 1f, 0f, 0f));
HSVToRGBArray(pixels, colorScale);
break;
case ColorBoxMode.HS_V:
FillArea(xSize, ySize, pixels, new Color(this.m_H, this.m_S, 0f, 1f), new Color(0f, 0f, 0f, 0f), new Color(0f, 0f, 1f, 0f));
HSVToRGBArray(pixels, colorScale);
break;
case ColorBoxMode.BG_R:
FillArea(xSize, ySize, pixels, new Color(0f, this.m_G * colorScale, this.m_B * colorScale, 1f), new Color(0f, 0f, 0f, 0f), new Color(colorScale, 0f, 0f, 0f));
break;
case ColorBoxMode.BR_G:
FillArea(xSize, ySize, pixels, new Color(this.m_R * colorScale, 0f, this.m_B * colorScale, 1f), new Color(0f, 0f, 0f, 0f), new Color(0f, colorScale, 0f, 0f));
break;
case ColorBoxMode.RG_B:
FillArea(xSize, ySize, pixels, new Color(this.m_R * colorScale, this.m_G * colorScale, 0f, 1f), new Color(0f, 0f, 0f, 0f), new Color(0f, 0f, colorScale, 0f));
break;
}
if (QualitySettings.activeColorSpace == ColorSpace.Linear)
{
LinearToGammaArray(pixels);
}
if (this.m_ColorBoxMode != ColorBoxMode.SV_H)
{
DoTonemapping(pixels, tonemappingExposureAdjusment, this.m_HDRValues.m_TonemappingType);
}
this.m_ColorSlider.SetPixels(pixels, 0);
this.m_ColorSlider.Apply(true);
}
Graphics.DrawTexture(colorSliderRect, this.m_ColorSlider, new Rect(0.5f / ((float) this.m_ColorSlider.width), 0.5f / ((float) this.m_ColorSlider.height), 1f - (1f / ((float) this.m_ColorSlider.width)), 1f - (1f / ((float) this.m_ColorSlider.height))), 0, 0, 0, 0, Color.grey);
}
}