From 88cb24266e35f4124145b93d7800dfe06bdf4130 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 14 Jun 2018 00:50:22 +1000 Subject: [PATCH] Add some TODOs --- src/ImageSharp/Common/Helpers/ImageMaths.cs | 2 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index 8a2ece4bed..819fa4d700 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp [MethodImpl(MethodImplOptions.AggressiveInlining)] 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))); } /// diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index f17c9009a6..ce9eb60086 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -197,6 +197,7 @@ namespace SixLabors.ImageSharp.Formats.Png } else { + // TODO: How do we set this in the options while keeping the value inline with the PngColorType? this.bitDepth = 8; } @@ -209,7 +210,7 @@ namespace SixLabors.ImageSharp.Formats.Png bitDepth: this.bitDepth, filterMethod: 0, // None compressionMethod: 0, - interlaceMethod: 0); + interlaceMethod: 0); // TODO: Can't write interlaced yet. this.WriteHeaderChunk(stream, header); @@ -281,6 +282,7 @@ namespace SixLabors.ImageSharp.Formats.Png private void CollectTPixelBytes(ReadOnlySpan rowSpan) where TPixel : struct, IPixel { + // TODO: We need to cater for 64bit mode here. if (this.bytesPerPixel == 4) { PixelOperations.Instance.ToRgba32Bytes(rowSpan, this.rawScanline.Span, this.width); @@ -400,6 +402,7 @@ namespace SixLabors.ImageSharp.Formats.Png /// The private int CalculateBytesPerPixel() { + // TODO: Cater for 64 bit here and below switch (this.pngColorType) { case PngColorType.Grayscale: