Browse Source

Added missing braces and removed some empty lines.

pull/20/head
dirk 9 years ago
parent
commit
a6b5ce93ff
  1. 1
      src/ImageSharp/Bootstrapper.cs
  2. 3
      src/ImageSharp/Colors/Color.cs
  3. 1
      src/ImageSharp/Colors/ColorDefinitions.cs
  4. 54
      src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs
  5. 1
      src/ImageSharp/Image/ImageBase.cs
  6. 2
      src/ImageSharp/Profiles/Exif/ExifProfile.cs
  7. 4
      src/ImageSharp/Profiles/Exif/ExifTag.cs
  8. 6
      src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs

1
src/ImageSharp/Bootstrapper.cs

@ -52,7 +52,6 @@ namespace ImageSharp
/// </summary>
public IReadOnlyCollection<IImageFormat> ImageFormats => new ReadOnlyCollection<IImageFormat>(this.imageFormats);
/// <summary>
/// Gets or sets the global parallel options for processing tasks in parallel.
/// </summary>

3
src/ImageSharp/Colors/Color.cs

@ -1,5 +1,4 @@

// <copyright file="Color.cs" company="James Jackson-South">
// <copyright file="Color.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

1
src/ImageSharp/Colors/ColorDefinitions.cs

@ -585,7 +585,6 @@ namespace ImageSharp
/// </summary>
public static readonly Color RebeccaPurple = new Color(102, 51, 153, 255);
/// <summary>
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF0000.
/// </summary>

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

@ -159,7 +159,10 @@ namespace ImageSharp.Formats
foreach (var v in s.Values)
{
if (v > maxValue) maxValue = v;
if (v > maxValue)
{
maxValue = v;
}
}
this.Values = new uint[maxValue + 1];
@ -240,7 +243,11 @@ namespace ImageSharp.Formats
{
byte b = (byte)(bits >> 24);
this.WriteByte(b);
if (b == 0xff) this.WriteByte(0x00);
if (b == 0xff)
{
this.WriteByte(0x00);
}
bits <<= 8;
nBits -= 8;
}
@ -293,7 +300,6 @@ namespace ImageSharp.Formats
}
}
/// <summary>
/// Writes a block of pixel data using the given quantization table,
/// returning the post-quantized DC value of the DCT-transformed block.
@ -336,7 +342,11 @@ namespace ImageSharp.Formats
}
}
if (runLength > 0) this.EmitHuff(h, 0x00);
if (runLength > 0)
{
this.EmitHuff(h, 0x00);
}
return dc;
}
@ -457,8 +467,15 @@ namespace ImageSharp.Formats
this.quant[i] = new byte[Block.BlockSize];
}
if (quality < 1) quality = 1;
if (quality > 100) quality = 100;
if (quality < 1)
{
quality = 1;
}
if (quality > 100)
{
quality = 100;
}
// Convert from a quality rating to a scaling factor.
int scale;
@ -478,8 +495,16 @@ namespace ImageSharp.Formats
{
int x = this.unscaledQuant[i, j];
x = ((x * scale) + 50) / 100;
if (x < 1) x = 1;
if (x > 255) x = 255;
if (x < 1)
{
x = 1;
}
if (x > 255)
{
x = 255;
}
this.quant[i][j] = (byte)x;
}
}
@ -731,8 +756,6 @@ namespace ImageSharp.Formats
this.Emit(0x7f, 7);
}
/// <summary>
/// Encodes the image with no subsampling.
/// </summary>
@ -772,8 +795,15 @@ namespace ImageSharp.Formats
Block[] cr = new Block[4];
int prevDCY = 0, prevDCCb = 0, prevDCCr = 0;
for (int i = 0; i < 4; i++) cb[i] = new Block();
for (int i = 0; i < 4; i++) cr[i] = new Block();
for (int i = 0; i < 4; i++)
{
cb[i] = new Block();
}
for (int i = 0; i < 4; i++)
{
cr[i] = new Block();
}
for (int y = 0; y < pixels.Height; y += 16)
{

1
src/ImageSharp/Image/ImageBase.cs

@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp
{
using System;

2
src/ImageSharp/Profiles/Exif/ExifProfile.cs

@ -148,7 +148,9 @@ namespace ImageSharp
foreach (ExifValue exifValue in this.Values)
{
if (exifValue.Tag == tag)
{
return exifValue;
}
}
return null;

4
src/ImageSharp/Profiles/Exif/ExifTag.cs

@ -27,7 +27,6 @@ namespace ImageSharp
/// </summary>
GPSIFDOffset = 0x8825,
/// <summary>
/// ImageWidth
/// </summary>
@ -276,7 +275,6 @@ namespace ImageSharp
/// </summary>
Copyright = 0x8298,
/// <summary>
/// DocumentName
/// </summary>
@ -608,7 +606,6 @@ namespace ImageSharp
/// </summary>
ImageLayer = 0x87AC,
/// <summary>
/// ExposureTime
/// </summary>
@ -1002,7 +999,6 @@ namespace ImageSharp
/// </summary>
ImageUniqueID = 0xA420,
/// <summary>
/// GPSVersionID
/// </summary>

6
src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs

@ -32,14 +32,18 @@ namespace ImageSharp
{
FieldInfo field = tag.GetType().GetTypeInfo().GetDeclaredField(tag.ToString());
if (field == null)
return null;
{
return null;
}
foreach (CustomAttributeData customAttribute in field.CustomAttributes)
{
object attributeValue = customAttribute.ConstructorArguments[0].Value;
if (Equals(attributeValue, value))
{
return (string)customAttribute.ConstructorArguments[1].Value;
}
}
return null;

Loading…
Cancel
Save