diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/render.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index f011e0ff..a3ae5efc 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -104,10 +104,18 @@ static void set_scale_filter(struct wlr_output *wlr_output, | |||
104 | 104 | ||
105 | static void render_texture(struct render_context *ctx, struct wlr_texture *texture, | 105 | static void render_texture(struct render_context *ctx, struct wlr_texture *texture, |
106 | const struct wlr_fbox *src_box, const struct wlr_box *dst_box, | 106 | const struct wlr_fbox *src_box, const struct wlr_box *dst_box, |
107 | const float matrix[static 9], float alpha) { | 107 | enum wl_output_transform transform, float alpha) { |
108 | struct wlr_renderer *renderer = ctx->renderer; | 108 | struct wlr_renderer *renderer = ctx->renderer; |
109 | struct sway_output *output = ctx->output; | 109 | struct sway_output *output = ctx->output; |
110 | 110 | ||
111 | struct wlr_box proj_box = *dst_box; | ||
112 | scale_box(&proj_box, output->wlr_output->scale); | ||
113 | |||
114 | float matrix[9]; | ||
115 | enum wl_output_transform inv_transform = wlr_output_transform_invert(transform); | ||
116 | wlr_matrix_project_box(matrix, &proj_box, inv_transform, 0, | ||
117 | output->wlr_output->transform_matrix); | ||
118 | |||
111 | pixman_region32_t damage; | 119 | pixman_region32_t damage; |
112 | pixman_region32_init(&damage); | 120 | pixman_region32_init(&damage); |
113 | pixman_region32_union_rect(&damage, &damage, dst_box->x, dst_box->y, | 121 | pixman_region32_union_rect(&damage, &damage, dst_box->x, dst_box->y, |
@@ -152,12 +160,6 @@ static void render_surface_iterator(struct sway_output *output, | |||
152 | struct wlr_box proj_box = *_box; | 160 | struct wlr_box proj_box = *_box; |
153 | scale_box(&proj_box, wlr_output->scale); | 161 | scale_box(&proj_box, wlr_output->scale); |
154 | 162 | ||
155 | float matrix[9]; | ||
156 | enum wl_output_transform transform = | ||
157 | wlr_output_transform_invert(surface->current.transform); | ||
158 | wlr_matrix_project_box(matrix, &proj_box, transform, 0.0, | ||
159 | wlr_output->transform_matrix); | ||
160 | |||
161 | struct wlr_box dst_box = *_box; | 163 | struct wlr_box dst_box = *_box; |
162 | struct wlr_box *clip_box = data->clip_box; | 164 | struct wlr_box *clip_box = data->clip_box; |
163 | if (clip_box != NULL) { | 165 | if (clip_box != NULL) { |
@@ -167,7 +169,7 @@ static void render_surface_iterator(struct sway_output *output, | |||
167 | scale_box(&dst_box, wlr_output->scale); | 169 | scale_box(&dst_box, wlr_output->scale); |
168 | 170 | ||
169 | render_texture(data->ctx, texture, | 171 | render_texture(data->ctx, texture, |
170 | &src_box, &dst_box, matrix, alpha); | 172 | &src_box, &dst_box, surface->current.transform, alpha); |
171 | 173 | ||
172 | wlr_presentation_surface_sampled_on_output(server.presentation, surface, | 174 | wlr_presentation_surface_sampled_on_output(server.presentation, surface, |
173 | wlr_output); | 175 | wlr_output); |
@@ -323,11 +325,6 @@ static void render_saved_view(struct render_context *ctx, struct sway_view *view | |||
323 | struct wlr_box dst_box = proj_box; | 325 | struct wlr_box dst_box = proj_box; |
324 | scale_box(&proj_box, wlr_output->scale); | 326 | scale_box(&proj_box, wlr_output->scale); |
325 | 327 | ||
326 | float matrix[9]; | ||
327 | enum wl_output_transform transform = wlr_output_transform_invert(saved_buf->transform); | ||
328 | wlr_matrix_project_box(matrix, &proj_box, transform, 0, | ||
329 | wlr_output->transform_matrix); | ||
330 | |||
331 | if (!floating) { | 328 | if (!floating) { |
332 | dst_box.width = fmin(dst_box.width, | 329 | dst_box.width = fmin(dst_box.width, |
333 | view->container->current.content_width - | 330 | view->container->current.content_width - |
@@ -339,7 +336,7 @@ static void render_saved_view(struct render_context *ctx, struct sway_view *view | |||
339 | scale_box(&dst_box, wlr_output->scale); | 336 | scale_box(&dst_box, wlr_output->scale); |
340 | 337 | ||
341 | render_texture(ctx, saved_buf->buffer->texture, | 338 | render_texture(ctx, saved_buf->buffer->texture, |
342 | &saved_buf->source_box, &dst_box, matrix, alpha); | 339 | &saved_buf->source_box, &dst_box, saved_buf->transform, alpha); |
343 | } | 340 | } |
344 | 341 | ||
345 | // FIXME: we should set the surface that this saved buffer originates from | 342 | // FIXME: we should set the surface that this saved buffer originates from |
@@ -511,16 +508,11 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c | |||
511 | texture_box.y = round((bg_y - output_y) * output_scale) + | 508 | texture_box.y = round((bg_y - output_y) * output_scale) + |
512 | ob_padding_above; | 509 | ob_padding_above; |
513 | 510 | ||
514 | float matrix[9]; | ||
515 | wlr_matrix_project_box(matrix, &texture_box, | ||
516 | WL_OUTPUT_TRANSFORM_NORMAL, | ||
517 | 0.0, output->wlr_output->transform_matrix); | ||
518 | |||
519 | if (ob_inner_width < texture_box.width) { | 511 | if (ob_inner_width < texture_box.width) { |
520 | texture_box.width = ob_inner_width; | 512 | texture_box.width = ob_inner_width; |
521 | } | 513 | } |
522 | render_texture(ctx, marks_texture, | 514 | render_texture(ctx, marks_texture, |
523 | NULL, &texture_box, matrix, con->alpha); | 515 | NULL, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); |
524 | 516 | ||
525 | // Padding above | 517 | // Padding above |
526 | memcpy(&color, colors->background, sizeof(float) * 4); | 518 | memcpy(&color, colors->background, sizeof(float) * 4); |
@@ -586,17 +578,12 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c | |||
586 | texture_box.y = | 578 | texture_box.y = |
587 | round((bg_y - output_y) * output_scale) + ob_padding_above; | 579 | round((bg_y - output_y) * output_scale) + ob_padding_above; |
588 | 580 | ||
589 | float matrix[9]; | ||
590 | wlr_matrix_project_box(matrix, &texture_box, | ||
591 | WL_OUTPUT_TRANSFORM_NORMAL, | ||
592 | 0.0, output->wlr_output->transform_matrix); | ||
593 | |||
594 | if (ob_inner_width - ob_marks_width < texture_box.width) { | 581 | if (ob_inner_width - ob_marks_width < texture_box.width) { |
595 | texture_box.width = ob_inner_width - ob_marks_width; | 582 | texture_box.width = ob_inner_width - ob_marks_width; |
596 | } | 583 | } |
597 | 584 | ||
598 | render_texture(ctx, title_texture, | 585 | render_texture(ctx, title_texture, |
599 | NULL, &texture_box, matrix, con->alpha); | 586 | NULL, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha); |
600 | 587 | ||
601 | // Padding above | 588 | // Padding above |
602 | memcpy(&color, colors->background, sizeof(float) * 4); | 589 | memcpy(&color, colors->background, sizeof(float) * 4); |