aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-04-14 17:50:26 +0200
committerSimon Ser <contact@emersion.fr>2023-04-25 17:25:10 +0200
commit4a1ad32534e1a5f53a066d0b546f5f979a9c5b5e (patch)
treee1cff46bb66c51307cca2af3ce8541e3d2506d73 /render
parent756dedae20eead72af6cfc7f724d0b2af6597eeb (diff)
render: add render pass helpers
Diffstat (limited to 'render')
-rw-r--r--render/pass.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/render/pass.c b/render/pass.c
index c1b88b8d..f3309668 100644
--- a/render/pass.c
+++ b/render/pass.c
@@ -23,3 +23,30 @@ void wlr_render_pass_add_rect(struct wlr_render_pass *render_pass,
const struct wlr_render_rect_options *options) {
render_pass->impl->add_rect(render_pass, options);
}
+
+void wlr_render_texture_options_get_src_box(const struct wlr_render_texture_options *options,
+ struct wlr_fbox *box) {
+ *box = options->src_box;
+ if (wlr_fbox_empty(box)) {
+ *box = (struct wlr_fbox){
+ .width = options->texture->width,
+ .height = options->texture->height,
+ };
+ }
+}
+
+void wlr_render_texture_options_get_dst_box(const struct wlr_render_texture_options *options,
+ struct wlr_box *box) {
+ *box = options->dst_box;
+ if (wlr_box_empty(box)) {
+ box->width = options->texture->width;
+ box->height = options->texture->height;
+ }
+}
+
+float wlr_render_texture_options_get_alpha(const struct wlr_render_texture_options *options) {
+ if (options->alpha == NULL) {
+ return 1;
+ }
+ return *options->alpha;
+}