rename matrix model box to project box

master
Tony Crisci 7 years ago
parent e8c407d00e
commit 85a6939cf2

@ -15,7 +15,8 @@ void wlr_matrix_transform(float mat[static 16],
enum wl_output_transform transform); enum wl_output_transform transform);
void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height,
enum wl_output_transform transform); enum wl_output_transform transform);
void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, void wlr_matrix_project_box(float (*mat)[16], struct wlr_box *box,
enum wl_output_transform transform, float rotation); enum wl_output_transform transform, float rotation, float
(*projection)[16]);
#endif #endif

@ -161,8 +161,9 @@ void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height,
mat[15] = 1.0f; mat[15] = 1.0f;
} }
void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, void wlr_matrix_project_box(float (*mat)[16], struct wlr_box *box,
enum wl_output_transform transform, float rotation) { enum wl_output_transform transform, float rotation,
float (*projection)[16]) {
int x = box->x; int x = box->x;
int y = box->y; int y = box->y;
int width = box->width; int width = box->width;
@ -203,4 +204,6 @@ void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box,
wlr_matrix_mul(mat, &surface_translate_origin, wlr_matrix_mul(mat, &surface_translate_origin,
mat); mat);
} }
wlr_matrix_mul(projection, mat, mat);
} }

@ -52,16 +52,15 @@ static void render_surface(struct wlr_surface *surface,
.width = render_width, .height = render_height, .width = render_width, .height = render_height,
}; };
if (wlr_output_layout_intersects(desktop->layout, wlr_output, &render_box)) { if (wlr_output_layout_intersects(desktop->layout, wlr_output, &render_box)) {
struct wlr_box model_box = { struct wlr_box project_box = {
.x = ox, .x = ox,
.y = oy, .y = oy,
.width = render_width, .width = render_width,
.height = render_height, .height = render_height,
}; };
float matrix[16]; float matrix[16];
wlr_matrix_box_model(&matrix, &model_box, surface->current->transform, wlr_matrix_project_box(&matrix, &project_box, surface->current->transform,
rotation); rotation, &wlr_output->transform_matrix);
wlr_matrix_mul(&wlr_output->transform_matrix, &matrix, &matrix);
wlr_render_with_matrix(desktop->server->renderer, surface->texture, wlr_render_with_matrix(desktop->server->renderer, surface->texture,
&matrix); &matrix);
@ -170,7 +169,7 @@ static void render_decorations(struct roots_view *view,
ox *= output->scale; ox *= output->scale;
oy *= output->scale; oy *= output->scale;
struct wlr_box model_box = { struct wlr_box project_box = {
.x = ox, .x = ox,
.y = oy, .y = oy,
.width = deco_box.width, .width = deco_box.width,
@ -178,9 +177,8 @@ static void render_decorations(struct roots_view *view,
}; };
float matrix[16]; float matrix[16];
wlr_matrix_box_model(&matrix, &model_box, WL_OUTPUT_TRANSFORM_NORMAL, wlr_matrix_project_box(&matrix, &project_box, WL_OUTPUT_TRANSFORM_NORMAL,
view->rotation); view->rotation, &output->transform_matrix);
wlr_matrix_mul(&output->transform_matrix, &matrix, &matrix);
float color[4] = { 0.2, 0.2, 0.2, 1 }; float color[4] = { 0.2, 0.2, 0.2, 1 };
wlr_render_colored_quad(desktop->server->renderer, &color, &matrix); wlr_render_colored_quad(desktop->server->renderer, &color, &matrix);
} }

Loading…
Cancel
Save