Browse Source

Merge pull request #43 from olivif/olivif/fixwarnings

Adding missing documentation and fixing style issues.
pull/45/head
James Jackson-South 10 years ago
committed by GitHub
parent
commit
25ec9cea02
  1. 1
      src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs
  2. 4
      src/ImageSharp/Drawing/Brushes/Brushes`2.cs
  3. 6
      src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs
  4. 1
      src/ImageSharp/Drawing/Draw.cs
  5. 2
      src/ImageSharp/Drawing/DrawImage.cs
  6. 1
      src/ImageSharp/Drawing/Fill.cs
  7. 8
      src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs
  8. 3
      src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs
  9. 2
      src/ImageSharp/Drawing/Shapes/LinearPolygon.cs
  10. 13
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  11. 9
      src/ImageSharp/Formats/Jpg/Components/Bits.cs
  12. 75
      src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs
  13. 5
      src/ImageSharp/Formats/Jpg/Components/Bytes.cs
  14. 2
      src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs

1
src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs

@ -6,6 +6,7 @@
namespace ImageSharp namespace ImageSharp
{ {
using System; using System;
/// <summary> /// <summary>
/// An interface that represents a packed pixel type. /// An interface that represents a packed pixel type.
/// </summary> /// </summary>

4
src/ImageSharp/Drawing/Brushes/Brushes`2.cs

@ -3,10 +3,10 @@
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// </copyright> // </copyright>
using System;
namespace ImageSharp.Drawing.Brushes namespace ImageSharp.Drawing.Brushes
{ {
using System;
/// <summary> /// <summary>
/// A collection of methods for creating generic brushes. /// A collection of methods for creating generic brushes.
/// </summary> /// </summary>

6
src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs

@ -5,10 +5,10 @@
namespace ImageSharp.Drawing.Brushes namespace ImageSharp.Drawing.Brushes
{ {
using System;
using System.Numerics; using System.Numerics;
using Processors; using Processors;
using System;
/// <summary> /// <summary>
/// Provides an implementation of a pattern brush for painting patterns. /// Provides an implementation of a pattern brush for painting patterns.
@ -30,12 +30,12 @@ namespace ImageSharp.Drawing.Brushes
/// 0 /// 0
/// 0 /// 0
/// </para> /// </para>
/// Warning when use array initializer across multiple lines the bools look inverted i.e. /// Warning when use array initializer across multiple lines the bools look inverted i.e.
/// new bool[,]{ /// new bool[,]{
/// {true, false, false}, /// {true, false, false},
/// {false,true, false} /// {false,true, false}
/// } /// }
/// would be /// would be
/// 10 /// 10
/// 01 /// 01
/// 00 /// 00

1
src/ImageSharp/Drawing/Draw.cs

@ -220,6 +220,7 @@ namespace ImageSharp
{ {
return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)), options); return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)), options);
} }
/// <summary> /// <summary>
/// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// Draws the provided Points as a closed Linear Polygon with the provided Pen.
/// </summary> /// </summary>

2
src/ImageSharp/Drawing/DrawImage.cs

@ -1,4 +1,4 @@
// <copyright file="Blend.cs" company="James Jackson-South"> // <copyright file="DrawImage.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/Drawing/Fill.cs

@ -56,6 +56,7 @@ namespace ImageSharp
/// <param name="source">The source.</param> /// <param name="source">The source.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The graphics options.</param>
/// <returns>The Image</returns> /// <returns>The Image</returns>
public static Image<TColor, TPacked> Fill<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, IShape shape, GraphicsOptions options) public static Image<TColor, TPacked> Fill<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, IShape shape, GraphicsOptions options)
where TColor : struct, IPackedPixel<TPacked> where TColor : struct, IPackedPixel<TPacked>

8
src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs

