mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-16 06:59:44 -05:00
Change how surface matricies are calculated
This commit is contained in:
parent
09faf4ff64
commit
f60b53c6e3
3 changed files with 25 additions and 9 deletions
|
|
@ -353,14 +353,17 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
|
|||
}
|
||||
|
||||
void wlr_surface_get_matrix(struct wlr_surface *surface,
|
||||
float (*matrix)[16], const float (*projection)[16], int x, int y) {
|
||||
float (*matrix)[16],
|
||||
const float (*projection)[16],
|
||||
const float (*transform)[16]) {
|
||||
int width = surface->texture->width / surface->current.scale;
|
||||
int height = surface->texture->height / surface->current.scale;
|
||||
float world[16];
|
||||
float scale[16];
|
||||
wlr_matrix_identity(matrix);
|
||||
wlr_matrix_translate(&world, x, y, 0);
|
||||
wlr_matrix_mul(matrix, &world, matrix);
|
||||
wlr_matrix_scale(&world, width, height, 1);
|
||||
wlr_matrix_mul(matrix, &world, matrix);
|
||||
if (transform) {
|
||||
wlr_matrix_mul(matrix, transform, matrix);
|
||||
}
|
||||
wlr_matrix_scale(&scale, width, height, 1);
|
||||
wlr_matrix_mul(matrix, &scale, matrix);
|
||||
wlr_matrix_mul(projection, matrix, matrix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue