summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorErik Reider <[email protected]>2023-07-27 07:02:25 +0200
committerGitHub <[email protected]>2023-07-27 01:02:25 -0400
commit67103a7c47ffcbedd876eeba2d0aa439616359e3 (patch)
tree05fc2d2595958b68232ac0b2db83954439558f22 /render
parent4d988e489fa651c09ccd4df2175485301056a42f (diff)
feat: add corner radius parameter (#10)
Diffstat (limited to 'render')
-rw-r--r--render/fx_renderer/fx_renderer.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/render/fx_renderer/fx_renderer.c b/render/fx_renderer/fx_renderer.c
index c30108a..014be33 100644
--- a/render/fx_renderer/fx_renderer.c
+++ b/render/fx_renderer/fx_renderer.c
@@ -282,8 +282,10 @@ void fx_renderer_scissor(struct wlr_box *box) {
}
}
-bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture,
- const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9]) {
+bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer,
+ struct wlr_texture *wlr_texture, const struct wlr_fbox *src_box,
+ const struct wlr_box *dst_box, const float matrix[static 9],
+ float opacity, int corner_radius) {
assert(wlr_texture_is_gles2(wlr_texture));
struct wlr_gles2_texture_attribs texture_attrs;
@@ -320,12 +322,8 @@ bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_t
// to GL_FALSE
wlr_matrix_transpose(gl_matrix, gl_matrix);
- // TODO: accept me as params!
- float alpha = 1.0;
- int corner_radius = 0;
-
// if there's no opacity or rounded corners we don't need to blend
- if (!texture_attrs.has_alpha && alpha == 1.0 && !corner_radius) {
+ if (!texture_attrs.has_alpha && opacity == 1.0 && !corner_radius) {
glDisable(GL_BLEND);
} else {
glEnable(GL_BLEND);
@@ -344,7 +342,7 @@ bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_t
glUniform1i(shader->tex, 0);
glUniform2f(shader->size, dst_box->width, dst_box->height);
glUniform2f(shader->position, dst_box->x, dst_box->y);
- glUniform1f(shader->alpha, alpha);
+ glUniform1f(shader->alpha, opacity);
glUniform1f(shader->radius, corner_radius);
const GLfloat x1 = src_box->x / wlr_texture->width;