diff options
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 14753df2..491a9bc0 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -280,37 +280,44 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output, pixman_region32_t *damage, float alpha) { struct wlr_output *wlr_output = output->wlr_output; - if (!view->saved_buffer || !view->saved_buffer->texture) { + if (wl_list_empty(&view->saved_buffers)) { return; } - struct wlr_box box = { - .x = view->container->surface_x - output->lx - - view->saved_geometry.x, - .y = view->container->surface_y - output->ly - - view->saved_geometry.y, - .width = view->saved_buffer_width, - .height = view->saved_buffer_height, - }; - - struct wlr_box output_box = { - .width = output->width, - .height = output->height, - }; + struct sway_saved_buffer *saved_buf; + wl_list_for_each(saved_buf, &view->saved_buffers, link) { + if (!saved_buf->buffer->texture) { + continue; + } - struct wlr_box intersection; - bool intersects = wlr_box_intersection(&intersection, &output_box, &box); - if (!intersects) { - return; - } + struct wlr_box box = { + .x = view->container->surface_x - output->lx - + view->saved_geometry.x + saved_buf->x, + .y = view->container->surface_y - output->ly - + view->saved_geometry.y + saved_buf->y, + .width = saved_buf->width, + .height = saved_buf->height, + }; + + struct wlr_box output_box = { + .width = output->width, + .height = output->height, + }; + + struct wlr_box intersection; + bool intersects = wlr_box_intersection(&intersection, &output_box, &box); + if (!intersects) { + continue; + } - scale_box(&box, wlr_output->scale); + scale_box(&box, wlr_output->scale); - float matrix[9]; - wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0, - wlr_output->transform_matrix); + float matrix[9]; + wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0, + wlr_output->transform_matrix); - render_texture(wlr_output, damage, view->saved_buffer->texture, - &box, matrix, alpha); + render_texture(wlr_output, damage, saved_buf->buffer->texture, + &box, matrix, alpha); + } // FIXME: we should set the surface that this saved buffer originates from // as sampled here. @@ -323,7 +330,7 @@ static void render_saved_view(struct sway_view *view, static void render_view(struct sway_output *output, pixman_region32_t *damage, struct sway_container *con, struct border_colors *colors) { struct sway_view *view = con->view; - if (view->saved_buffer) { + if (!wl_list_empty(&view->saved_buffers)) { render_saved_view(view, output, damage, view->container->alpha); } else if (view->surface) { render_view_toplevels(view, output, damage, view->container->alpha); @@ -1020,7 +1027,7 @@ void output_render(struct sway_output *output, struct timespec *when, } if (fullscreen_con->view) { - if (fullscreen_con->view->saved_buffer) { + if (!wl_list_empty(&fullscreen_con->view->saved_buffers)) { render_saved_view(fullscreen_con->view, output, damage, 1.0f); } else if (fullscreen_con->view->surface) { render_view_toplevels(fullscreen_con->view, |