Don't draw lines outside of context
This commit is contained in:
parent
f583b4e69f
commit
b154aed94d
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user