layout-output example: only render if its on the output

This commit is contained in:
Tony Crisci 2017-08-16 15:06:38 -04:00 committed by Drew DeVault
parent 2e9e237f9d
commit dfb6a12036
1 changed files with 8 additions and 4 deletions

View File

@ -61,10 +61,14 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
wlr_output_layout_output_coords(sample->layout, output->output, &local_x,
&local_y);
if (local_x < width && local_x + 128 > 0 && local_y < height &&
local_y + 128 > 0) {
// render the image if it intersects with the output
wlr_texture_get_matrix(sample->cat_texture, &matrix,
&wlr_output->transform_matrix, local_x, local_y);
wlr_render_with_matrix(sample->renderer,
sample->cat_texture, &matrix);
}
wlr_renderer_end(sample->renderer);
wlr_output_swap_buffers(wlr_output);