Browse Source

Don't over allocate

pull/2739/head
James Jackson-South 2 years ago
parent
commit
80dc3f51d4
  1. 4
      src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsCieLabCieXyz.cs
  2. 4
      src/ImageSharp/ColorProfiles/IColorProfile.cs

4
src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsCieLabCieXyz.cs

@ -39,8 +39,8 @@ internal static class ColorProfileConverterExtensionsCieLabCieXyz
TFrom.ToProfileConnectionSpace(options, source, pcsFrom);
// Convert between PCS.
using IMemoryOwner<CieXyz> pcsToOwner = options.MemoryAllocator.Allocate<CieXyz>(source.Length * 2);
Span<CieXyz> pcsTo = pcsToOwner.GetSpan()[..source.Length];
using IMemoryOwner<CieXyz> pcsToOwner = options.MemoryAllocator.Allocate<CieXyz>(source.Length);
Span<CieXyz> pcsTo = pcsToOwner.GetSpan();
CieLab.ToProfileConnectionSpace(options, pcsFrom, pcsTo);
// Adapt to target white point

4
src/ImageSharp/ColorProfiles/IColorProfile.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.ColorProfiles;
@ -11,7 +11,7 @@ public interface IColorProfile
/// <summary>
/// Gets the chromatic adaption white point source.
/// </summary>
/// <returns>The <see cref="GetChromaticAdaptionWhitePointSource"/>.</returns>
/// <returns>The <see cref="ChromaticAdaptionWhitePointSource"/>.</returns>
public static abstract ChromaticAdaptionWhitePointSource GetChromaticAdaptionWhitePointSource();
}

Loading…
Cancel
Save