Browse Source

fix bugs after merge

af/merge-core
Nikita Balabaev 9 years ago
parent
commit
4b8e4d4c41
  1. 11
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoder.cs
  2. 3
      src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
  3. 6
      src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoder.cs
  4. 2
      src/ImageSharp/Formats/PixelTypeInfo.cs
  5. 2
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  6. 2
      tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs
  7. 8
      tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs
  8. 10
      tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs
  9. 0
      tests/Images/Input/Bmp/bpp8.bmp
  10. 0
      tests/Images/Input/Png/bpp1.png
  11. 0
      tests/Images/Input/Png/gray_4bpp.png
  12. 0
      tests/Images/Input/Png/palette-8bpp.png

11
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoder.cs

@ -27,5 +27,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
return decoder.Decode<TPixel>(stream); return decoder.Decode<TPixel>(stream);
} }
} }
/// <inheritdoc/>
public PixelTypeInfo DetectPixelType(Configuration configuration, Stream stream)
{
Guard.NotNull(stream, "stream");
using (var decoder = new OrigJpegDecoderCore(configuration, this))
{
return new PixelTypeInfo(decoder.DetectPixelSize(stream));
}
}
} }
} }

3
src/ImageSharp/Formats/Jpeg/JpegDecoder.cs

@ -4,7 +4,6 @@
using System.IO; using System.IO;
using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort;
using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Formats.Jpeg namespace SixLabors.ImageSharp.Formats.Jpeg
@ -36,7 +35,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");
using (JpegDecoderCore decoder = new JpegDecoderCore(configuration, this)) using (var decoder = new OrigJpegDecoderCore(configuration, this))
{ {
return new PixelTypeInfo(decoder.DetectPixelSize(stream)); return new PixelTypeInfo(decoder.DetectPixelSize(stream));
} }

6
src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoder.cs

@ -27,5 +27,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
return decoder.Decode<TPixel>(stream); return decoder.Decode<TPixel>(stream);
} }
} }
/// <inheritdoc/>
public PixelTypeInfo DetectPixelType(Configuration configuration, Stream stream)
{
throw new System.NotImplementedException();
}
} }
} }

2
src/ImageSharp/Formats/PixelTypeInfo.cs

@ -1,4 +1,4 @@
namespace ImageSharp.Formats namespace SixLabors.ImageSharp.Formats
{ {
/// <summary> /// <summary>
/// Stores information about pixel /// Stores information about pixel

2
tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs

@ -8,6 +8,8 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests
{ {
using System.IO;
using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Bmp;
public class BmpDecoderTests : FileTestBase public class BmpDecoderTests : FileTestBase

2
tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs

@ -11,6 +11,8 @@ using Xunit;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests namespace SixLabors.ImageSharp.Tests
{ {
using System.IO;
public class GifDecoderTests public class GifDecoderTests
{ {
private const PixelTypes PixelTypes = Tests.PixelTypes.Rgba32 | Tests.PixelTypes.RgbaVector | Tests.PixelTypes.Argb32; private const PixelTypes PixelTypes = Tests.PixelTypes.Rgba32 | Tests.PixelTypes.RgbaVector | Tests.PixelTypes.Argb32;

8
tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs

@ -45,5 +45,13 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
} }
} }
} }
public PixelTypeInfo DetectPixelType(Configuration configuration, Stream stream)
{
using (var sourceBitmap = new System.Drawing.Bitmap(stream))
{
return new PixelTypeInfo(System.Drawing.Image.GetPixelFormatSize(sourceBitmap.PixelFormat));
}
}
} }
} }

10
tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

@ -83,6 +83,11 @@ namespace SixLabors.ImageSharp.Tests
return new Image<TPixel>(42, 42); return new Image<TPixel>(42, 42);
} }
public PixelTypeInfo DetectPixelType(Configuration configuration, Stream stream)
{
throw new NotImplementedException();
}
// Couldn't make xUnit happy without this hackery: // Couldn't make xUnit happy without this hackery:
private static ConcurrentDictionary<string, int> invocationCounts = new ConcurrentDictionary<string, int>(); private static ConcurrentDictionary<string, int> invocationCounts = new ConcurrentDictionary<string, int>();
@ -145,6 +150,11 @@ namespace SixLabors.ImageSharp.Tests
return new Image<TPixel>(42, 42); return new Image<TPixel>(42, 42);
} }
public PixelTypeInfo DetectPixelType(Configuration configuration, Stream stream)
{
throw new NotImplementedException();
}
private static ConcurrentDictionary<string, int> invocationCounts = new ConcurrentDictionary<string, int>(); private static ConcurrentDictionary<string, int> invocationCounts = new ConcurrentDictionary<string, int>();
private string callerName = null; private string callerName = null;

0
tests/ImageSharp.Tests/TestImages/Formats/Bmp/bpp8.bmp → tests/Images/Input/Bmp/bpp8.bmp

0
tests/ImageSharp.Tests/TestImages/Formats/Png/bpp1.png → tests/Images/Input/Png/bpp1.png

0
tests/ImageSharp.Tests/TestImages/Formats/Png/gray_4bpp.png → tests/Images/Input/Png/gray_4bpp.png

0
tests/ImageSharp.Tests/TestImages/Formats/Png/palette-8bpp.png → tests/Images/Input/Png/palette-8bpp.png

Loading…
Cancel
Save