Imagesharp: DrawPolygon seemingly does nothing when caller is x64

Created on 26 Mar 2018  路  8Comments  路  Source: SixLabors/ImageSharp

SixLabors.Core 1.0.0-ci0005
SixLabors.ImageSharp.Drawing 1.0.0-dev000954
SixLabors.ImageSharp 1.0.0-dev000954
SixLabors.Shapes 1.0.0-ci0005
SixLabors.Shapes.Text 1.0.0-ci0005
SixLabors.Fonts 1.0.0-beta0003

Windows 10 RS4 17127.1
App framework: .NET Framework 4.7.2
App architecture: x64

using (Image<Rgba32> image = new Image<Rgba32>(800, 800))
{
  image.Mutate(x => x.DrawPolygon(
      Rgba32.HotPink,
      10,
      new SixLabors.Primitives.PointF[] {
          new Vector2(10, 10),
          new Vector2(550, 50),
          new Vector2(200, 400)
      }));
  image.Save("test.bmp");
}

Results in a 800x800 black image. Switching to x86 results in a 800x800 image with pink triangle.

Most helpful comment

All 8 comments

Handling of Vector2 seems to be broken in .NET Framework in x64/Release, this repro fails:
https://gist.github.com/riverar/4c4d7bd674aa0dd5602db5936c534e7d

Now if you excuse me, I have some yelling to do.

@riverar is this fixed with ImageSharp beta4 + .NET Core RC1?

@antonfirsov Does not repro with beta4 + (.NET Framework 4.7.2 or .NET Core 2.1.200).

@riverar thanks for checking!

@riverar what is the CPU you experienced this with?

@antonfirsov x64 architecture, the physical CPU doesn't matter. (Was a confirmed general float/framework bug.)

Was this page helpful?
0 / 5 - 0 ratings