diff --git a/include/util/matrix.h b/include/util/matrix.h index 9b219ff61..ab1e05f71 100644 --- a/include/util/matrix.h +++ b/include/util/matrix.h @@ -7,22 +7,21 @@ struct wlr_box; struct wlr_fbox; /** mat ← a × b */ -void wlr_matrix_multiply(float mat[static 9], const float a[static 9], +void matrix_multiply(float mat[static 9], const float a[static 9], const float b[static 9]); /** Writes a transformation matrix which applies the specified * wl_output_transform to mat */ -void wlr_matrix_transform(float mat[static 9], - enum wl_output_transform transform); +void matrix_transform(float mat[static 9], enum wl_output_transform transform); /** Shortcut for the various matrix operations involved in projecting the * specified wlr_box onto a given orthographic projection. The result is * written to mat, which can be applied to each coordinate of the box to get a * new coordinate from [-1,1]. */ -void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box); +void matrix_project_box(float mat[static 9], const struct wlr_box *box); -void wlr_matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box); +void matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box); /** * Writes a 2D orthographic projection matrix to mat of (width, height). diff --git a/render/gles2/pass.c b/render/gles2/pass.c index 7be09b1a6..d634ebfff 100644 --- a/render/gles2/pass.c +++ b/render/gles2/pass.c @@ -126,7 +126,7 @@ static void render(const struct wlr_box *box, const pixman_region32_t *clip, GLi static void set_proj_matrix(GLint loc, struct wlr_gles2_buffer *buffer, const struct wlr_box *box) { float gl_matrix[9]; - wlr_matrix_project_box(gl_matrix, box); + matrix_project_box(gl_matrix, box); matrix_projection(gl_matrix, buffer->buffer->width, buffer->buffer->height); glUniformMatrix3fv(loc, 1, GL_FALSE, gl_matrix); } @@ -134,14 +134,14 @@ static void set_proj_matrix(GLint loc, struct wlr_gles2_buffer *buffer, const st static void set_tex_matrix(GLint loc, enum wl_output_transform trans, const struct wlr_fbox *box) { float tex_matrix[9]; - wlr_matrix_project_fbox(tex_matrix, box); + matrix_project_fbox(tex_matrix, box); // since textures have a different origin point we have to transform // differently if we are rotating if (trans & WL_OUTPUT_TRANSFORM_90) { - wlr_matrix_transform(tex_matrix, wlr_output_transform_invert(trans)); + matrix_transform(tex_matrix, wlr_output_transform_invert(trans)); } else { - wlr_matrix_transform(tex_matrix, trans); + matrix_transform(tex_matrix, trans); } glUniformMatrix3fv(loc, 1, GL_FALSE, tex_matrix); diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index 0e50e25cd..c263c604a 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -619,7 +619,7 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass, switch (options->blend_mode) { case WLR_RENDER_BLEND_MODE_PREMULTIPLIED:; float matrix[9]; - wlr_matrix_project_box(matrix, &box); + matrix_project_box(matrix, &box); matrix_projection(matrix, pass->render_buffer->wlr_buffer->width, pass->render_buffer->wlr_buffer->height); @@ -711,8 +711,8 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass, float alpha = wlr_render_texture_options_get_alpha(options); float matrix[9]; - wlr_matrix_project_box(matrix, &dst_box); - wlr_matrix_transform(matrix, options->transform); + matrix_project_box(matrix, &dst_box); + matrix_transform(matrix, options->transform); matrix_projection(matrix, pass->render_buffer->wlr_buffer->width, pass->render_buffer->wlr_buffer->height); diff --git a/util/matrix.c b/util/matrix.c index ce4f29fa1..3a7b95c6b 100644 --- a/util/matrix.c +++ b/util/matrix.c @@ -3,7 +3,7 @@ #include #include "util/matrix.h" -void wlr_matrix_multiply(float mat[static 9], const float a[static 9], +void matrix_multiply(float mat[static 9], const float a[static 9], const float b[static 9]) { float product[9]; @@ -65,9 +65,9 @@ static const float transforms[][9] = { }, }; -void wlr_matrix_transform(float mat[static 9], +void matrix_transform(float mat[static 9], enum wl_output_transform transform) { - wlr_matrix_multiply(mat, mat, transforms[transform]); + matrix_multiply(mat, mat, transforms[transform]); } void matrix_projection(float mat[static 9], int width, int height) { @@ -79,11 +79,11 @@ void matrix_projection(float mat[static 9], int width, int height) { }; float trans[9]; - wlr_matrix_project_fbox(trans, &fbox); - wlr_matrix_multiply(mat, trans, mat); + matrix_project_fbox(trans, &fbox); + matrix_multiply(mat, trans, mat); } -void wlr_matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box) { +void matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box) { mat[0] = box->width; mat[1] = 0.0f; mat[2] = box->x; @@ -97,7 +97,7 @@ void wlr_matrix_project_fbox(float mat[static 9], const struct wlr_fbox *box) { mat[8] = 1.0f; } -void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box) { +void matrix_project_box(float mat[static 9], const struct wlr_box *box) { struct wlr_fbox fbox = { .x = box->x, .y = box->y, @@ -105,5 +105,5 @@ void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box) { .height = box->height, }; - wlr_matrix_project_fbox(mat, &fbox); + matrix_project_fbox(mat, &fbox); }