mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-14 06:59:43 -05:00
implement surface sizing
This commit is contained in:
parent
b49650b555
commit
e46ec57b43
3 changed files with 18 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/egl.h>
|
||||
#include <wlr/render/interface.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include <wlr/render/matrix.h>
|
||||
|
||||
static void surface_destroy(struct wl_client *client, struct wl_resource *resource) {
|
||||
wl_resource_destroy(resource);
|
||||
|
|
@ -268,3 +269,16 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
|
|||
surface, destroy_surface);
|
||||
return surface;
|
||||
}
|
||||
|
||||
void wlr_surface_get_matrix(struct wlr_surface *surface,
|
||||
float (*matrix)[16], const float (*projection)[16], int x, int y) {
|
||||
int width = surface->texture->width / surface->current.scale;
|
||||
int height = surface->texture->height / surface->current.scale;
|
||||
float world[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);
|
||||
wlr_matrix_mul(projection, matrix, matrix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue