forked from SixLabors/ImageSharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ImageBrush shouldn't Dispose of the image it is using.
Fixes SixLabors#881
- Loading branch information
1 parent
cb18952
commit 58b7e58
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))); | ||
} | ||
} | ||
} | ||
} | ||
} |