diff options
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 92ccfd09..552502aa 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -99,7 +99,7 @@ static void set_scale_filter(struct wlr_output *wlr_output, | |||
99 | 99 | ||
100 | static void render_texture(struct render_context *ctx, struct wlr_texture *texture, | 100 | static void render_texture(struct render_context *ctx, struct wlr_texture *texture, |
101 | const struct wlr_fbox *_src_box, const struct wlr_box *dst_box, | 101 | const struct wlr_fbox *_src_box, const struct wlr_box *dst_box, |
102 | enum wl_output_transform transform, float alpha) { | 102 | const struct wlr_box *clip_box, enum wl_output_transform transform, float alpha) { |
103 | struct sway_output *output = ctx->output; | 103 | struct sway_output *output = ctx->output; |
104 | 104 | ||
105 | struct wlr_box proj_box = *dst_box; | 105 | struct wlr_box proj_box = *dst_box; |
@@ -113,6 +113,12 @@ static void render_texture(struct render_context *ctx, struct wlr_texture *textu | |||
113 | pixman_region32_init_rect(&damage, proj_box.x, proj_box.y, | 113 | pixman_region32_init_rect(&damage, proj_box.x, proj_box.y, |
114 | proj_box.width, proj_box.height); | 114 | proj_box.width, proj_box.height); |
115 | pixman_region32_intersect(&damage, &damage, ctx->output_damage); | 115 | pixman_region32_intersect(&damage, &damage, ctx->output_damage); |
116 | |||
117 | if (clip_box) { | ||
118 | pixman_region32_intersect_rect(&damage, &damage, | ||
119 | clip_box->x, clip_box->y, clip_box->width, clip_box->height); | ||
120 | } | ||
121 | |||
116 | bool damaged = pixman_region32_not_empty(&damage); | 122 | bool damaged = pixman_region32_not_empty(&damage); |
117 | if (!damaged) { | 123 | if (!damaged) { |
118 | goto damage_finish; | 124 | goto damage_finish; |
@@ -151,19 +157,17 @@ static void render_surface_iterator(struct sway_output *output, | |||
151 | struct wlr_fbox src_box; | 157 | struct wlr_fbox src_box; |
152 | wlr_surface_get_buffer_source_box(surface, &src_box); | 158 | wlr_surface_get_buffer_source_box(surface, &src_box); |
153 | 159 | ||
154 | struct wlr_box proj_box = *_box; | ||
155 | scale_box(&proj_box, wlr_output->scale); | ||
156 | |||
157 | struct wlr_box dst_box = *_box; | 160 | struct wlr_box dst_box = *_box; |
158 | struct wlr_box *clip_box = data->clip_box; | 161 | struct wlr_box clip_box = *_box; |
159 | if (clip_box != NULL) { | 162 | if (data->clip_box != NULL) { |
160 | dst_box.width = fmin(dst_box.width, clip_box->width); | 163 | clip_box.width = fmin(dst_box.width, data->clip_box->width); |
161 | dst_box.height = fmin(dst_box.height, clip_box->height); | 164 | clip_box.height = fmin(dst_box.height, data->clip_box->height); |
162 | } | 165 | } |
163 | scale_box(&dst_box, wlr_output->scale); | 166 | scale_box(&dst_box, wlr_output->scale); |
167 | scale_box(&clip_box, wlr_output->scale); | ||
164 | 168 | ||
165 | render_texture(data->ctx, texture, | 169 | render_texture(data->ctx, texture, |
166 | &src_box, &dst_box, surface->current.transform, alpha); | 170 | &src_box, &dst_box, &clip_box, surface->current.transform, alpha); |
167 | 171 | ||
168 | wlr_presentation_surface_sampled_on_output(server.presentation, surface, | 172 | wlr_presentation_surface_sampled_on_output(server.presentation, surface, |
169 | wlr_output); | 173 | wlr_output); |
@@ -320,20 +324,20 @@ static void render_saved_view(struct render_context *ctx, struct sway_view *view | |||
320 | } | 324 | } |
321 | 325 | ||
322 | struct wlr_box dst_box = proj_box; | 326 | struct wlr_box dst_box = proj_box; |
323 | scale_box(&proj_box, wlr_output->scale); | 327 | struct wlr_box clip_box = proj_box; |
324 | |||
325 | if (!floating) { | 328 | if (!floating) { |
326 | dst_box.width = fmin(dst_box.width, | 329 | clip_box.width = fmin(dst_box.width, |
327 | view->container->current.content_width - | 330 | view->container->current.content_width - |
328 | (saved_buf->x - view->container->current.content_x) + view->saved_geometry.x); | 331 | (saved_buf->x - view->container->current.content_x) + view->saved_geometry.x); |
329 | dst_box.height = fmin(dst_box.height, | 332 | clip_box.height = fmin(dst_box.height, |
330 | view->container->current.content_height - | 333 | view->container->current.content_height - |
331 | (saved_buf->y - view->container->current.content_y) + view->saved_geometry.y); | 334 | (saved_buf->y - view->container->current.content_y) + view->saved_geometry.y); |
332 | } | 335 | } |
333 | scale_box(&dst_box, wlr_output->scale); | 336 | scale_box(&dst_box, wlr_output->scale); |
337 | scale_box(&clip_box, wlr_output->scale); | ||
334 | 338 | ||
335 | render_texture(ctx, saved_buf->buffer->texture, | 339 | render_texture(ctx, saved_buf->buffer->texture, |
336 | &saved_buf->source_box, &dst_box, saved_buf->transform, alpha); | 340 | &saved_buf->source_box, &dst_box, &clip_box, saved_buf->transform, alpha); |
337 | } | 341 | } |
338 | 342 | ||
339 | // FIXME: we should set the surface that this saved buffer originates from | 343 | // FIXME: we should set the surface that this saved buffer originates from |
@@ -509,7 +513,7 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c | |||
509 | texture_box.width = ob_inner_width; | 513 | texture_box.width = ob_inner_width; |
510 | } | 514 | } |
511 | render_texture(ctx, marks_texture, | 515 | render_texture(ctx, marks_texture, |
512 | NULL, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); | 516 | NULL, &texture_box, NULL, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); |
513 | 517 | ||
514 | // Padding above | 518 | // Padding above |
515 | memcpy(&color, colors->background, sizeof(float) * 4); | 519 | memcpy(&color, colors->background, sizeof(float) * 4); |
@@ -580,7 +584,7 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c | |||
580 | } | 584 | } |
581 | 585 | ||
582 | render_texture(ctx, title_texture, | 586 | render_texture(ctx, title_texture, |
583 | NULL, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); | 587 | NULL, &texture_box, NULL, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); |
584 | 588 | ||
585 | // Padding above | 589 | // Padding above |
586 | memcpy(&color, colors->background, sizeof(float) * 4); | 590 | memcpy(&color, colors->background, sizeof(float) * 4); |