Line no longer segfaults

This commit is contained in:
Sasha Koshka 2023-01-14 14:05:27 -05:00
parent e740f5385c
commit 4d609f6fa1
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func lineLow (
width, height int,
) {
data, stride := destination.Buffer()
bounds := destination.Bounds()
deltaX := max.X - min.X
deltaY := max.Y - min.Y
@ -66,6 +67,7 @@ func lineLow (
y := min.Y
for x := min.X; x < max.X; x ++ {
if !(image.Point { x, y }).In(bounds) { break }
data[x + y * stride] = source.AtWhen(x, y, width, height)
if D > 0 {
y += yi
@ -85,6 +87,7 @@ func lineHigh (
width, height int,
) {
data, stride := destination.Buffer()
bounds := destination.Bounds()
deltaX := max.X - min.X
deltaY := max.Y - min.Y
@ -99,6 +102,7 @@ func lineHigh (
x := min.X
for y := min.Y; y < max.Y; y ++ {
if !(image.Point { x, y }).In(bounds) { break }
data[x + y * stride] = source.AtWhen(x, y, width, height)
if D > 0 {
x += xi