summaryrefslogtreecommitdiff
path: root/src/fb.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-24 01:19:06 -0800
committerVito Caputo <vcaputo@pengaru.com>2019-11-24 01:19:06 -0800
commit53cc747fd2bdd774bc6f27f8aca5749c664b5cc7 (patch)
treeb786391e503379d539919657f01ea9eafd28292b /src/fb.c
parent6bfd66051632fdb8eca4103df2c3c67492d28af7 (diff)
fb: add pitch to fb_fragment_t
The put_pixel helpers really needed reworking to properly handle subframe fragments modules like montage will utilize. I had the stride present as it's convenient for a number of modules that maintain a buf pointer as they progress down a row, but the pitch is more applicable to put_pixel for scaling the y coordinate. Now there's both pitch and stride so everyone's happy with what's most convenient for their needs.
Diffstat (limited to 'src/fb.c')
-rw-r--r--src/fb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/fb.c b/src/fb.c
index 7485800..a20fdd3 100644
--- a/src/fb.c
+++ b/src/fb.c
@@ -319,9 +319,7 @@ int fb_fragment_slice_single(const fb_fragment_t *fragment, unsigned n_fragments
if (yoff >= fragment->height)
return 0;
- pitch = (fragment->width * 4) + fragment->stride;
-
- res_fragment->buf = ((void *)fragment->buf) + yoff * pitch;
+ res_fragment->buf = ((void *)fragment->buf) + yoff * fragment->pitch;
res_fragment->x = fragment->x;
res_fragment->y = yoff;
res_fragment->width = fragment->width;
@@ -329,6 +327,7 @@ int fb_fragment_slice_single(const fb_fragment_t *fragment, unsigned n_fragments
res_fragment->frame_width = fragment->frame_width;
res_fragment->frame_height = fragment->frame_height;
res_fragment->stride = fragment->stride;
+ res_fragment->pitch = fragment->pitch;
return 1;
}
@@ -337,7 +336,6 @@ int fb_fragment_slice_single(const fb_fragment_t *fragment, unsigned n_fragments
int fb_fragment_tile_single(const fb_fragment_t *fragment, unsigned tile_size, unsigned num, fb_fragment_t *res_fragment)
{
unsigned w = fragment->width / tile_size, h = fragment->height / tile_size;
- unsigned pitch = (fragment->width * 4) + fragment->stride;
unsigned x, y, xoff, yoff;
if (w * tile_size < fragment->width)
@@ -355,7 +353,7 @@ int fb_fragment_tile_single(const fb_fragment_t *fragment, unsigned tile_size, u
xoff = x * tile_size;
yoff = y * tile_size;
- res_fragment->buf = (void *)fragment->buf + (yoff * pitch) + (xoff * 4);
+ res_fragment->buf = (void *)fragment->buf + (yoff * fragment->pitch) + (xoff * 4);
res_fragment->x = fragment->x + xoff;
res_fragment->y = fragment->y + yoff;
res_fragment->width = MIN(fragment->width - xoff, tile_size);
@@ -363,6 +361,7 @@ int fb_fragment_tile_single(const fb_fragment_t *fragment, unsigned tile_size, u
res_fragment->frame_width = fragment->frame_width;
res_fragment->frame_height = fragment->frame_height;
res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4);
+ res_fragment->pitch = fragment->pitch;
return 1;
}
© All Rights Reserved