ComponentFactory.Krypton.Toolkit.RenderStandard.ApplyExcessSpace C# (CSharp) Method

ApplyExcessSpace() private static method

private static ApplyExcessSpace ( int excess, int &cells ) : void
excess int
cells int
return void
        private static void ApplyExcessSpace(int excess, ref int[] cells)
        {
            // If there is already some space in the center
            if (cells[1] > 0)
            {
                // Then all the excess to the centre
                cells[1] += excess;
            }
            else if (cells[2] == 0)
            {
                // Only the near cell is used, so give all excess to it
                cells[0] += excess;
            }
            else if (cells[0] == 0)
            {
                // Only the far cell is used, so give all excess to it
                cells[2] += excess;
            }
            else
            {
                int half = excess / 2;

                // Space in the near and the far, so give half to each
                cells[0] += half;
                cells[2] += (excess - half);
            }
        }
RenderStandard