mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
util/matrix: Simplify wlr_matrix_project_box
Remove the transform and projection arguments.
This commit is contained in:
parent
3a4bc44688
commit
b6fec1b101
3 changed files with 11 additions and 19 deletions
|
|
@ -24,11 +24,11 @@ void wlr_matrix_transform(float mat[static 9],
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
|
|
||||||
/** Shortcut for the various matrix operations involved in projecting the
|
/** Shortcut for the various matrix operations involved in projecting the
|
||||||
* specified wlr_box onto a given orthographic projection with a given
|
* specified wlr_box onto a given orthographic projection. The result is
|
||||||
* rotation. The result is written to mat, which can be applied to each
|
* written to mat, which can be applied to each coordinate of the box to get a
|
||||||
* coordinate of the box to get a new coordinate from [-1,1]. */
|
* new coordinate from [-1,1].
|
||||||
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box,
|
*/
|
||||||
enum wl_output_transform transform, const float projection[static 9]);
|
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a 2D orthographic projection matrix to mat of (width, height) with a
|
* Writes a 2D orthographic projection matrix to mat of (width, height) with a
|
||||||
|
|
|
||||||
|
|
@ -618,9 +618,8 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
|
||||||
|
|
||||||
switch (options->blend_mode) {
|
switch (options->blend_mode) {
|
||||||
case WLR_RENDER_BLEND_MODE_PREMULTIPLIED:;
|
case WLR_RENDER_BLEND_MODE_PREMULTIPLIED:;
|
||||||
float proj[9], matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_identity(proj);
|
wlr_matrix_project_box(matrix, &box);
|
||||||
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, proj);
|
|
||||||
wlr_matrix_multiply(matrix, pass->projection, matrix);
|
wlr_matrix_multiply(matrix, pass->projection, matrix);
|
||||||
|
|
||||||
struct wlr_vk_render_format_setup *setup = pass->srgb_pathway ?
|
struct wlr_vk_render_format_setup *setup = pass->srgb_pathway ?
|
||||||
|
|
@ -709,9 +708,9 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
|
||||||
wlr_render_texture_options_get_dst_box(options, &dst_box);
|
wlr_render_texture_options_get_dst_box(options, &dst_box);
|
||||||
float alpha = wlr_render_texture_options_get_alpha(options);
|
float alpha = wlr_render_texture_options_get_alpha(options);
|
||||||
|
|
||||||
float proj[9], matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_identity(proj);
|
wlr_matrix_project_box(matrix, &dst_box);
|
||||||
wlr_matrix_project_box(matrix, &dst_box, options->transform, proj);
|
wlr_matrix_transform(matrix, options->transform);
|
||||||
wlr_matrix_multiply(matrix, pass->projection, matrix);
|
wlr_matrix_multiply(matrix, pass->projection, matrix);
|
||||||
|
|
||||||
struct wlr_vk_vert_pcr_data vert_pcr_data = {
|
struct wlr_vk_vert_pcr_data vert_pcr_data = {
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,7 @@ void matrix_projection(float mat[static 9], int width, int height,
|
||||||
mat[8] = 1.0f;
|
mat[8] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box,
|
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box) {
|
||||||
enum wl_output_transform transform, const float projection[static 9]) {
|
|
||||||
int x = box->x;
|
int x = box->x;
|
||||||
int y = box->y;
|
int y = box->y;
|
||||||
int width = box->width;
|
int width = box->width;
|
||||||
|
|
@ -130,10 +129,4 @@ void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box,
|
||||||
wlr_matrix_translate(mat, x, y);
|
wlr_matrix_translate(mat, x, y);
|
||||||
|
|
||||||
wlr_matrix_scale(mat, width, height);
|
wlr_matrix_scale(mat, width, height);
|
||||||
|
|
||||||
if (transform != WL_OUTPUT_TRANSFORM_NORMAL) {
|
|
||||||
wlr_matrix_transform(mat, transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_matrix_multiply(mat, projection, mat);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue