render: add support for clearing render passes

introduces a new `wlr_render_pass_clear` function, allowing
render passes to be cleared with a solid color.
This commit is contained in:
YaoBing Xiao 2026-01-31 21:45:12 +08:00
parent 7cb4e30bfd
commit eeecb382cc
8 changed files with 120 additions and 8 deletions

View file

@ -225,10 +225,23 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
pixman_image_unref(fill);
}
static void render_pass_clear(struct wlr_render_pass *wlr_pass,
const struct wlr_render_clear_options *options) {
struct wlr_pixman_render_pass *pass = get_render_pass(wlr_pass);
render_pass_add_rect(wlr_pass, &(struct wlr_render_rect_options){
.box = { .width = pass->buffer->buffer->width, .height = pass->buffer->buffer->height },
.color = options->color,
.clip = options->clip,
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
});
}
static const struct wlr_render_pass_impl render_pass_impl = {
.submit = render_pass_submit,
.add_texture = render_pass_add_texture,
.add_rect = render_pass_add_rect,
.clear = render_pass_clear,
};
struct wlr_pixman_render_pass *begin_pixman_render_pass(