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> /// </summary>
public IReadOnlyCollection<IImageFormat> ImageFormats => new ReadOnlyCollection<IImageFormat>(this.imageFormats); public IReadOnlyCollection<IImageFormat> ImageFormats => new ReadOnlyCollection<IImageFormat>(this.imageFormats);
/// <summary> /// <summary>
/// Gets or sets the global parallel options for processing tasks in parallel. /// Gets or sets the global parallel options for processing tasks in parallel.
/// </summary> /// </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. // Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// </copyright> // </copyright>

1
src/ImageSharp/Colors/ColorDefinitions.cs

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save