From bb8a7ae77660d2e525b1724282a7998a87d3cbf3 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 9 Jun 2022 09:29:45 -0700 Subject: modules/blinds: use til_fb_put_pixel_checked() While testing an experimental checkers w/fill_module=blinds with ASAN it became clear this module is making flawed assumptions about fragment->frame_{width,height} and fragment->{width,height} being equal. When used by checkers for filling cells, there are situations where the edge cell fragments need to describe a frame slightly larger than the drawn area, because the cell size doesn't align perfectly to the overall window/screen dimensions. So in these cases the synthesized frame will still be a full cell's dimensions while the width,height serve to clip within that area. If modules aren't properly clipping their rendering, instead just using frame_{width,height}, then they will have to use the _checked() variants to ensure clipping occurs properly on a per-pixel (slower) basis. --- src/modules/blinds/blinds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c index e717bb3..1d7b580 100644 --- a/src/modules/blinds/blinds.c +++ b/src/modules/blinds/blinds.c @@ -63,7 +63,7 @@ static inline void draw_blind_horizontal(til_fb_fragment_t *fragment, unsigned r /* XXX FIXME: use faster block style fill/copy if til_fb gets that */ for (unsigned y = 0; y < height; y++) { for (unsigned x = 0; x < fragment->width; x++) - til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y + row * row_height, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y + row * row_height, 0xffffffff); /* FIXME: use _unchecked() variant, but must not assume frame_height == height */ } } @@ -77,7 +77,7 @@ static inline void draw_blind_vertical(til_fb_fragment_t *fragment, unsigned col /* XXX FIXME: use faster block style fill/copy if til_fb gets that */ for (unsigned y = 0; y < fragment->height; y++) { for (unsigned x = 0; x < width; x++) - til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x + column * column_width, fragment->y + y, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x + column * column_width, fragment->y + y, 0xffffffff); /* FIXME: use _unchecked() variant, but must not assume frame_width == width */ } } -- cgit v1.2.3