Skip to content

Commit

Permalink
Use this.maxColors when getting size of the reduced palette, fixes #1505
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpopow committed Jan 14, 2021
1 parent 5ab593f commit f85b686
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;

Expand Down Expand Up @@ -96,7 +95,7 @@ public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
this.octree.Palletize(paletteSpan, this.maxColors, ref paletteIndex);

// Length of reduced palette + transparency.
ReadOnlyMemory<TPixel> result = this.paletteOwner.Memory.Slice(0, Math.Min(paletteIndex + 2, QuantizerConstants.MaxColors));
ReadOnlyMemory<TPixel> result = this.paletteOwner.Memory.Slice(0, Math.Min(paletteIndex + 2, this.maxColors));
this.pixelMap = new EuclideanPixelMap<TPixel>(this.Configuration, result);

this.palette = result;
Expand Down

0 comments on commit f85b686

Please sign in to comment.