Exemplo n.º 1
0
        protected virtual void Dispose(bool disposing)
        {
            bool disposed = this.disposed;

            if (!disposed)
            {
                if (disposing)
                {
                    for (int i = 0; i < this.m_OpenRows.Length; i++)
                    {
                        UIRAtlasAllocator.Row row = this.m_OpenRows[i];
                        bool flag = row != null;
                        if (flag)
                        {
                            row.Release();
                        }
                    }
                    this.m_OpenRows = null;
                    UIRAtlasAllocator.AreaNode next;
                    for (UIRAtlasAllocator.AreaNode areaNode = this.m_FirstUnpartitionedArea; areaNode != null; areaNode = next)
                    {
                        next = areaNode.next;
                        areaNode.Release();
                    }
                    this.m_FirstUnpartitionedArea = null;
                }
                this.disposed = true;
            }
        }
Exemplo n.º 2
0
        private bool TryPartitionArea(UIRAtlasAllocator.AreaNode areaNode, int rowIndex, int rowHeight, int minWidth)
        {
            RectInt rect = areaNode.rect;
            bool    flag = rect.height < rowHeight || rect.width < minWidth;
            bool    result;

            if (flag)
            {
                result = false;
            }
            else
            {
                UIRAtlasAllocator.Row row = this.m_OpenRows[rowIndex];
                bool flag2 = row != null;
                if (flag2)
                {
                    row.Release();
                }
                row = UIRAtlasAllocator.Row.Acquire(rect.x, rect.y, rect.width, rowHeight);
                this.m_OpenRows[rowIndex] = row;
                rect.y      += rowHeight;
                rect.height -= rowHeight;
                bool flag3 = rect.height == 0;
                if (flag3)
                {
                    bool flag4 = areaNode == this.m_FirstUnpartitionedArea;
                    if (flag4)
                    {
                        this.m_FirstUnpartitionedArea = areaNode.next;
                    }
                    areaNode.RemoveFromChain();
                    areaNode.Release();
                }
                else
                {
                    areaNode.rect = rect;
                }
                result = true;
            }
            return(result);
        }