diff options
Diffstat (limited to 'rootston/output.c')
-rw-r--r-- | rootston/output.c | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/rootston/output.c b/rootston/output.c index c26ea36e..502e72d2 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -53,46 +53,8 @@ static void render_surface(struct wlr_surface *surface, }; if (wlr_output_layout_intersects(desktop->layout, wlr_output, &render_box)) { float matrix[16]; - - float translate_center[16]; - wlr_matrix_translate(&translate_center, - (int)ox + render_width / 2, (int)oy + render_height / 2, 0); - - float rotate[16]; - wlr_matrix_rotate(&rotate, rotation); - - float translate_origin[16]; - wlr_matrix_translate(&translate_origin, -render_width / 2, - -render_height / 2, 0); - - float scale[16]; - wlr_matrix_scale(&scale, render_width, render_height, 1); - - float transform[16]; - wlr_matrix_mul(&translate_center, &rotate, &transform); - wlr_matrix_mul(&transform, &translate_origin, &transform); - wlr_matrix_mul(&transform, &scale, &transform); - - if (surface->current->transform != WL_OUTPUT_TRANSFORM_NORMAL) { - float surface_translate_center[16]; - wlr_matrix_translate(&surface_translate_center, 0.5, 0.5, 0); - - float surface_transform[16]; - wlr_matrix_transform(surface_transform, - wlr_output_transform_invert(surface->current->transform)); - - float surface_translate_origin[16]; - wlr_matrix_translate(&surface_translate_origin, -0.5, -0.5, 0); - - wlr_matrix_mul(&transform, &surface_translate_center, - &transform); - wlr_matrix_mul(&transform, &surface_transform, &transform); - wlr_matrix_mul(&transform, &surface_translate_origin, - &transform); - } - - wlr_matrix_mul(&wlr_output->transform_matrix, &transform, &matrix); - + wlr_output_get_box_matrix(wlr_output, ox, oy, render_width, + render_height, surface->current->transform, rotation, &matrix); wlr_render_with_matrix(desktop->server->renderer, surface->texture, &matrix); @@ -182,8 +144,32 @@ static void render_xwayland_children(struct wlr_xwayland_surface *surface, } } +static void render_decorations(struct roots_view *view, + struct roots_desktop *desktop, struct wlr_output *output) { + if (!view->decorated) { + return; + } + struct wlr_box deco_box; + view_get_deco_box(view, &deco_box); + double ox = deco_box.x; + double oy = deco_box.y; + wlr_output_layout_output_coords(desktop->layout, output, &ox, &oy); + ox *= output->scale; + oy *= output->scale; + + float matrix[16]; + wlr_output_get_box_matrix(output, ox, oy, deco_box.width, + deco_box.height, WL_OUTPUT_TRANSFORM_NORMAL, view->rotation, + &matrix); + + float color[4] = { 0.2, 0.2, 0.2, 1 }; + wlr_render_colored_quad(desktop->server->renderer, &color, &matrix); +} + static void render_view(struct roots_view *view, struct roots_desktop *desktop, struct wlr_output *wlr_output, struct timespec *when) { + render_decorations(view, desktop, wlr_output); + switch (view->type) { case ROOTS_XDG_SHELL_V6_VIEW: render_surface(view->wlr_surface, desktop, wlr_output, when, |