@ -34,7 +34,7 @@ namespace ImageSharp.Drawing.Processors
private readonly IPath[] paths; private readonly IPath[] paths;
private readonly RectangleF region; private readonly RectangleF region;
private readonly GraphicsOptions options; private readonly GraphicsOptions options;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DrawPathProcessor{TColor, TPacked}" /> class. /// Initializes a new instance of the <see cref="DrawPathProcessor{TColor, TPacked}" /> class.
/// </summary> /// </summary>
@ -56,7 +56,7 @@ namespace ImageSharp.Drawing.Processors
: this(pen, new[] { path }, options) : this(pen, new[] { path }, options)
{ {
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DrawPathProcessor{TColor, TPacked}" /> class. /// Initializes a new instance of the <see cref="DrawPathProcessor{TColor, TPacked}" /> class.
/// </summary> /// </summary>
@ -134,10 +134,10 @@ namespace ImageSharp.Drawing.Processors
currentPoint.X = offsetX; currentPoint.X = offsetX;
currentPoint.Y = offsetY; currentPoint.Y = offsetY;
var dist = Closest(currentPoint); var dist = this.Closest(currentPoint);
var color = applicator.GetColor(dist); var color = applicator.GetColor(dist);
var opacity = this.Opacity(color.DistanceFromElement); var opacity = this.Opacity(color.DistanceFromElement);
if (opacity > Epsilon) if (opacity > Epsilon)

3
src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs

@ -35,6 +35,7 @@ namespace ImageSharp.Drawing.Processors
/// </summary> /// </summary>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The graphics options.</param>
public FillShapeProcessor(IBrush<TColor, TPacked> brush, IShape shape, GraphicsOptions options) public FillShapeProcessor(IBrush<TColor, TPacked> brush, IShape shape, GraphicsOptions options)
{ {
this.poly = shape; this.poly = shape;
@ -73,7 +74,7 @@ namespace ImageSharp.Drawing.Processors
{ {
polyStartY = 0; polyStartY = 0;
} }
using (PixelAccessor<TColor, TPacked> sourcePixels = source.Lock()) using (PixelAccessor<TColor, TPacked> sourcePixels = source.Lock())
using (IBrushApplicator<TColor, TPacked> applicator = this.fillColor.CreateApplicator(rect)) using (IBrushApplicator<TColor, TPacked> applicator = this.fillColor.CreateApplicator(rect))
{ {

2
src/ImageSharp/Drawing/Shapes/LinearPolygon.cs

@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Shapes
{ {
this.innerPolygon = new Polygon(new LinearLineSegment(points)); this.innerPolygon = new Polygon(new LinearLineSegment(points));
} }
/// <summary> /// <summary>
/// Gets the bounding box of this shape. /// Gets the bounding box of this shape.
/// </summary> /// </summary>

13
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -53,7 +53,8 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="Image{TColor, TPacked}"/> to encode from.</param> /// <param name="image">The <see cref="Image{TColor, TPacked}"/> to encode from.</param>
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param> /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream) public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct, IEquatable<TPacked> where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct, IEquatable<TPacked>
{ {
Guard.NotNull(image, nameof(image)); Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream)); Guard.NotNull(stream, nameof(stream));
@ -121,7 +122,8 @@ namespace ImageSharp.Formats
/// The <see cref="int"/>. /// The <see cref="int"/>.
/// </returns> /// </returns>
private static int GetTransparentIndex<TColor, TPacked>(QuantizedImage<TColor, TPacked> quantized) private static int GetTransparentIndex<TColor, TPacked>(QuantizedImage<TColor, TPacked> quantized)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct, IEquatable<TPacked> where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct, IEquatable<TPacked>
{ {
// Find the lowest alpha value and make it the transparent index. // Find the lowest alpha value and make it the transparent index.
int index = -1; int index = -1;
@ -236,7 +238,9 @@ namespace ImageSharp.Formats
private void WriteGraphicalControlExtension<TColor, TPacked>( private void WriteGraphicalControlExtension<TColor, TPacked>(
ImageBase<TColor, TPacked> image, ImageBase<TColor, TPacked> image,
EndianBinaryWriter writer, EndianBinaryWriter writer,
int transparencyIndex) where TColor : struct, IPackedPixel<TPacked> where TPacked : struct, IEquatable<TPacked> int transparencyIndex)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct, IEquatable<TPacked>
{ {
// TODO: Check transparency logic. // TODO: Check transparency logic.
bool hasTransparent = transparencyIndex > -1; bool hasTransparent = transparencyIndex > -1;
@ -281,7 +285,8 @@ namespace ImageSharp.Formats
/// <param name="image">The <see cref="ImageBase{TColor, TPacked}"/> to be encoded.</param> /// <param name="image">The <see cref="ImageBase{TColor, TPacked}"/> to be encoded.</param>
/// <param name="writer">The stream to write to.</param> /// <param name="writer">The stream to write to.</param>
private void WriteImageDescriptor<TColor, TPacked>(ImageBase<TColor, TPacked> image, EndianBinaryWriter writer) private void WriteImageDescriptor<TColor, TPacked>(ImageBase<TColor, TPacked> image, EndianBinaryWriter writer)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct, IEquatable<TPacked> where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct, IEquatable<TPacked>
{ {
writer.Write(GifConstants.ImageDescriptorLabel); // 2c writer.Write(GifConstants.ImageDescriptorLabel); // 2c
// TODO: Can we capture this? // TODO: Can we capture this?

9
src/ImageSharp/Formats/Jpg/Components/Bits.cs

@ -36,7 +36,8 @@ namespace ImageSharp.Formats
/// the caller is the one responsible for first checking that bits.UnreadBits &lt; n. /// the caller is the one responsible for first checking that bits.UnreadBits &lt; n.
/// </summary> /// </summary>
/// <param name="n">The number of bits to ensure.</param> /// <param name="n">The number of bits to ensure.</param>
/// <param name="decoder"></param> /// <param name="decoder">Jpeg decoder</param>
/// <returns>Error code</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal JpegDecoderCore.ErrorCodes EnsureNBits(int n, JpegDecoderCore decoder) internal JpegDecoderCore.ErrorCodes EnsureNBits(int n, JpegDecoderCore decoder)
{ {
@ -69,6 +70,12 @@ namespace ImageSharp.Formats
} }
} }
/// <summary>
/// Receive extend
/// </summary>
/// <param name="t">Byte</param>
/// <param name="decoder">Jpeg decoder</param>
/// <returns>Read bits value</returns>
internal int ReceiveExtend(byte t, JpegDecoderCore decoder) internal int ReceiveExtend(byte t, JpegDecoderCore decoder)
{ {
if (this.UnreadBits < t) if (this.UnreadBits < t)

75
src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs

@ -85,6 +85,8 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Load raw 32bit floating point data from source /// Load raw 32bit floating point data from source
/// </summary> /// </summary>
/// <param name="blockPtr">Block pointer</param>
/// <param name="source">Source</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void LoadFrom(Block8x8F* blockPtr, MutableSpan<float> source) public static unsafe void LoadFrom(Block8x8F* blockPtr, MutableSpan<float> source)
{ {
@ -94,6 +96,8 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Copy raw 32bit floating point data to dest /// Copy raw 32bit floating point data to dest
/// </summary> /// </summary>
/// <param name="blockPtr">Block pointer</param>
/// <param name="dest">Destination</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void CopyTo(Block8x8F* blockPtr, MutableSpan<float> dest) public static unsafe void CopyTo(Block8x8F* blockPtr, MutableSpan<float> dest)
{ {
@ -103,6 +107,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Load raw 32bit floating point data from source /// Load raw 32bit floating point data from source
/// </summary> /// </summary>
/// <param name="source">Source</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void LoadFrom(MutableSpan<float> source) public unsafe void LoadFrom(MutableSpan<float> source)
{ {
@ -115,6 +120,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Copy raw 32bit floating point data to dest /// Copy raw 32bit floating point data to dest
/// </summary> /// </summary>
/// <param name="dest">Destination</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void CopyTo(MutableSpan<float> dest) public unsafe void CopyTo(MutableSpan<float> dest)
{ {
@ -127,6 +133,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Copy raw 32bit floating point data to dest /// Copy raw 32bit floating point data to dest
/// </summary> /// </summary>
/// <param name="dest">Destination</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void CopyTo(float[] dest) public unsafe void CopyTo(float[] dest)
{ {
@ -161,17 +168,17 @@ namespace ImageSharp.Formats
/// Apply floating point IDCT transformation into dest, using a temporary block 'temp' provided by the caller (optimization) /// Apply floating point IDCT transformation into dest, using a temporary block 'temp' provided by the caller (optimization)
/// </summary> /// </summary>
/// <param name="dest">Destination</param> /// <param name="dest">Destination</param>
/// <param name="temp">Temporary block provided by the caller</param> /// <param name="tempBlockPtr">Temporary block provided by the caller</param>
public void TransformIDCTInto(ref Block8x8F dest, ref Block8x8F temp) public void TransformIDCTInto(ref Block8x8F dest, ref Block8x8F tempBlockPtr)
{ {
this.TransposeInto(ref temp); this.TransposeInto(ref tempBlockPtr);
temp.IDCT8x4_LeftPart(ref dest); tempBlockPtr.IDCT8x4_LeftPart(ref dest);
temp.IDCT8x4_RightPart(ref dest); tempBlockPtr.IDCT8x4_RightPart(ref dest);
dest.TransposeInto(ref temp); dest.TransposeInto(ref tempBlockPtr);
temp.IDCT8x4_LeftPart(ref dest); tempBlockPtr.IDCT8x4_LeftPart(ref dest);
temp.IDCT8x4_RightPart(ref dest); tempBlockPtr.IDCT8x4_RightPart(ref dest);
dest.MultiplyAllInplace(C_0_125); dest.MultiplyAllInplace(C_0_125);
} }
@ -179,6 +186,9 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Pointer-based "Indexer" (getter part) /// Pointer-based "Indexer" (getter part)
/// </summary> /// </summary>
/// <param name="blockPtr">Block pointer</param>
/// <param name="idx">Index</param>
/// <returns>The scalar value at the specified index</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe float GetScalarAt(Block8x8F* blockPtr, int idx) internal static unsafe float GetScalarAt(Block8x8F* blockPtr, int idx)
{ {
@ -189,6 +199,9 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Pointer-based "Indexer" (setter part) /// Pointer-based "Indexer" (setter part)
/// </summary> /// </summary>
/// <param name="blockPtr">Block pointer</param>
/// <param name="idx">Index</param>
/// <param name="value">Value</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void SetScalarAt(Block8x8F* blockPtr, int idx, float value) internal static unsafe void SetScalarAt(Block8x8F* blockPtr, int idx, float value)
{ {
@ -196,11 +209,17 @@ namespace ImageSharp.Formats
fp[idx] = value; fp[idx] = value;
} }
/// <summary>
/// Un-zig
/// </summary>
/// <param name="blockPtr">Block pointer</param>
/// <param name="qtPtr">Qt pointer</param>
/// <param name="unzigPtr">Unzig pointer</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void UnZig(Block8x8F* block, Block8x8F* qt, int* unzigPtr) internal static unsafe void UnZig(Block8x8F* blockPtr, Block8x8F* qtPtr, int* unzigPtr)
{ {
float* b = (float*)block; float* b = (float*)blockPtr;
float* qtp = (float*)qt; float* qtp = (float*)qtPtr;
for (int zig = 0; zig < BlockF.BlockSize; zig++) for (int zig = 0; zig < BlockF.BlockSize; zig++)
{ {
float* unzigPos = b + unzigPtr[zig]; float* unzigPos = b + unzigPtr[zig];
@ -213,6 +232,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Copy raw 32bit floating point data to dest /// Copy raw 32bit floating point data to dest
/// </summary> /// </summary>
/// <param name="dest">Destination</param>
internal unsafe void CopyTo(MutableSpan<int> dest) internal unsafe void CopyTo(MutableSpan<int> dest)
{ {
fixed (Vector4* ptr = &this.V0L) fixed (Vector4* ptr = &this.V0L)
@ -228,6 +248,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Load raw 32bit floating point data from source /// Load raw 32bit floating point data from source
/// </summary> /// </summary>
/// <param name="source">Source</param>
internal unsafe void LoadFrom(MutableSpan<int> source) internal unsafe void LoadFrom(MutableSpan<int> source)
{ {
fixed (Vector4* ptr = &this.V0L) fixed (Vector4* ptr = &this.V0L)
@ -301,8 +322,9 @@ namespace ImageSharp.Formats
/// Original source: /// Original source:
/// https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L261 /// https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L261
/// </summary> /// </summary>
/// <param name="destBlockPtr">Destination Block pointer</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void IDCT8x4_RightPart(ref Block8x8F d) internal void IDCT8x4_RightPart(ref Block8x8F destBlockPtr)
{ {
Vector4 my1 = this.V1R; Vector4 my1 = this.V1R;
Vector4 my7 = this.V7R; Vector4 my7 = this.V7R;
@ -342,14 +364,14 @@ namespace ImageSharp.Formats
my1 = mz1 + mz2; my1 = mz1 + mz2;
my2 = mz1 - mz2; my2 = mz1 - mz2;
d.V0R = my0 + mb0; destBlockPtr.V0R = my0 + mb0;
d.V7R = my0 - mb0; destBlockPtr.V7R = my0 - mb0;
d.V1R = my1 + mb1; destBlockPtr.V1R = my1 + mb1;
d.V6R = my1 - mb1; destBlockPtr.V6R = my1 - mb1;
d.V2R = my2 + mb2; destBlockPtr.V2R = my2 + mb2;
d.V5R = my2 - mb2; destBlockPtr.V5R = my2 - mb2;
d.V3R = my3 + mb3; destBlockPtr.V3R = my3 + mb3;
d.V4R = my3 - mb3; destBlockPtr.V4R = my3 - mb3;
} }
/// <summary> /// <summary>
@ -365,7 +387,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// TODO: Should be removed when BlockF goes away /// TODO: Should be removed when BlockF goes away
/// </summary> /// </summary>
/// <param name="legacyBlock"></param> /// <param name="legacyBlock">Legacy block</param>
internal void LoadFrom(ref BlockF legacyBlock) internal void LoadFrom(ref BlockF legacyBlock)
{ {
this.LoadFrom(legacyBlock.Data); this.LoadFrom(legacyBlock.Data);
@ -374,7 +396,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// TODO: Should be removed when BlockF goes away /// TODO: Should be removed when BlockF goes away
/// </summary> /// </summary>
/// <param name="legacyBlock"></param> /// <param name="legacyBlock">Legacy block</param>
internal void CopyTo(ref BlockF legacyBlock) internal void CopyTo(ref BlockF legacyBlock)
{ {
this.CopyTo(legacyBlock.Data); this.CopyTo(legacyBlock.Data);
@ -383,12 +405,15 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Level shift by +128, clip to [0, 255], and write to buffer. /// Level shift by +128, clip to [0, 255], and write to buffer.
/// </summary> /// </summary>
/// <param name="buffer">Color buffer</param>
/// <param name="stride">Stride offset</param>
/// <param name="tempBlockPtr">Temp Block pointer</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void CopyColorsTo(MutableSpan<byte> buffer, int stride, Block8x8F* temp) internal unsafe void CopyColorsTo(MutableSpan<byte> buffer, int stride, Block8x8F* tempBlockPtr)
{ {
this.TransformByteConvetibleColorValuesInto(ref *temp); this.TransformByteConvetibleColorValuesInto(ref *tempBlockPtr);
float* src = (float*)temp; float* src = (float*)tempBlockPtr;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
buffer[0] = (byte)src[0]; buffer[0] = (byte)src[0];

5
src/ImageSharp/Formats/Jpg/Components/Bytes.cs

@ -38,6 +38,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Creates a new instance of the <see cref="Bytes"/>, and initializes it's buffer. /// Creates a new instance of the <see cref="Bytes"/>, and initializes it's buffer.
/// </summary> /// </summary>
/// <returns>The bytes created</returns>
public static Bytes Create() public static Bytes Create()
{ {
return new Bytes { Buffer = ArrayPool.Rent(4096) }; return new Bytes { Buffer = ArrayPool.Rent(4096) };
@ -56,6 +57,8 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// ReadByteStuffedByte is like ReadByte but is for byte-stuffed Huffman data. /// ReadByteStuffedByte is like ReadByte but is for byte-stuffed Huffman data.
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param>
/// <param name="errorCode">Error code</param>
/// <returns>The <see cref="byte"/></returns> /// <returns>The <see cref="byte"/></returns>
internal byte ReadByteStuffedByte(Stream inputStream, out JpegDecoderCore.ErrorCodes errorCode) internal byte ReadByteStuffedByte(Stream inputStream, out JpegDecoderCore.ErrorCodes errorCode)
{ {
@ -112,6 +115,7 @@ namespace ImageSharp.Formats
/// <summary> /// <summary>
/// Returns the next byte, whether buffered or not buffered. It does not care about byte stuffing. /// Returns the next byte, whether buffered or not buffered. It does not care about byte stuffing.
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param>
/// <returns>The <see cref="byte"/></returns> /// <returns>The <see cref="byte"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal byte ReadByte(Stream inputStream) internal byte ReadByte(Stream inputStream)
@ -131,6 +135,7 @@ namespace ImageSharp.Formats
/// Fills up the bytes buffer from the underlying stream. /// Fills up the bytes buffer from the underlying stream.
/// It should only be called when there are no unread bytes in bytes. /// It should only be called when there are no unread bytes in bytes.
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void Fill(Stream inputStream) internal void Fill(Stream inputStream)
{ {

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

@ -1874,7 +1874,7 @@ namespace ImageSharp.Formats
/// </summary> /// </summary>
/// <param name="b">The block of coefficients</param> /// <param name="b">The block of coefficients</param>
/// <param name="h">The Huffman tree</param> /// <param name="h">The Huffman tree</param>
/// <param name="unzigPtr"></param> /// <param name="unzigPtr">Unzig ptr</param>
/// <param name="zigStart">The zig-zag start index</param> /// <param name="zigStart">The zig-zag start index</param>
/// <param name="zigEnd">The zig-zag end index</param> /// <param name="zigEnd">The zig-zag end index</param>
/// <param name="delta">The low transform offset</param> /// <param name="delta">The low transform offset</param>

Loading…
Cancel
Save