Browse Source

ImageBrush shouldn't Dispose of the image it is using. (#883)

Fixes #881
af/merge-core
BorisTheBrave 7 years ago
committed by James Jackson-South
parent
commit
570849085b
  1. 1
      src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs
  2. 36
      tests/ImageSharp.Tests/Drawing/FillImageBrushTests.cs

1
src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs

@ -113,7 +113,6 @@ namespace SixLabors.ImageSharp.Processing
/// <inheritdoc />
public override void Dispose()
{
this.source.Dispose();
}
/// <inheritdoc />

36
tests/ImageSharp.Tests/Drawing/FillImageBrushTests.cs

@ -0,0 +1,36 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using SixLabors.Primitives;
using SixLabors.Shapes;
using Xunit;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Drawing
{
[GroupOutput("Drawing")]
public class FillImageBrushTests
{
[Fact]
public void DoesNotDisposeImage()
{
using (var src = new Image<Rgba32>(5, 5))
{
var brush = new ImageBrush<Rgba32>(src);
using (var dest = new Image<Rgba32>(10, 10))
{
dest.Mutate(c => c.Fill(brush, new Rectangle(0, 0, 10, 10)));
dest.Mutate(c => c.Fill(brush, new Rectangle(0, 0, 10, 10)));
}
}
}
}
}
Loading…
Cancel
Save