Browse Source

Add some TODOs

pull/613/head
James Jackson-South 8 years ago
parent
commit
88cb24266e
  1. 2
      src/ImageSharp/Common/Helpers/ImageMaths.cs
  2. 5
      src/ImageSharp/Formats/Png/PngEncoderCore.cs

2
src/ImageSharp/Common/Helpers/ImageMaths.cs

@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetBitsNeededForColorDepth(int colors) public static int GetBitsNeededForColorDepth(int colors)
{ {
return (int)Math.Ceiling(Math.Log(colors, 2)); return Math.Min(1, (int)Math.Ceiling(Math.Log(colors, 2)));
} }
/// <summary> /// <summary>

5
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -197,6 +197,7 @@ namespace SixLabors.ImageSharp.Formats.Png
} }
else else
{ {
// TODO: How do we set this in the options while keeping the value inline with the PngColorType?
this.bitDepth = 8; this.bitDepth = 8;
} }
@ -209,7 +210,7 @@ namespace SixLabors.ImageSharp.Formats.Png
bitDepth: this.bitDepth, bitDepth: this.bitDepth,
filterMethod: 0, // None filterMethod: 0, // None
compressionMethod: 0, compressionMethod: 0,
interlaceMethod: 0); interlaceMethod: 0); // TODO: Can't write interlaced yet.
this.WriteHeaderChunk(stream, header); this.WriteHeaderChunk(stream, header);
@ -281,6 +282,7 @@ namespace SixLabors.ImageSharp.Formats.Png
private void CollectTPixelBytes<TPixel>(ReadOnlySpan<TPixel> rowSpan) private void CollectTPixelBytes<TPixel>(ReadOnlySpan<TPixel> rowSpan)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
// TODO: We need to cater for 64bit mode here.
if (this.bytesPerPixel == 4) if (this.bytesPerPixel == 4)
{ {
PixelOperations<TPixel>.Instance.ToRgba32Bytes(rowSpan, this.rawScanline.Span, this.width); PixelOperations<TPixel>.Instance.ToRgba32Bytes(rowSpan, this.rawScanline.Span, this.width);
@ -400,6 +402,7 @@ namespace SixLabors.ImageSharp.Formats.Png
/// <returns>The <see cref="int"/></returns> /// <returns>The <see cref="int"/></returns>
private int CalculateBytesPerPixel() private int CalculateBytesPerPixel()
{ {
// TODO: Cater for 64 bit here and below
switch (this.pngColorType) switch (this.pngColorType)
{ {
case PngColorType.Grayscale: case PngColorType.Grayscale:

Loading…
Cancel
Save