summaryrefslogtreecommitdiff
path: root/src/sdl_fb.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-04-28 01:46:10 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-05-01 21:02:41 -0700
commita59229c5513e73348c87bcfc5cc4b39a31012437 (patch)
tree09cbc567f883b8f8677f689f658cd747ca360706 /src/sdl_fb.c
parent7dec62422b3b00f9a347d37f1e7f89e5bbaba0a9 (diff)
til_fb: introduce a fragment texture source
Idea here is to provide texture sources for obtaining pixel colors at the til_fb_put_pixel/fill drawing API, making it possible for at least overlayable modules to serve as mask/stencil operators where their drawn areas are populated by the contents of another fragment produced dynamically, potentially by other modules altogether. This commit adds a texture=modulename option to the compose module for specifying if a texture should be used when compositing, excepting and defaulting to "none" for disabling texturing. A future commit should expand this compose option to accept a potential list of modules for composing the texture in the same way as the main layers= list functions. Something this all immediately makes clear is the need for a better settings syntax, probably in the form of all module setting specifiers optionally being followed by a squence of settings, with support for escaping to handle nested situations.
Diffstat (limited to 'src/sdl_fb.c')
-rw-r--r--src/sdl_fb.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c
index 249d746..b260091 100644
--- a/src/sdl_fb.c
+++ b/src/sdl_fb.c
@@ -202,13 +202,15 @@ static void * sdl_fb_page_alloc(til_fb_t *fb, void *context, til_fb_page_t *res_
/* 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.pitch = p->surface->pitch >> 2;
- res_page->fragment.stride = res_page->fragment.pitch - c->width;
+ *res_page = (til_fb_page_t){
+ .fragment.buf = p->surface->pixels,
+ .fragment.width = c->width,
+ .fragment.frame_width = c->width,
+ .fragment.height = c->height,
+ .fragment.frame_height = c->height,
+ .fragment.pitch = p->surface->pitch >> 2,
+ .fragment.stride = (p->surface->pitch >> 2) - c->width,
+ };
return p;
}
© All Rights Reserved