private void updateRectangles()
    {
        DateTime  start   = DateTime.Now;
        const int padding = 1;

        if (mPacker == null)
        {
            mPacker = new RectanglePacker((int)sliderWidth.value, (int)sliderHeight.value, padding);
        }
        else
        {
            mPacker.Reset((int)sliderWidth.value, (int)sliderHeight.value, padding);
        }

        for (int i = 0; i < RECTANGLE_COUNT; i++)
        {
            mPacker.InsertRectangle((int)mRectangles[i].width, (int)mRectangles[i].height, i);
        }

        mPacker.PackRectangles();

        DateTime end = DateTime.Now;

        if (mPacker.rectangleCount > 0)
        {
            packingTimeText.text = mPacker.rectangleCount + " rectangles packed in " + (end - start).Milliseconds + "ms";

            mTexture.SetPixels32(mFillColor);
            IntegerRectangle rect = new IntegerRectangle();
            Color32[]        tmpColor;

            for (int j = 0; j < mPacker.rectangleCount; j++)
            {
                rect = mPacker.GetRectangle(j, rect);

                int size = rect.width * rect.height;

                tmpColor = new Color32[size];
                for (int k = 0; k < size; ++k)
                {
                    tmpColor[k] = Color.black;
                }

                mTexture.SetPixels32(rect.x, rect.y, rect.width, rect.height, tmpColor);

                int   index = mPacker.GetRectangleId(j);
                Color color = convertHexToRGBA((uint)(0xFF171703 + (((18 * ((index + 4) % 13)) << 16) + ((31 * ((index * 3) % 8)) << 8) + 63 * (((index + 1) * 3) % 5))));

                size -= 4;

                tmpColor = new Color32[size];
                for (int k = 0; k < size; ++k)
                {
                    tmpColor[k] = color;
                }

                mTexture.SetPixels32(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2, tmpColor);
            }

            mTexture.Apply();
        }
    }