示例#1
0
        public unsafe void DecompressIntPtrToIntPtr(
            [Values(
                 PixelFormat.Format32bppArgb,
                 PixelFormat.Format24bppRgb,
                 PixelFormat.Format8bppIndexed)] PixelFormat format)
        {
            foreach (var data in TestUtils.GetTestImagesData("*.jpg"))
            {
                var dataPtr = TJUtils.CopyDataToPointer(data.Item2);

                Assert.DoesNotThrow(() =>
                {
                    _decompressor.GetImageInfo(dataPtr, (ulong)data.Item2.Length, TestUtils.ConvertPixelFormat(format), out var width, out var height, out var stride, out var decompressedBufferSize);

                    var decompressed = new byte[decompressedBufferSize];
                    fixed(byte *ptr  = decompressed)
                    {
                        _decompressor.Decompress(
                            dataPtr,
                            (ulong)data.Item2.Length,
                            (IntPtr)ptr,
                            decompressedBufferSize,
                            TestUtils.ConvertPixelFormat(format),
                            TJFlags.NONE);
                    }

                    Assert.IsTrue(decompressed.Any(b => b != 0));
                });
                TJUtils.FreePtr(dataPtr);
            }
        }
示例#2
0
 public void DecompressIntPtr(
     [CombinatorialValues(
          PixelFormat.Format32bppArgb,
          PixelFormat.Format24bppRgb,
          PixelFormat.Format8bppIndexed)]
     PixelFormat format)
 {
     foreach (var data in TestUtils.GetTestImagesData("*.jpg"))
     {
         var dataPtr = TJUtils.CopyDataToPointer(data.Item2);
         var result  = this.decompressor.Decompress(dataPtr, (ulong)data.Item2.Length, format, TJFlags.None);
         Assert.NotNull(result);
         TJUtils.FreePtr(dataPtr);
     }
 }
 public void DecompressIntPtr(
     [CombinatorialValues(
          SKColorType.Bgra8888,
          SKColorType.Rgba8888,
          SKColorType.Rgb888x)]
     SKColorType format)
 {
     foreach (var data in TestUtils.GetTestImagesData("*.jpg"))
     {
         var dataPtr = TJUtils.CopyDataToPointer(data.Item2);
         var result  = this.decompressor.Decompress(dataPtr, (ulong)data.Item2.Length, format, TJFlags.None);
         Assert.NotNull(result);
         TJUtils.FreePtr(dataPtr);
     }
 }
示例#4
0
 public void DecompressIntPtr(
     [Values(
          PixelFormat.Format32bppArgb,
          PixelFormat.Format24bppRgb,
          PixelFormat.Format8bppIndexed)] PixelFormat format)
 {
     foreach (var data in TestUtils.GetTestImagesData("*.jpg"))
     {
         var dataPtr = TJUtils.CopyDataToPointer(data.Item2);
         Assert.DoesNotThrow(() =>
         {
             var result = _decompressor.Decompress(dataPtr, (ulong)data.Item2.Length, TestUtils.ConvertPixelFormat(format), TJFlags.NONE);
             Assert.NotNull(result);
         });
         TJUtils.FreePtr(dataPtr);
     }
 }