test95

Undocumented in source.
immutable
auto test95 = q{--- test95 // if callback returns true the traversal stops void tran_thong(i32 xstart, i32 ystart, i32 xend, i32 yend, bool function(void*, i32, i32) callback, void* userData) { i32 x = xstart; i32 y = ystart; if (callback(userData, x, y)) return; i32 deltax; i32 signdx; if (xend >= xstart) { deltax = xend - xstart; signdx = 1; } else { deltax = xstart - xend; signdx = -1; } i32 deltay; i32 signdy; if (yend >= ystart) { deltay = yend - ystart; signdy = 1; } else { deltay = ystart - yend; signdy = -1; } i32 test; if (signdy == -1) test = -1; else test = 0; if (deltax >= deltay) { test = (deltax + test) >> 1; for (i32 i = 1; i < deltax; ++i) { test -= deltay; x += signdx; if (test < 0) { y += signdy; test += deltax; } if (callback(userData, x, y)) return; } } else { test = (deltay + test) >> 1; for (i32 i = 1; i < deltay; ++i) { test -= deltax; y += signdy; if (test < 0) { x += signdx; test += deltay; } if (callback(userData, x, y)) return; } } if (callback(userData, xend, yend)) return; } };

Meta