mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
render: add render pass helpers
This commit is contained in:
parent
756dedae20
commit
4a1ad32534
2 changed files with 33 additions and 0 deletions
|
@ -79,4 +79,10 @@ struct wlr_render_pass_impl {
|
|||
const struct wlr_render_rect_options *options);
|
||||
};
|
||||
|
||||
void wlr_render_texture_options_get_src_box(const struct wlr_render_texture_options *options,
|
||||
struct wlr_fbox *box);
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue