Browse Source

Merge branch 'feature/memory-manager' of https://github.com/SixLabors/ImageSharp into feature/memory-manager

pull/475/head
Anton Firszov 8 years ago
parent
commit
55d218488e
  1. 6
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs
  2. 5
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs
  3. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

6
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs

@ -2,12 +2,9 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
{
/// <summary>
@ -54,9 +51,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary>
/// Creates a new instance of the <see cref="Bytes"/>, and initializes it's buffer.
/// </summary>
/// <param name="memoryManager">The <see cref="MemoryManager"/> to use for buffer allocations.</param>
/// <returns>The bytes created</returns>
public static Bytes Create(MemoryManager memoryManager)
public static Bytes Create()
{
// DO NOT bother with buffers and array pooling here!
// It only makes things worse!

5
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs

@ -28,13 +28,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary>
/// Initializes a new instance of the <see cref="InputProcessor"/> struct.
/// </summary>
/// <param name="memoryManager">The <see cref="MemoryManager"/> to use for buffer allocations.</param>
/// <param name="inputStream">The input <see cref="Stream"/></param>
/// <param name="temp">Temporal buffer, same as <see cref="OrigJpegDecoderCore.Temp"/></param>
public InputProcessor(MemoryManager memoryManager, Stream inputStream, byte[] temp)
public InputProcessor(Stream inputStream, byte[] temp)
{
this.Bits = default(Bits);
this.Bytes = Bytes.Create(memoryManager);
this.Bytes = Bytes.Create();
this.InputStream = inputStream;
this.Temp = temp;
this.LastErrorCode = OrigDecoderErrorCode.NoError;

2
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

@ -231,7 +231,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
{
this.MetaData = new ImageMetaData();
this.InputStream = stream;
this.InputProcessor = new InputProcessor(this.configuration.MemoryManager, stream, this.Temp);
this.InputProcessor = new InputProcessor(stream, this.Temp);
// Check for the Start Of Image marker.
this.InputProcessor.ReadFull(this.Temp, 0, 2);

Loading…
Cancel
Save