Skip to content

Commit

Permalink
Bumped imagesharp version.
Browse files Browse the repository at this point in the history
  • Loading branch information
RossNordby committed Mar 5, 2024
1 parent 9a94101 commit f5beda9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DemoContentBuilder/DemoContentBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="SharpDX" Version="4.0.1" />
<PackageReference Include="SharpDX.D3DCompiler" Version="4.0.1" />
<PackageReference Include="SharpFontStandard" Version="4.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 9 additions & 6 deletions DemoContentBuilder/Texture2DBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ public unsafe static Texture2DContent Build(Stream dataStream)
var content = new Texture2DContent(image.Width, image.Height, 1, sizeof(Rgba32));
var data = (Rgba32*)content.Pin();
//Copy the image data into the Texture2DContent.
for (int rowIndex = 0; rowIndex < image.Height; ++rowIndex)
{
var sourceRow = image.GetPixelRowSpan(rowIndex);
var targetRow = data + content.GetRowOffsetForMip0(rowIndex);
Unsafe.CopyBlockUnaligned(ref *(byte*)targetRow, ref Unsafe.As<Rgba32, byte>(ref sourceRow[0]), (uint)(sizeof(Rgba32) * image.Width));
}
image.ProcessPixelRows(accessor =>
{
for (int rowIndex = 0; rowIndex < image.Height; ++rowIndex)
{
var sourceRow = accessor.GetRowSpan(rowIndex);
var targetRow = data + content.GetRowOffsetForMip0(rowIndex);
Unsafe.CopyBlockUnaligned(ref *(byte*)targetRow, ref Unsafe.As<Rgba32, byte>(ref sourceRow[0]), (uint)(sizeof(Rgba32) * image.Width));
}
});
content.Unpin();
return content;
}
Expand Down

0 comments on commit f5beda9

Please sign in to comment.