-
-
Notifications
You must be signed in to change notification settings - Fork 888
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
Description
This bug has been reported by @Wibble199 in Gitter on Oct, 29th 2019.
The following unit test (adapted from https://pastebin.com/RJQWm0za ) generates gradients with wrong colored pixels. Those pixels are at random(?) positions, not stable across re-running the same code.
[Theory]
[WithBlankImages(200, 200, PixelTypes.Rgb24)]
public void NewIssueTest<TPixel>(
TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
provider.VerifyOperation(
img =>
{
var brush = new PathGradientBrush(
new[]
{
new PointF(0, 0),
new PointF(200, 0),
new PointF(200, 200),
new PointF(0, 200),
new PointF(0, 0)
},
new[] { Color.Red, Color.Yellow, Color.Green, Color.DarkCyan, Color.Red });
img.Mutate(m => m.Fill(brush));
});
}Current sample output (two different test runs):

or

The expected result is a smooth gradient between the four colors on the corners instead.
Steps to Reproduce
see code sample above.
While investigating the cause for easier debugging I reduced the maxDegreeOfParallelism to 1 and the issue is gone.
Thus it looks like something going on when applying the brush in parallel.
System Configuration
- ImageSharp version: current master branch
- Other ImageSharp packages and versions: -
- Environment (Operating system, version and so on): Windows 10 Version 1903, Build 18362.418
- .NET Framework version: 4.7.2
- Additional information:
Wibble199