diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-27 13:46:04 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-04-27 13:46:04 -0700 |
commit | c881616cfbbd8c20d67f469d363254b2c56a12b7 (patch) | |
tree | e3366155b36d06bf49441746d98912988f6ad9c6 /src/modules/blinds | |
parent | 0f16aad8e0f51b8259b9a8c0a5bac26fcf8b3ef5 (diff) |
til_fb: til_fb_fragment_t.{pitch,stride} uint32_t units
Originally it seemed sensible to make these units of bytes, for
flexibility reasons.
But it's advantageous for everything to be able to assume pixels
are always 4-byte/32-bit aligned. Having the stride/pitch be in
bytes of units made it theoretically possible to produce
unaligned rows of pixels, which would break that assumption.
I don't think anything was ever actually producing such things,
and I've added some asserts to the {sdl,drm}_fb.c page
acquisition code to go fatal on such pages.
This change required going through all the modules and get rid of
their uint32_t vs. void* dances and other such 1-byte vs. 4-byte
scaling arithmetic.
Code is simpler now, and probably faster in some cases. And now
allows future work to just assume things cna always occur 4-bytes
at a time without concern for unaligned accesses.
Diffstat (limited to 'src/modules/blinds')
-rw-r--r-- | src/modules/blinds/blinds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c index c0ae079..9996d8a 100644 --- a/src/modules/blinds/blinds.c +++ b/src/modules/blinds/blinds.c @@ -67,7 +67,7 @@ static inline void draw_blind_horizontal(til_fb_fragment_t *fragment, unsigned r unsigned height = roundf(t * (float)row_height); for (unsigned y = 0; y < height; y++) - memset(fragment->buf + ((row * row_height) + y ) * (fragment->pitch >> 2), 0xff, fragment->width * 4); + memset(fragment->buf + ((row * row_height) + y ) * fragment->pitch, 0xff, fragment->width * 4); } @@ -78,7 +78,7 @@ static inline void draw_blind_vertical(til_fb_fragment_t *fragment, unsigned col unsigned width = roundf(t * (float)column_width); for (unsigned y = 0; y < fragment->height; y++) - memset(fragment->buf + y * (fragment->pitch >> 2) + column * column_width, 0xff, width * 4); + memset(fragment->buf + y * fragment->pitch + column * column_width, 0xff, width * 4); } |