public void Reset() { bool disposed = this.disposed; if (disposed) { DisposeHelper.NotifyDisposedUsed(this); } else { this.m_Allocator = new BestFitAllocator((uint)this.m_Length); UIRUtility.Destroy(this.m_Atlas); this.m_RawAtlas = default(GradientSettingsAtlas.RawTexture); this.MustCommit = false; } }
public void Write(Alloc alloc, GradientSettings[] settings, GradientRemap remap) { bool disposed = this.disposed; if (disposed) { DisposeHelper.NotifyDisposedUsed(this); } else { bool flag = this.m_RawAtlas.rgba == null; if (flag) { this.m_RawAtlas = new GradientSettingsAtlas.RawTexture { rgba = new Color32[this.m_ElemWidth * this.m_Length], width = this.m_ElemWidth, height = this.m_Length }; int num = this.m_ElemWidth * this.m_Length; for (int i = 0; i < num; i++) { this.m_RawAtlas.rgba[i] = Color.black; } } GradientSettingsAtlas.s_MarkerWrite.Begin(); int num2 = (int)alloc.start; int j = 0; int num3 = settings.Length; while (j < num3) { int num4 = 0; GradientSettings gradientSettings = settings[j]; Debug.Assert(remap == null || num2 == remap.destIndex); bool flag2 = gradientSettings.gradientType == GradientType.Radial; if (flag2) { Vector2 vector = gradientSettings.radialFocus; vector += Vector2.one; vector /= 2f; vector.y = 1f - vector.y; this.m_RawAtlas.WriteRawFloat4Packed(0.003921569f, (float)gradientSettings.addressMode / 255f, vector.x, vector.y, num4++, num2); } else { bool flag3 = gradientSettings.gradientType == GradientType.Linear; if (flag3) { this.m_RawAtlas.WriteRawFloat4Packed(0f, (float)gradientSettings.addressMode / 255f, 0f, 0f, num4++, num2); } } Vector2Int vector2Int = new Vector2Int(gradientSettings.location.x, gradientSettings.location.y); Vector2 vector2 = new Vector2((float)(gradientSettings.location.width - 1), (float)(gradientSettings.location.height - 1)); bool flag4 = remap != null; if (flag4) { vector2Int = new Vector2Int(remap.location.x, remap.location.y); vector2 = new Vector2((float)(remap.location.width - 1), (float)(remap.location.height - 1)); } this.m_RawAtlas.WriteRawInt2Packed(vector2Int.x, vector2Int.y, num4++, num2); this.m_RawAtlas.WriteRawInt2Packed((int)vector2.x, (int)vector2.y, num4++, num2); remap = ((remap != null) ? remap.next : null); num2++; j++; } this.MustCommit = true; GradientSettingsAtlas.s_MarkerWrite.End(); } }