Function
cropScanlines
(lines []Scanline, w, h int)
Source from the content-addressed store, hash-verified
| 6 | } |
| 7 | |
| 8 | func cropScanlines(lines []Scanline, w, h int) []Scanline { |
| 9 | i := 0 |
| 10 | for _, line := range lines { |
| 11 | if line.Y < 0 || line.Y >= h { |
| 12 | continue |
| 13 | } |
| 14 | if line.X1 >= w { |
| 15 | continue |
| 16 | } |
| 17 | if line.X2 < 0 { |
| 18 | continue |
| 19 | } |
| 20 | line.X1 = clampInt(line.X1, 0, w-1) |
| 21 | line.X2 = clampInt(line.X2, 0, w-1) |
| 22 | if line.X1 > line.X2 { |
| 23 | continue |
| 24 | } |
| 25 | lines[i] = line |
| 26 | i++ |
| 27 | } |
| 28 | return lines[:i] |
| 29 | } |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…