public void Write(BinaryWriter writer)
        {
            writer.Write(TestName);
            writer.Write(CurrentVersion);
            writer.Write(Frame);

            // This call returns the pixels without any extra stride
            var pixels = Image.PixelBuffer[0].GetPixels<byte>();

            writer.Write(Image.PixelBuffer[0].Width);
            writer.Write(Image.PixelBuffer[0].Height);
            writer.Write((int)Image.PixelBuffer[0].Format);
            writer.Write(pixels.Length);

            // Write image data
            var lz4Stream = new LZ4Stream(writer.BaseStream, CompressionMode.Compress, false, pixels.Length);
            lz4Stream.Write(pixels, 0, pixels.Length);
            lz4Stream.Flush();
            writer.Flush();
        }
示例#2
0
        public void Write(BinaryWriter writer)
        {
            writer.Write(TestName);
            writer.Write(CurrentVersion);
            writer.Write(Frame);
            
            // This call returns the pixels without any extra stride
            var pixels = Image.PixelBuffer[0].GetPixels<byte>();

            writer.Write(Image.PixelBuffer[0].Width);
            writer.Write(Image.PixelBuffer[0].Height);
            writer.Write((int)Image.PixelBuffer[0].Format);
            writer.Write(pixels.Length);

            var sw = new Stopwatch();

            sw.Start();
            // Write image data
            var lz4Stream = new LZ4Stream(writer.BaseStream, CompressionMode.Compress, false, pixels.Length);
            lz4Stream.Write(pixels, 0, pixels.Length);
            lz4Stream.Flush();
            writer.BaseStream.Flush();
            sw.Stop();
#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            Console.WriteLine("Total calculation time: {0}", sw.Elapsed);
#else
            TestGameBase.TestGameLogger.Info("Total calculation time: {0}", sw.Elapsed);
#endif
            //writer.Write(pixels, 0, pixels.Length);
        }