mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
util/matrix: Introduce wlr_matrix_project_fbox
Same as wlr_matrix_project_box but takes an fbox And use it with gles2
This commit is contained in:
parent
26d24d2229
commit
088b7c98c5
3 changed files with 18 additions and 12 deletions
|
|
@ -111,14 +111,19 @@ void matrix_projection(float mat[static 9], int width, int height) {
|
|||
mat[8] = 1.0f;
|
||||
}
|
||||
|
||||
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box) {
|
||||
int x = box->x;
|
||||
int y = box->y;
|
||||
int width = box->width;
|
||||
int height = box->height;
|
||||
|
||||
void wlr_matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box) {
|
||||
wlr_matrix_identity(mat);
|
||||
wlr_matrix_translate(mat, x, y);
|
||||
|
||||
wlr_matrix_scale(mat, width, height);
|
||||
wlr_matrix_translate(mat, box->x, box->y);
|
||||
wlr_matrix_scale(mat, box->width, box->height);
|
||||
}
|
||||
|
||||
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box) {
|
||||
struct wlr_fbox fbox = {
|
||||
.x = box->x,
|
||||
.y = box->y,
|
||||
.width = box->width,
|
||||
.height = box->height,
|
||||
};
|
||||
|
||||
wlr_matrix_project_fbox(mat, &fbox);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue