From a3eb174f9474378913721740a8f7c64e86fd2f21 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Wed, 9 Dec 2020 20:36:19 +0100 Subject: [PATCH] Remove not needed ToRgba() --- .../Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs | 4 ++-- .../Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs | 4 ++-- .../Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs | 4 ++-- .../Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs index 8ad3a3b5a0..ecfae2c9be 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs @@ -26,8 +26,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff int offset = 0; - var black = Color.Black.ToRgba32(); - var white = Color.White.ToRgba32(); + Color black = Color.Black; + Color white = Color.White; for (int y = top; y < top + height; y++) { for (int x = left; x < left + width; x += 8) diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs index 7fef9ddf62..ddbae32423 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs @@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff public BlackIsZeroTiffColor(ushort[] bitsPerSample) { this.bitsPerSample0 = bitsPerSample[0]; - this.factor = (float)(1 << this.bitsPerSample0) - 1.0f; + this.factor = (1 << this.bitsPerSample0) - 1.0f; } /// @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff for (int x = left; x < left + width; x++) { int value = bitReader.ReadBits(this.bitsPerSample0); - float intensity = ((float)value) / this.factor; + float intensity = value / this.factor; color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f)); pixels[x, y] = color; diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs index b3e7027aa7..2a7010f5f2 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs @@ -25,8 +25,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff int offset = 0; - var black = Color.Black.ToRgba32(); - var white = Color.White.ToRgba32(); + Color black = Color.Black; + Color white = Color.White; for (int y = top; y < top + height; y++) { for (int x = left; x < left + width; x += 8) diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs index a34927c8dc..0ce1df8d8f 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff for (int x = left; x < left + width; x++) { int value = bitReader.ReadBits(this.bitsPerSample0); - float intensity = 1.0f - (((float)value) / this.factor); + float intensity = 1.0f - (value / this.factor); color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f)); pixels[x, y] = color;