Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public Vector2D<int> PointToFramebuffer(Vector2D<int> point)
Unsafe.As<int, Vector2D<int>>(ref framebufferSizeElements[0]) = FramebufferSize;
var framebufferSize = new Vector<int>(framebufferSizeElements);
Span<int> sizeElements = stackalloc int[Vector<int>.Count];
// HACK: Avoid divide by zero errors
sizeElements[2..].Fill(1);
Unsafe.As<int, Vector2D<int>>(ref sizeElements[0]) = Size;
var size = new Vector<int>(sizeElements);
Span<int> pointElements = stackalloc int[Vector<int>.Count];
Expand All @@ -295,6 +297,11 @@ public Vector2D<int> PointToFramebuffer(Vector2D<int> point)
Unsafe.As<int, Vector2D<int>>(ref a[0]) = FramebufferSize;
Unsafe.As<int, Vector2D<int>>(ref a[c]) = Size;
Unsafe.As<int, Vector2D<int>>(ref a[c * 2]) = point;

// HACK: Avoid divide by zero errors
for (var i = c + 2; i < c * 2; i++)
a[i] = 1;

var framebufferSize = new Vector<int>(a, 0);
var size = new Vector<int>(a, c);
var thePoint = new Vector<int>(a, c * 2);
Expand Down