Browse Source

PR feedback

pull/2189/head
James Jackson-South 4 years ago
parent
commit
61299f99ef
  1. 10
      src/ImageSharp/Common/Helpers/RuntimeUtility.cs
  2. 4
      src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs

10
src/ImageSharp/Common/Helpers/RuntimeUtility.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System;
@ -11,6 +11,8 @@ namespace SixLabors.ImageSharp.Common.Helpers
/// </summary>
internal static class RuntimeUtility
{
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
/// <summary>
/// Swaps the two references.
/// </summary>
@ -20,10 +22,7 @@ namespace SixLabors.ImageSharp.Common.Helpers
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Swap<T>(ref T a, ref T b)
{
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
T tmp = a;
#pragma warning restore IDE0180 // Use tuple to swap values
a = b;
b = tmp;
}
@ -38,11 +37,10 @@ namespace SixLabors.ImageSharp.Common.Helpers
public static void Swap<T>(ref Span<T> a, ref Span<T> b)
{
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
Span<T> tmp = a;
#pragma warning restore IDE0180 // Use tuple to swap values
a = b;
b = tmp;
}
#pragma warning restore IDE0180 // Use tuple to swap values
}
}

4
src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs

@ -2,7 +2,6 @@
// Licensed under the Six Labors Split License.
using System;
using SixLabors.ImageSharp.Common.Helpers;
namespace SixLabors.ImageSharp.Formats.Webp.Lossy
{
@ -755,11 +754,12 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
public void SwapOut()
{
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
byte[] tmp = this.YuvOut;
#pragma warning restore IDE0180 // Use tuple to swap values
this.YuvOut = this.YuvOut2;
this.YuvOut2 = tmp;
#pragma warning restore IDE0180 // Use tuple to swap values
}
public void NzToBytes()

Loading…
Cancel
Save