Skip to content

Commit 803da96

Browse files
jeplerdpgeorge
authored andcommitted
extmod/modframebuf: Save code size in setpixel.
There's a slight code size increase paid for by using setpixel_checked for the last pixel of a line, instead of repeating the checks inline. Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent e152198 commit 803da96

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

extmod/modframebuf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ static void line(const mp_obj_framebuf_t *fb, mp_int_t x1, mp_int_t y1, mp_int_t
483483
e += 2 * dy;
484484
}
485485

486-
if (0 <= x2 && x2 < fb->width && 0 <= y2 && y2 < fb->height) {
487-
setpixel(fb, x2, y2, col);
488-
}
486+
setpixel_checked(fb, x2, y2, col, 1);
489487
}
490488

491489
static mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args_in) {

0 commit comments

Comments
 (0)