AmaroK86.ImageFormat.ImageMipMapHandler.ImageMipMapDataSize C# (CSharp) Метод

ImageMipMapDataSize() приватный Метод

private ImageMipMapDataSize ( ImageSize imgsize, bool compressed, float BytesPerPixel ) : long
imgsize ImageSize
compressed bool
BytesPerPixel float
Результат long
        private long ImageMipMapDataSize(ImageSize imgsize, bool compressed, float BytesPerPixel)
        {
            uint w = imgsize.width;
            uint h = imgsize.height;
            if (compressed)
            {
                if (w < 4)
                    w = 4;
                if (h < 4)
                    h = 4;
            }
            long totalBytes = (long)(w * h * BytesPerPixel);
            w = imgsize.width;
            h = imgsize.height;
            if (w == 1 && h == 1)
                return totalBytes;
            if (w != 1)
                w = imgsize.width / 2;
            if (h != 1)
                h = imgsize.height / 2;
            return totalBytes + ImageMipMapDataSize(new ImageSize(w, h), compressed, BytesPerPixel);
        }