DrawTiledTexture() private static method

private static DrawTiledTexture ( Rect rect, Texture tex ) : void
rect UnityEngine.Rect
tex UnityEngine.Texture
return void
        private static void DrawSprite(Texture tex, Rect drawArea, Vector4 padding, Rect outer, Rect inner, Rect uv, Color color, Material mat)
        {
            Rect position = drawArea;

            position.width  = Mathf.Abs(outer.width);
            position.height = Mathf.Abs(outer.height);
            if (position.width > 0f)
            {
                float num = drawArea.width / position.width;
                position.width  *= num;
                position.height *= num;
            }
            if (drawArea.height > position.height)
            {
                position.y += (drawArea.height - position.height) * 0.5f;
            }
            else if (position.height > drawArea.height)
            {
                float num2 = drawArea.height / position.height;
                position.width  *= num2;
                position.height *= num2;
            }
            if (drawArea.width > position.width)
            {
                position.x += (drawArea.width - position.width) * 0.5f;
            }
            EditorGUI.DrawTextureTransparent(position, null, ScaleMode.ScaleToFit, outer.width / outer.height);
            GUI.color = color;
            Rect position2 = new Rect(position.x + position.width * padding.x, position.y + position.height * padding.w, position.width - position.width * (padding.z + padding.x), position.height - position.height * (padding.w + padding.y));

            if (mat == null)
            {
                GUI.DrawTextureWithTexCoords(position2, tex, uv, true);
            }
            else
            {
                EditorGUI.DrawPreviewTexture(position2, tex, mat);
            }
            GUI.BeginGroup(position);
            tex       = SpriteDrawUtility.contrastTexture;
            GUI.color = Color.white;
            if (inner.xMin != outer.xMin)
            {
                float x = (inner.xMin - outer.xMin) / outer.width * position.width - 1f;
                SpriteDrawUtility.DrawTiledTexture(new Rect(x, 0f, 1f, position.height), tex);
            }
            if (inner.xMax != outer.xMax)
            {
                float x2 = (inner.xMax - outer.xMin) / outer.width * position.width - 1f;
                SpriteDrawUtility.DrawTiledTexture(new Rect(x2, 0f, 1f, position.height), tex);
            }
            if (inner.yMin != outer.yMin)
            {
                float num3 = (inner.yMin - outer.yMin) / outer.height * position.height - 1f;
                SpriteDrawUtility.DrawTiledTexture(new Rect(0f, position.height - num3, position.width, 1f), tex);
            }
            if (inner.yMax != outer.yMax)
            {
                float num4 = (inner.yMax - outer.yMin) / outer.height * position.height - 1f;
                SpriteDrawUtility.DrawTiledTexture(new Rect(0f, position.height - num4, position.width, 1f), tex);
            }
            GUI.EndGroup();
        }
        private static void DrawSprite(Texture tex, Rect drawArea, Vector4 padding, Rect outer, Rect inner, Rect uv, Color color, Material mat)
        {
            Rect position1 = drawArea;

            position1.width  = Mathf.Abs(outer.width);
            position1.height = Mathf.Abs(outer.height);
            if ((double)position1.width > 0.0)
            {
                float num = drawArea.width / position1.width;
                position1.width  *= num;
                position1.height *= num;
            }
            if ((double)drawArea.height > (double)position1.height)
            {
                position1.y += (float)(((double)drawArea.height - (double)position1.height) * 0.5);
            }
            else if ((double)position1.height > (double)drawArea.height)
            {
                float num = drawArea.height / position1.height;
                position1.width  *= num;
                position1.height *= num;
            }
            if ((double)drawArea.width > (double)position1.width)
            {
                position1.x += (float)(((double)drawArea.width - (double)position1.width) * 0.5);
            }
            EditorGUI.DrawTextureTransparent(position1, (Texture)null, ScaleMode.ScaleToFit, outer.width / outer.height);
            GUI.color = color;
            Rect position2 = new Rect(position1.x + position1.width * padding.x, position1.y + position1.height * padding.w, position1.width - position1.width * (padding.z + padding.x), position1.height - position1.height * (padding.w + padding.y));

            if ((Object)mat == (Object)null)
            {
                GUI.DrawTextureWithTexCoords(position2, tex, uv, true);
            }
            else
            {
                EditorGUI.DrawPreviewTexture(position2, tex, mat);
            }
            GUI.BeginGroup(position1);
            tex       = (Texture)SpriteDrawUtility.contrastTexture;
            GUI.color = Color.white;
            if ((double)inner.xMin != (double)outer.xMin)
            {
                SpriteDrawUtility.DrawTiledTexture(new Rect((float)(((double)inner.xMin - (double)outer.xMin) / (double)outer.width * (double)position1.width - 1.0), 0.0f, 1f, position1.height), tex);
            }
            if ((double)inner.xMax != (double)outer.xMax)
            {
                SpriteDrawUtility.DrawTiledTexture(new Rect((float)(((double)inner.xMax - (double)outer.xMin) / (double)outer.width * (double)position1.width - 1.0), 0.0f, 1f, position1.height), tex);
            }
            if ((double)inner.yMin != (double)outer.yMin)
            {
                float num = (float)(((double)inner.yMin - (double)outer.yMin) / (double)outer.height * (double)position1.height - 1.0);
                SpriteDrawUtility.DrawTiledTexture(new Rect(0.0f, position1.height - num, position1.width, 1f), tex);
            }
            if ((double)inner.yMax != (double)outer.yMax)
            {
                float num = (float)(((double)inner.yMax - (double)outer.yMin) / (double)outer.height * (double)position1.height - 1.0);
                SpriteDrawUtility.DrawTiledTexture(new Rect(0.0f, position1.height - num, position1.width, 1f), tex);
            }
            GUI.EndGroup();
        }