From 5299d973d5f497180b0ccf80d09a4aed4ebbfea2 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 28 Aug 2023 15:00:43 -0400 Subject: [PATCH] render/pass: Introduce wlr_render_rect_options_get_box --- include/wlr/render/interface.h | 2 ++ render/pass.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 63fd3cf5..06f4083f 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -95,5 +95,7 @@ void wlr_render_texture_options_get_src_box(const struct wlr_render_texture_opti void wlr_render_texture_options_get_dst_box(const struct wlr_render_texture_options *options, struct wlr_box *box); float wlr_render_texture_options_get_alpha(const struct wlr_render_texture_options *options); +void wlr_render_rect_options_get_box(const struct wlr_render_rect_options *options, + const struct wlr_buffer *buffer, struct wlr_box *box); #endif diff --git a/render/pass.c b/render/pass.c index 0fa31556..a36b9dc1 100644 --- a/render/pass.c +++ b/render/pass.c @@ -74,6 +74,20 @@ float wlr_render_texture_options_get_alpha(const struct wlr_render_texture_optio return *options->alpha; } +void wlr_render_rect_options_get_box(const struct wlr_render_rect_options *options, + const struct wlr_buffer *buffer, struct wlr_box *box) { + if (wlr_box_empty(&options->box)) { + *box = (struct wlr_box){ + .width = buffer->width, + .height = buffer->height, + }; + + return; + } + + *box = options->box; +} + static const struct wlr_render_pass_impl legacy_impl; static struct wlr_render_pass_legacy *legacy_pass_from_pass(struct wlr_render_pass *pass) {