Don't draw lines outside of context
This commit is contained in:
parent
f583b4e69f
commit
b154aed94d
@ -35,6 +35,8 @@ void draw_line(
|
|||||||
int64_t diff = dx - dy;
|
int64_t diff = dx - dy;
|
||||||
uint32_t *fb = (uint32_t *)ctx->buffer;
|
uint32_t *fb = (uint32_t *)ctx->buffer;
|
||||||
while(1) {
|
while(1) {
|
||||||
|
if(0 < x && x < ctx->width &&
|
||||||
|
0 < y && y < ctx->height)
|
||||||
fb[PXL(ctx, x, y)] = clr;
|
fb[PXL(ctx, x, y)] = clr;
|
||||||
if(x == x1 && y == y1) break;
|
if(x == x1 && y == y1) break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user