Browse Source

Little bit of cleanup

af/merge-core
James Jackson-South 10 years ago
parent
commit
9a54460312
  1. 3
      src/ImageSharp/Formats/Jpg/Components/Huffman.cs
  2. 1
      src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs
  3. 6
      src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
  4. 3
      src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs
  5. 4
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  6. 24
      src/ImageSharp/Profiles/Exif/ExifValue.cs
  7. 13
      src/ImageSharp/Profiles/Exif/ExifWriter.cs

3
src/ImageSharp/Formats/Jpg/Components/Huffman.cs

@ -23,9 +23,8 @@ namespace ImageSharp.Formats
this.Lut = UshortBuffer.Rent(1 << lutSize);
this.Values = ByteBuffer.Rent(maxNCodes);
this.MinCodes = IntBuffer.Rent(maxCodeLength);
this.MaxCodes = IntBuffer.Rent(maxCodeLength);
this.MaxCodes = IntBuffer.Rent(maxCodeLength);
this.Indices = IntBuffer.Rent(maxCodeLength);
}
/// <summary>

1
src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs

@ -43,6 +43,7 @@ namespace ImageSharp.Formats
{
return this.Data[idx + this.Offset];
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set
{

6
src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs

@ -89,7 +89,6 @@ namespace ImageSharp.Formats
/// <summary>
/// The huffman trees
/// </summary>
//private readonly Huffman[,] huffmanTrees;
private readonly Huffman[] huffmanTrees;
/// <summary>
@ -1310,7 +1309,7 @@ namespace ImageSharp.Formats
struct StackallocUnzigData
{
internal fixed int Data [64];
internal fixed int Data[64];
}
/// <summary>
@ -1508,7 +1507,7 @@ namespace ImageSharp.Formats
fixed (Block8x8F* qtp = &this.quantizationTables[qtIndex])
{
if (this.isProgressive)
// Load the previous partially decoded coefficients, if applicable.
// Load the previous partially decoded coefficients, if applicable.
{
this.blockIndex = ((@by * mxx) * hi) + bx;
@ -2172,6 +2171,7 @@ namespace ImageSharp.Formats
{
this.huffmanTrees[i].Dispose();
}
this.bytes.Dispose();
}
}

3
src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs

@ -542,10 +542,11 @@ namespace ImageSharp.Formats
/// <param name="crBlock">The blue chroma block.</param>
// ReSharper disable StyleCop.SA1305
private void ToYCbCr<TColor, TPacked>(PixelAccessor<TColor, TPacked> pixels, int x, int y, ref Block yBlock, ref Block cbBlock, ref Block crBlock)
// ReSharper restore StyleCop.SA1305
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
// ReSharper restore StyleCop.SA1305
int xmax = pixels.Width - 1;
int ymax = pixels.Height - 1;
byte[] color = new byte[3];

4
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -30,12 +30,12 @@ namespace ImageSharp.Formats
private static readonly int[] Adam7ColumnIncrement = { 8, 8, 4, 4, 2, 2, 1 };
/// <summary>
/// The index to start at when processing each column per scanline for each interlaced pass
/// The index to start at when processing each column per scanline for each interlaced pass
/// </summary>
private static readonly int[] Adam7FirstColumn = { 0, 4, 0, 2, 0, 1, 0 };
/// <summary>
/// The index to start at when processing each row per scanline for each interlaced pass
/// The index to start at when processing each row per scanline for each interlaced pass
/// </summary>
private static readonly int[] Adam7FirstRow = { 0, 0, 4, 0, 2, 0, 1 };

24
src/ImageSharp/Profiles/Exif/ExifValue.cs

@ -155,7 +155,7 @@ namespace ImageSharp
/// </summary>
/// <param name="left">The first ExifValue to compare.</param>
/// <param name="right"> The second ExifValue to compare.</param>
/// <returns></returns>
/// <returns>The <see cref="bool"/></returns>
public static bool operator ==(ExifValue left, ExifValue right)
{
return Equals(left, right);
@ -172,10 +172,7 @@ namespace ImageSharp
return !Equals(left, right);
}
/// <summary>
/// Determines whether the specified object is equal to the current exif value.
/// </summary>
/// <param name="obj">The object to compare this exif value with.</param>
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
@ -186,10 +183,7 @@ namespace ImageSharp
return this.Equals(obj as ExifValue);
}
/// <summary>
/// Determines whether the specified exif value is equal to the current exif value.
/// </summary>
/// <param name="other">The exif value to compare this exif value with.</param>
/// <inheritdoc />
public bool Equals(ExifValue other)
{
if (ReferenceEquals(other, null))
@ -205,7 +199,7 @@ namespace ImageSharp
return
this.Tag == other.Tag &&
this.DataType == other.DataType &&
Equals(this.exifValue, other.exifValue);
object.Equals(this.exifValue, other.exifValue);
}
/// <inheritdoc/>
@ -549,6 +543,16 @@ namespace ImageSharp
return exifValue;
}
/// <summary>
/// Gets the size in bytes of the given data type.
/// </summary>
/// <param name="dataType">The data type.</param>
/// <returns>
/// The <see cref="uint"/>.
/// </returns>
/// <exception cref="NotSupportedException">
/// Thrown if the type is unsupported.
/// </exception>
internal static uint GetSize(ExifDataType dataType)
{
switch (dataType)

13
src/ImageSharp/Profiles/Exif/ExifWriter.cs

@ -283,6 +283,11 @@ namespace ImageSharp
private Collection<int> exifIndexes;
private Collection<int> gpsIndexes;
/// <summary>
/// Initializes a new instance of the <see cref="ExifWriter"/> class.
/// </summary>
/// <param name="values">The values.</param>
/// <param name="allowedParts">The allowed parts.</param>
public ExifWriter(Collection<ExifValue> values, ExifParts allowedParts)
{
this.values = values;
@ -292,9 +297,15 @@ namespace ImageSharp
this.gpsIndexes = this.GetIndexes(ExifParts.GPSTags, GPSTags);
}
/// <summary>
/// Returns the EXIF data.
/// </summary>
/// <returns>
/// The <see cref="T:byte[]"/>.
/// </returns>
public byte[] GetData()
{
uint length = 0;
uint length;
int exifIndex = -1;
int gpsIndex = -1;

Loading…
Cancel
Save