Browse Source

ColorVector perf improvements

pull/180/head
James Jackson-South 9 years ago
parent
commit
6b6df21cb6
  1. 2
      src/ImageSharp/Colors/ColorVector.Definitions.cs
  2. 5
      src/ImageSharp/Colors/ColorVector.Transforms.cs
  3. 6
      src/ImageSharp/Colors/ColorVector.cs

2
src/ImageSharp/Colors/ColorVector.Definitions.cs

@ -6,7 +6,7 @@
namespace ImageSharp namespace ImageSharp
{ {
/// <summary> /// <summary>
/// Unpacked pixel type containing four 8-bit unsigned normalized values ranging from 0 to 255. /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1.
/// The color components are stored in red, green, blue, and alpha order. /// The color components are stored in red, green, blue, and alpha order.
/// </summary> /// </summary>
/// <remarks> /// <remarks>

5
src/ImageSharp/Colors/ColorVector.Transforms.cs

@ -6,9 +6,10 @@
namespace ImageSharp namespace ImageSharp
{ {
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices;
/// <summary> /// <summary>
/// Unpacked pixel type containing four 16-bit unsigned normalized values typically ranging from 0 to 1. /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1.
/// The color components are stored in red, green, blue, and alpha order. /// The color components are stored in red, green, blue, and alpha order.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
@ -25,6 +26,7 @@ namespace ImageSharp
/// <returns> /// <returns>
/// The <see cref="ColorVector"/>. /// The <see cref="ColorVector"/>.
/// </returns> /// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ColorVector operator +(ColorVector left, ColorVector right) public static ColorVector operator +(ColorVector left, ColorVector right)
{ {
return new ColorVector(left.backingVector + right.backingVector); return new ColorVector(left.backingVector + right.backingVector);
@ -38,6 +40,7 @@ namespace ImageSharp
/// <returns> /// <returns>
/// The <see cref="ColorVector"/>. /// The <see cref="ColorVector"/>.
/// </returns> /// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ColorVector operator -(ColorVector left, ColorVector right) public static ColorVector operator -(ColorVector left, ColorVector right)
{ {
return new ColorVector(left.backingVector - right.backingVector); return new ColorVector(left.backingVector - right.backingVector);

6
src/ImageSharp/Colors/ColorVector.cs

@ -9,7 +9,7 @@ namespace ImageSharp
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
/// <summary> /// <summary>
/// Unpacked pixel type containing four 16-bit unsigned normalized values typically ranging from 0 to 1. /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1.
/// The color components are stored in red, green, blue, and alpha order. /// The color components are stored in red, green, blue, and alpha order.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
@ -40,6 +40,7 @@ namespace ImageSharp
/// <param name="g">The green component.</param> /// <param name="g">The green component.</param>
/// <param name="b">The blue component.</param> /// <param name="b">The blue component.</param>
/// <param name="a">The alpha component.</param> /// <param name="a">The alpha component.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ColorVector(byte r, byte g, byte b, byte a = 255) public ColorVector(byte r, byte g, byte b, byte a = 255)
: this() : this()
{ {
@ -53,6 +54,7 @@ namespace ImageSharp
/// <param name="g">The green component.</param> /// <param name="g">The green component.</param>
/// <param name="b">The blue component.</param> /// <param name="b">The blue component.</param>
/// <param name="a">The alpha component.</param> /// <param name="a">The alpha component.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ColorVector(float r, float g, float b, float a = 1) public ColorVector(float r, float g, float b, float a = 1)
: this() : this()
{ {
@ -65,6 +67,7 @@ namespace ImageSharp
/// <param name="vector"> /// <param name="vector">
/// The vector containing the components for the packed vector. /// The vector containing the components for the packed vector.
/// </param> /// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ColorVector(Vector3 vector) public ColorVector(Vector3 vector)
: this() : this()
{ {
@ -77,6 +80,7 @@ namespace ImageSharp
/// <param name="vector"> /// <param name="vector">
/// The vector containing the components for the packed vector. /// The vector containing the components for the packed vector.
/// </param> /// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ColorVector(Vector4 vector) public ColorVector(Vector4 vector)
: this() : this()
{ {

Loading…
Cancel
Save