From a59229c5513e73348c87bcfc5cc4b39a31012437 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 28 Apr 2022 01:46:10 -0700 Subject: 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. --- src/modules/montage/montage.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/modules/montage/montage.c') diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 8444616..65aabe6 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -141,17 +141,20 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til xoff = x * tile_width; yoff = y * tile_height; - res_fragment->buf = fragment->buf + (yoff * fragment->pitch) + xoff; - res_fragment->x = 0; /* fragment is a new frame */ - res_fragment->y = 0; /* fragment is a new frame */ - res_fragment->width = MIN(fragment->width - xoff, tile_width); - res_fragment->height = MIN(fragment->height - yoff, tile_height); - res_fragment->frame_width = res_fragment->width; /* fragment is a new frame */ - res_fragment->frame_height = res_fragment->height; /* fragment is a new frame */ - res_fragment->stride = fragment->stride + (fragment->width - res_fragment->width); - res_fragment->pitch = fragment->pitch; - res_fragment->number = number; - res_fragment->cleared = fragment->cleared; + *res_fragment = (til_fb_fragment_t){ + .texture = fragment->texture, + .buf = fragment->buf + (yoff * fragment->pitch) + xoff, + .x = 0, /* fragment is a new frame */ + .y = 0, /* fragment is a new frame */ + .width = MIN(fragment->width - xoff, tile_width), + .height = MIN(fragment->height - yoff, tile_height), + .frame_width = MIN(fragment->width - xoff, tile_width), /* fragment is a new frame */ + .frame_height = MIN(fragment->height - yoff, tile_height), /* fragment is a new frame */ + .stride = fragment->stride + (fragment->width - MIN(fragment->width - xoff, tile_width)), + .pitch = fragment->pitch, + .number = number, + .cleared = fragment->cleared, + }; return 1; } -- cgit v1.2.1