Engines/FlatRedBallXNA/FlatRedBall/IO/PngLoader.cs
/// <summary>
/// Reads the decompressed(inflated) image data from an InflaterInputStream that was fed the compressed
/// image.
/// </summary>
/// <param name="array">The byte[] to store the decompressed bytes of the image in.</param>
/// <param name="stream">The InflaterInputStream that contains the deflated(compressed) image.</param>
Reads the decompressed(inflated) image data from an InflaterInputStream that was fed the compressed
image.
Reads the decompressed ( inflated ) image data from an InflaterInputStream that was fed the compressed image .
private static void ReadStream(ref InflaterInputStream stream)
        {
            int totalRead = 0;
            int read;
            while ((read = stream.Read(sByteBuffer, totalRead, sByteBuffer.Length - totalRead)) > 0)
            {
                totalRead += read;
                if (totalRead == sByteBuffer.Length)
                {
                    byte[] newArray = new byte[sByteBuffer.Length * 2];
                    Array.Copy(sByteBuffer, newArray, sByteBuffer.Length);
                    sByteBuffer = newArray;
                }
            }
        }
private static void ReadStream ( ref InflaterInputStream stream ) { int totalRead = 0 ; int read ; while ( ( read = stream . Read ( sByteBuffer , totalRead , sByteBuffer . Length - totalRead ) ) > 0 ) { totalRead += read ; if ( totalRead == sByteBuffer . Length ) { byte [ ] newArray = new byte [ sByteBuffer . Length * 2 ] ; Array . Copy ( sByteBuffer , newArray , sByteBuffer . Length ) ; sByteBuffer = newArray ; } } }
Reads the decompressed(inflated) image data from an InflaterInputStream that was fed the compressed
image.
Reads the decompressed ( inflated ) image data from an InflaterInputStream that was fed the compressed image .
//Read as many bytes as possible into array //update the total number of bytes read //if array is full //Copy into a larger array and repeat
InflaterInputStream
ref
array
The byte[] to store the decompressed bytes of the image in.
The byte [] to store the decompressed bytes of the image in .
stream
The InflaterInputStream that contains the deflated(compressed) image.
The InflaterInputStream that contains the deflated ( compressed ) image .