summaryrefslogtreecommitdiff
path: root/src/sdl_fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdl_fb.c')
-rw-r--r--src/sdl_fb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c
index 2605d6c..249d746 100644
--- a/src/sdl_fb.c
+++ b/src/sdl_fb.c
@@ -199,13 +199,16 @@ static void * sdl_fb_page_alloc(til_fb_t *fb, void *context, til_fb_page_t *res_
p->surface = SDL_CreateRGBSurface(0, c->width, c->height, 32, 0, 0, 0, 0);
+ /* rototiller wants to assume all pixels to be 32-bit aligned, so prevent unaligning pitches */
+ assert(!(p->surface->pitch & 0x3));
+
res_page->fragment.buf = p->surface->pixels;
res_page->fragment.width = c->width;
res_page->fragment.frame_width = c->width;
res_page->fragment.height = c->height;
res_page->fragment.frame_height = c->height;
- res_page->fragment.stride = p->surface->pitch - (c->width * 4);
- res_page->fragment.pitch = p->surface->pitch;
+ res_page->fragment.pitch = p->surface->pitch >> 2;
+ res_page->fragment.stride = res_page->fragment.pitch - c->width;
return p;
}
© All Rights Reserved