Browse Source

return alpha array to array pool

af/merge-core
Scott Williams 9 years ago
parent
commit
44d1aae2b3
  1. 13
      src/ImageSharp/Formats/Png/PngEncoderCore.cs

13
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -529,19 +529,20 @@ namespace ImageSharp.Formats
} }
this.WriteChunk(stream, PngChunkTypes.Palette, colorTable, 0, colorTableLength); this.WriteChunk(stream, PngChunkTypes.Palette, colorTable, 0, colorTableLength);
// Write the transparency data
if (anyAlpha)
{
this.WriteChunk(stream, PngChunkTypes.PaletteAlpha, alphaTable, 0, pixelCount);
}
} }
finally finally
{ {
ArrayPool<byte>.Shared.Return(colorTable); ArrayPool<byte>.Shared.Return(colorTable);
ArrayPool<byte>.Shared.Return(alphaTable);
ArrayPool<byte>.Shared.Return(bytes); ArrayPool<byte>.Shared.Return(bytes);
} }
// Write the transparency data
if (anyAlpha)
{
this.WriteChunk(stream, PngChunkTypes.PaletteAlpha, alphaTable, 0, pixelCount);
}
return quantized; return quantized;
} }

Loading…
Cancel
Save