Don't draw lines outside of context

This commit is contained in:
Thomas Lovén 2022-01-22 15:37:57 +01:00
parent f583b4e69f
commit b154aed94d

View File

@ -35,7 +35,9 @@ void draw_line(
int64_t diff = dx - dy;
uint32_t *fb = (uint32_t *)ctx->buffer;
while(1) {
fb[PXL(ctx, x, y)] = clr;
if(0 < x && x < ctx->width &&
0 < y && y < ctx->height)
fb[PXL(ctx, x, y)] = clr;
if(x == x1 && y == y1) break;
if((2*diff) > -dy) {