aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_renderer.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-04-27 12:27:01 +0200
committerDrew DeVault <sir@cmpwn.com>2020-06-17 09:10:54 -0600
commit315bf08733f4bc132a23200df26cb2145ac629b3 (patch)
treeb5e0c382c6ef343466e9a67e488337dbed1a5558 /render/wlr_renderer.c
parent00ccb89288d8d64c2f47282e74cf59967be7178b (diff)
render: add wlr_render_subtexture_with_matrix
This renders only a subset of the texture, instead of the full texture.
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r--render/wlr_renderer.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 016e4d6e..593d165f 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -13,7 +13,7 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
assert(impl->begin);
assert(impl->clear);
assert(impl->scissor);
- assert(impl->render_texture_with_matrix);
+ assert(impl->render_subtexture_with_matrix);
assert(impl->render_quad_with_matrix);
assert(impl->render_ellipse_with_matrix);
assert(impl->formats);
@@ -80,8 +80,21 @@ bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
struct wlr_texture *texture, const float matrix[static 9],
float alpha) {
+ struct wlr_fbox box = {
+ .x = 0,
+ .y = 0,
+ .width = texture->width,
+ .height = texture->height,
+ };
+ return wlr_render_subtexture_with_matrix(r, texture, &box, matrix, alpha);
+}
+
+bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r,
+ struct wlr_texture *texture, const struct wlr_fbox *box,
+ const float matrix[static 9], float alpha) {
assert(r->rendering);
- return r->impl->render_texture_with_matrix(r, texture, matrix, alpha);
+ return r->impl->render_subtexture_with_matrix(r, texture,
+ box, matrix, alpha);
}
void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,