Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
Fix 180-degree rotated buffers without Y_INVERT
Browse files Browse the repository at this point in the history
When the compositor sends a buffer without the Y_INVERT flag, the
resulting image had it rotated by 180 degrees.

References: swaywm/sway#5818
  • Loading branch information
emersion committed Nov 16, 2020
1 parent 2278f44 commit 8bba5b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions render.c
Expand Up @@ -104,10 +104,11 @@ cairo_surface_t *render(struct grim_state *state, struct grim_box *geometry,
cairo_matrix_translate(&matrix,
(double)output->geometry.width / 2,
(double)output->geometry.height / 2);
cairo_matrix_rotate(&matrix, get_output_rotation(output->transform));
cairo_matrix_scale(&matrix,
(double)raw_output_width / output_width * output_flipped_x,
(double)raw_output_width / output_width,
(double)raw_output_height / output_height * output_flipped_y);
cairo_matrix_rotate(&matrix, -get_output_rotation(output->transform));
cairo_matrix_scale(&matrix, output_flipped_x, 1);
cairo_matrix_translate(&matrix,
-(double)output_width / 2,
-(double)output_height / 2);
Expand Down

0 comments on commit 8bba5b6

Please sign in to comment.